Resource self-migration method and system based on cloud computing platform
Technical Field
The invention belongs to the technical field of cloud computing, and particularly relates to a resource self-migration method and system based on a cloud computing platform.
Background
Resource balancing mechanism of cloudstock (cloud computing): when a virtual machine is created, started or restarted on a cloud computing platform, corresponding computing resources and storage resources need to be allocated to the virtual machine, and as cloud computing can monitor the use condition of the resources in real time and select a proper physical machine to respectively deploy the computing resources and the storage resources of the virtual machine according to the monitoring result, the computing resources and the storage resources of the virtual machine are often deployed on different physical machines.
The virtual machine live migration technology comprises the following steps: the live migration is called dynamic migration or real-time migration, so that the IT operation and maintenance personnel can migrate the running virtual machine from one physical machine to another physical machine without pause time. The method and the system have the advantages that the running state of the whole virtual machine is migrated from one physical machine to another physical machine in a hot mode, after migration, the virtual machine still runs smoothly, and a user cannot perceive any difference.
AutoCS (cloud management platform): the method is a secondary development based on a cloudstock API (Application programming interface), adds more management functions, shields some specific operations of a bottom layer, and provides a strong use environment with an interface-friendly function for an end user.
The inventor finds that at least the following problems exist in the prior art: the resource balancing mechanism of cloud computing cannot guarantee that allocated computing resources and storage resources are on the same physical machine, and if the computing resources and the storage resources are not on the same physical machine, slow operation of the physical machine is caused, and meanwhile, IO efficiency is low.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a resource self-migration method and system based on a cloud computing platform, which can ensure that computing resources and storage resources of an applied virtual machine are on the same physical machine, maximize IO efficiency and simultaneously do not destroy the original function of shared storage, aiming at the problems existing in the existing resource balancing mechanism of cloud computing.
The technical scheme adopted for solving the technical problem of the invention is a resource self-migration method based on a cloud computing platform, which is characterized by comprising the following steps:
mirroring the configured computing resources and storage resources for the virtual machine to the corresponding physical machine;
and inquiring whether the computing resources and the management resources configured for the virtual machine are mirrored on the same physical machine, if not, positioning the physical machine where the storage resources are located, and automatically migrating the computing resources to the physical machine where the storage resources are located.
Preferably, before mirroring the configured computing resources and storage resources for the virtual machine onto the corresponding physical machine, the method further includes:
and creating a virtual machine cluster, and configuring computing resources and storage resources for each virtual machine.
Preferably, configuring the computing resources and the storage resources for each virtual machine specifically includes:
and configuring computing resources and storage resources for each virtual machine through a cloud computing application program interface.
Preferably, when mirroring the computing resources and the storage resources of the virtual machine onto the corresponding physical machine, the method further includes:
and recording the address of the virtual machine and the addresses of the physical machines to which the computing resources and the storage resources are respectively mirrored so as to position the physical machine where the storage resources are located.
Preferably, before mirroring the computing resources and the storage resources of the virtual machine onto the corresponding physical machine, the method further includes:
and detecting the load condition of each physical machine through the cloud management platform, and starting mirroring the virtual machine from the physical machine with the lightest load.
Further preferably, the self-migration of the computing resource to the physical machine where the storage resource is located is performed starting from the physical machine with the lightest load, and the self-migration of the computing resource mirrored by the virtual machine is performed.
Preferably, the querying whether the computing resource and the management resource of the virtual machine are on the same physical machine, if the virtual machine is working normally, after the self-migration of the computing resource to the physical machine where the storage resource is located is not performed, the method further includes:
and periodically detecting the mirror image condition of the computing resource and the storage resource of each virtual machine through the cloud management platform.
The technical scheme adopted for solving the technical problem of the invention is a resource self-migration system based on a cloud computing platform, which comprises the following steps:
the resource management module is used for configuring corresponding computing resources and storage resources for each virtual machine;
the resource detection module is used for detecting whether the computing resources and the storage resources of each virtual machine are mirrored to the corresponding physical machine;
and the resource migration module is used for migrating the computing resource and the storage resource which are detected by the resource detection module and are not on the same physical machine, so that the computing resource is migrated to the physical machine where the storage resource is located.
Preferably, the resource recording module is configured to record an address of each virtual machine, and an address of a computing resource and a management resource of each virtual machine mirrored on the physical machine.
The invention has the beneficial effects that:
according to the resource self-migration method and system based on the cloud computing platform, the problem that a resource balance mechanism of cloud computing cannot guarantee that distributed computing resources and storage resources are on the same physical machine is solved according to actual requirements, the computing resources and the storage resources of the applied virtual machine are on the same physical machine, IO efficiency is maximized, and original functions of shared storage are not damaged.
Drawings
FIG. 1 is a schematic process diagram of self-migration in example 1 of the present invention;
fig. 2 is a flowchart of a resource self-migration method based on a cloud computing platform according to embodiment 1 of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
The application scenarios of the embodiment mainly include the following four scenarios:
first, when a user creates a virtual machine, the resource balancing mechanism of cloud computing may cause the computing resources and storage resources to be allocated to different physical machines (HOST).
Second, when the user restarts the virtual machine, the cloud computing rebalances the computing resources and the storage resources of the virtual machine, and the computing resources and the storage resources are allocated to different physical machines.
Third, under certain abnormal conditions, such as split brain, the computing resources of the virtual machine may self-migrate.
Fourth, when a physical machine storing a virtual machine image is down, the storage resources of the virtual machine may also be self-migrated.
In this embodiment, the positioning process of the storage resource is as follows: according to the existing mechanism of Glusterfs, a randomly generated UUID (universally unique identifier) is processed by a hash algorithm, and then a physical machine list is obtained, so that the position of a physical machine where a storage resource is located is determined. In the embodiment, the generated UUID is intercepted before being called by the hash algorithm, and the value of the UUID is stored in the database. And calling an API provided by Glusterfs, taking the intercepted UUID as a parameter to obtain a physical machine list where the storage resource is located so as to complete the positioning of the storage resource, and after the positioning is completed, migrating the computing resource to the storage resource through thermal migration. The storage resources can also be located based on the interface development API provided by other types of File systems (such as GFS, Google File System).
The specific resource migration method and system are as follows.
Example 1:
with reference to fig. 1 and 2, the present embodiment provides a resource self-migration method based on a cloud computing platform, which includes the following steps:
step one, creating a virtual machine cluster, and configuring computing resources and storage resources for each virtual machine.
The step may specifically be: the cloud computing platform detects computing resources and storage resources of the virtual machine images, analyzes load conditions of all the physical machines, starts the virtual machines from the physical machine with the lightest load, and a user calls an Application Program Interface (API) of cloud computing through the cloud management platform to configure corresponding computing resources and storage resources for all the virtual machines.
And step two, mirroring the computing resources and the storage resources of the virtual machine to the corresponding physical machine.
While the step is carried out, the cloud management platform automatically records the address of the virtual machine and the address of the physical machine to which the computing resource and the storage resource are respectively mirrored, so as to judge whether the computing resource and the storage resource are supposed to be on the same physical machine in the following process.
And thirdly, inquiring whether the computing resources and the management resources of the virtual machine are on the same physical machine or not through the cloud management platform, if so, executing the next step, and otherwise, executing the next step after the computing resources are self-migrated to the physical machine where the storage resources are located.
When the self-migration occurs, the self-migration is started from the virtual machine corresponding to the physical machine with the lightest load, and the computing resource and the storage resource are migrated to the same physical.
And step four, the virtual machine works normally.
And step five, the cloud computing platform periodically inquires a mechanism, periodically detects the positions of the computing resources and the storage resources of the virtual machine, and immediately triggers the self-migration of the computing resources if the computing resources and the storage resources are not on the same physical machine.
According to the method, the problem that a resource balancing mechanism of cloud computing cannot guarantee that allocated computing resources and storage resources are on the same physical machine is solved, the computing resources and the storage resources of the applied virtual machine are on the same physical machine, IO efficiency is maximized, and original functions of shared storage are not damaged. Meanwhile, based on a cloud computing REST API and a monitoring API provided by a Glusterfs (a file system developed by Gluster corporation, which is a combination of various different storage servers, these servers are mutually converged by ethernet or Infiniband technology of infinite bandwidth and remote direct memory access RDMA, and finally form a large parallel file system network), a cloud management platform is utilized to monitor the distribution of computing resources and storage resources in the whole life cycle of a virtual machine, and the distribution of the computing resources is adjusted in real time, so as to achieve the purpose that the computing resources and the storage resources coexist in the same physical machine.
Example 2:
the embodiment provides a resource self-migration system of a cloud computing platform, which includes:
the resource management module is used for configuring corresponding computing resources and storage resources for each virtual machine; the resource detection module is used for detecting whether the computing resources and the storage resources of each virtual machine are mirrored to the corresponding physical machine; and the resource migration module is used for migrating the computing resource and the storage resource which are detected by the resource detection module and are not on the same physical machine, so that the computing resource is migrated to the physical machine where the storage resource is located.
When the resource self-migration system based on the cloud computing platform of this embodiment further includes: and the resource recording module is used for recording the address of each virtual machine, and the address of the computing resource and the management resource of each virtual machine mirrored to the physical machine.
The system of the present embodiment can operate according to the method described in embodiment 1, and is not described in detail herein.
It will be understood that the above embodiments are merely exemplary embodiments taken to illustrate the principles of the present invention, which is not limited thereto. It will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the spirit and substance of the invention, and these modifications and improvements are also considered to be within the scope of the invention.