Virtual machine migration method and related equipment
1. A virtual machine migration method is characterized by comprising the following steps:
the controller instructs a proxy virtual machine to mount a volume, the volume including a first drive for running the volume on an original platform;
the controller instructs the proxy virtual machine to replace the first drive in the volume into a second drive, wherein the first drive is a drive required by the original platform to run the volume, and the second drive is a drive required by a target platform to run the volume;
the controller instructs the target platform to mount the replaced volume to a target virtual machine.
2. The method of claim 1, wherein before the controller instructs the proxy virtual machine to replace the first drive in the volume with a second drive, the method further comprises:
and the controller instructs the target platform to acquire the management information of the original virtual machine.
3. The method of claim 2, further comprising:
and the controller instructs the target platform to create the target virtual machine based on the management information of the original virtual machine, wherein the original virtual machine is positioned on the original platform.
4. The method of claim 1, wherein after the controller instructs the proxy virtual machine to replace the first drive in the volume with a second drive, the controller instructs the target platform to mount the replaced volume to a target virtual machine, the method further comprising:
the controller instructs the proxy virtual machine to offload the replaced volume.
5. The method of claim 1, wherein the controller instructs a proxy virtual machine to mount the volume, comprising:
the controller instructs a proxy virtual machine to mount a plurality of volumes, the plurality of volumes belonging to a plurality of virtual machines on the original platform;
the controller instructing the proxy virtual machine to replace the first drive in the volume with a second drive, including:
the controller instructing the proxy virtual machine to replace the first drive in the plurality of volumes as a second drive;
the controller instructs the target platform to mount the replaced volume to a target virtual machine, including:
the controller instructs the target platform to mount the replaced volumes to a plurality of target virtual machines, respectively.
6. The method of claim 1, wherein before the controller instructs the proxy virtual machine to mount the volume, the method further comprises:
the controller instructs the target platform to take a snapshot of the volume;
after the controller instructs the target platform to mount the replaced volume to the target virtual machine, the method further comprises:
the controller instructs the target platform to rollback the snapshot.
7. The method of claim 1, wherein before the controller instructs the proxy virtual machine to mount the volume, the method further comprises:
and the controller instructs the original platform to set operation authority for the volume.
8. The method according to any one of claims 1 to 7, wherein the original platform is an XEN platform and the target platform is a KVM platform.
9. A controller, comprising:
the system comprises an indicating unit, a storage unit and a control unit, wherein the indicating unit is used for indicating a proxy virtual machine to mount a volume, and the volume comprises a first drive used for operating the volume on an original platform;
the indicating unit is further configured to indicate that the proxy virtual machine replaces the first drive in the volume to be a second drive, where the first drive is a drive required by the original platform to run the volume, and the second drive is a drive required by the target platform to run the volume;
the indicating unit is further configured to indicate the target platform to mount the replaced volume to the target virtual machine.
10. The controller according to claim 9, wherein the instructing unit is further configured to instruct the target platform to obtain management information of the original virtual machine.
11. The controller according to claim 10, wherein the instructing unit is further configured to instruct the target platform to create the target virtual machine based on management information of the original virtual machine, and the original virtual machine is located on the original platform.
12. The controller according to claim 9, wherein the instructing unit is further configured to instruct the proxy virtual machine to unload the replaced volume.
13. The controller according to claim 9, wherein the instructing unit is specifically configured to instruct a proxy virtual machine to mount a plurality of volumes, where the plurality of volumes belong to a plurality of virtual machines on the original platform;
the indicating unit is specifically configured to indicate that the proxy virtual machine replaces the first drive in the plurality of volumes as a second drive;
the instructing unit is specifically configured to instruct the target platform to mount the replaced volumes to a plurality of target virtual machines, respectively.
14. The controller according to claim 9, wherein the instructing unit is further configured to instruct the target platform to snapshot the volume;
the indicating unit is further configured to indicate the target platform to rollback the snapshot.
15. The controller according to claim 9, wherein the instructing unit is further configured to instruct the original platform to set an operation authority for the volume.
16. The controller of any one of claims 9 to 15, wherein the original platform is an XEN platform and the target platform is a KVM platform.
17. A controller, comprising:
a memory;
a processor executes instructions in the memory, causing a controller to perform the method of any of claims 1-8.
18. A computer storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1 to 8.
19. A computer program product, characterized in that the computer program product, when executed on a computer, causes the computer to perform the method according to any of claims 1 to 8.
Background
Virtualization technology enables virtualization of hardware resources, allowing many different virtual machines to run on a single physical host. These virtual machines run in isolated virtual hardware environments, which may have different operating systems, providing the same services as the real physical host. With the increasing maturity of virtualization technologies, many mature open-source virtualization technologies, such as kernel-based virtual machine (KVM), open source code virtual machine monitor (XEN), and the like, appear.
However, since different virtualization technologies may be used by product underlayers of different vendors, a new need arises, namely virtual to virtual, V2V. The existing mode of V2V is mainly to obtain a root password of each virtual machine, and transmit disk data of the Virtual Machine (VM) to a target VM.
In the mode, the root password of the user needs to be acquired, and potential safety hazards exist. And if the disk data volume is large, the transmission time of the disk data is long.
Disclosure of Invention
The embodiment of the application provides a virtual machine migration method and related equipment, and the virtual machine migration efficiency can be improved.
A first aspect of an embodiment of the present application provides a virtual machine migration method, including: the controller instructs the proxy virtual machine to mount a volume, the volume including a first drive for running the volume on the original platform; the controller indicates the agent virtual machine to replace a first drive in the volume as a second drive, the first drive is a drive required by the original platform to run the volume, and the second drive is a drive required by the target platform to run the volume; the controller instructs the target platform to mount the replaced volume to the target virtual machine.
In the embodiment of the application, the proxy virtual machine is instructed to mount the volume through the controller, the drive of the original platform in the volume is replaced by the drive of the target platform through the proxy virtual machine, the replaced volume is mounted on the target virtual machine, the volume is not required to be transmitted, the cross-platform migration of the virtual machine is completed, on one hand, the password of a user is not required to be obtained, and the safety is improved. On the other hand, the virtual machine migration can be completed without data transmission, and the virtual machine migration efficiency is improved.
Optionally, in a possible implementation manner of the first aspect, the step of: before the controller instructs the proxy virtual machine to replace the first drive in the volume with the second drive, the method further comprises: and the controller instructs the target platform to acquire the management information of the original virtual machine.
Optionally, in a possible implementation manner of the first aspect, the step further includes: and the controller instructs the target platform to create the target virtual machine based on the management information of the original virtual machine, wherein the original virtual machine is positioned on the original platform.
Optionally, in a possible implementation manner of the first aspect, the step further includes: the controller instructs the proxy virtual machine to offload the replaced volume.
Optionally, in a possible implementation manner of the first aspect, the step of: the controller instructs the proxy virtual machine to mount the volume, including: the controller instructs the proxy virtual machine to mount a plurality of volumes, wherein the volumes belong to a plurality of virtual machines on the original platform; the controller instructs the proxy virtual machine to replace the first drive in the volume with a second drive, including: the controller instructs the proxy virtual machine to replace the first drive in the plurality of volumes as a second drive; the controller instructs the target platform to mount the replaced volume to the target virtual machine, including: the controller instructs the target platform to mount the replaced volumes to the target virtual machines, respectively.
In this possible implementation, the migration of the batch of virtual machines is completed by mounting a plurality of volumes, replacing the drives of the plurality of volumes, and creating a plurality of target virtual machines.
Optionally, in a possible implementation manner of the first aspect, the step further includes: the controller instructs the target platform to take a snapshot of the volume; the controller instructs the target platform to roll back the snapshot.
In the possible implementation mode, switching failure or client remorse is prevented by taking a snapshot, and the file can be rolled back to the version of the volume containing the first drive, so that data loss in the volume caused by switching failure is avoided.
Optionally, in a possible implementation manner of the first aspect, the step further includes: and the controller instructs the original platform to set operation authority for the volume.
In the possible implementation mode, the risk of switching failure caused by misoperation of other people is prevented by setting the operation authority.
Optionally, in a possible implementation manner of the first aspect, the step of: the original platform is an XEN platform, and the target platform is a KVM platform.
The possible implementation mode improves the realizability of the scheme.
A second aspect of the present application provides a controller configured to perform the method of the first aspect or any possible implementation manner of the first aspect. In particular, the controller comprises means or unit for performing the method of the first aspect described above or any possible implementation manner of the first aspect.
A second aspect of the present application provides a controller that performs the method of the first aspect or any possible implementation manner of the first aspect.
A fourth aspect of the present application provides a computer storage medium having stored therein instructions that, when executed on a computer, cause the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
A fifth aspect of the present application provides a computer program product which, when executed on a computer, causes the computer to perform the method of the first aspect or any possible implementation manner of the first aspect.
Drawings
FIG. 1 is a schematic diagram of a network framework for virtual machine migration in an embodiment of the present application;
fig. 2 is a schematic flowchart of a virtual machine migration method in an embodiment of the present application;
FIG. 3 is a schematic structural diagram of a controller according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a controller according to an embodiment of the present disclosure.
Detailed Description
The embodiment of the application provides a virtual machine migration method and related equipment, and the virtual machine migration efficiency can be improved.
The following describes in detail the implementation principle, specific embodiments and corresponding beneficial effects of the technical solutions of the present application with reference to the drawings.
Fig. 1 is a schematic diagram of a network framework for virtual machine migration in an embodiment of the present application. Referring to fig. 1, the network framework in the embodiment of the present application includes: the system comprises an original platform, an original virtual machine, a target platform, a target virtual machine, a controller and a proxy virtual machine.
The original platform is the platform where the original virtual machine of the client is located. The volumes that it needs to migrate are in the storage pools.
The target platform is a target platform, and the client can be a new or existing platform.
The Controller has the main functions of butting the original platform and the target platform, arranging switching services and controlling drive injection. The switching can be carried out individually or in batch. And providing service for business personnel to operate. The Controller in the embodiment of the application may be a server program based on Java/Spring, and the service personnel may perform the following operations through a service page connected to the Controller: selecting an original platform needing to be switched, selecting a target platform needing to be switched, selecting a virtual machine or a template needing to be switched, selecting which virtual machines need to be switched in the same batch, selecting which virtual machines are switched to be exercised, selecting which virtual machines are finished to be exercised, judging whether the virtual machines can be switched according to results, selecting which virtual machines are switched, selecting which virtual machines are confirmed to be switched successfully, selecting which virtual machines to be rolled back to an initial state and the like, wherein the specific details are not limited herein.
The Agent virtual machine Agent can be a service virtual machine which is based on C + + and is specially used for driving injection. The Agent has the main function of receiving the instruction of the Controller to change the drive of the original platform into the drive of the target platform in the data volume.
The Agent and the controller can be borne on an original plane or a target platform. The original virtual machine and the volume are in the original platform in the initial state, if the switching is successful, the original virtual machine is deleted from the original platform, and the volume entity still exists in the storage. If the switch fails, the original virtual machine and volume will still be restored to the initial state. Upgrades to the original platform may be required to support the bi-directional mount of unified storage.
The target platform may also access the storage pool in which the volume is located. If the switch is successful, the target platform will host the volume and create the target virtual machine. And will recover to the original state if the handover is failed. After the switching is successful, the original platform does not manage the storage pool any more.
According to the embodiment of the application, switching selection is carried out in the Controller, the switching task is issued, the system automatically manages the volume to the target platform, and the target virtual machine is established and configured. Compared with the prior art, data is not copied in the process, so that the switching efficiency is greatly improved.
The original platform in the embodiment of the present application may be XEN or VMWare. The target platform may be a KVM. In practical application, as long as the target platform can access the data storage of the original platform, and the interfaces can be called (the original platform and the target platform are adapted to the bidirectional mount and other related interfaces), the original platform and the target platform can also be platforms of other forms, and the specific details are not limited herein.
The following describes, with reference to the network framework of fig. 1, a virtual machine migration method in the embodiment of the present application:
referring to fig. 2, an embodiment of a virtual machine migration method in the embodiment of the present application includes:
in the embodiment of the present application, batch virtual machine migration may also be performed, and a virtual machine migration method is described below by taking only one as an example (batch is similar to a migration process of one).
201. And the controller instructs the target platform to acquire the management information of the original virtual machine.
The controller instructs the target platform to invoke an interface previously developed by the target platform that is platform-provided for operating the operation of the resources of the platform's virtual machines, volumes, etc., e.g., for creating virtual machines or managing volumes.
Optionally, before the controller instructs the target platform to acquire the management information of the original virtual machine, the controller instructs the original platform to close the original virtual machine on the original platform, that is, in the virtual machine switching process, incremental updating of data does not occur, and incomplete data after switching of the virtual machine is avoided. After the original virtual machine is closed, a first operation authority can be set for the original virtual machine and the volume in the original virtual machine, and misoperation of other personnel is avoided.
Optionally, before the controller instructs the target platform to acquire the management information of the original virtual machine, the original virtual machine is not closed, and interruption of the client service can be shortened.
202. The controller instructs the proxy virtual machine to mount the volume.
Optionally, the controller instructs the target platform to snapshot the volume, so as to prevent the volume from being lost after the switching failure.
Before the proxy virtual machine mounts the volume, the controller may instruct the original platform to stop using the original virtual machine on the original platform.
The embodiment of the present application is only schematically illustrated by taking the proxy virtual machine as an example on the target platform, and it can be understood that the proxy virtual machine may also be on the original platform, and is not limited herein specifically.
The controller instructs the proxy virtual machine to mount the volume, which may be the controller instructs the target platform to mount the volume on the proxy virtual machine through the interface.
203. The controller instructs the proxy virtual machine to replace the first drive in the volume as the second drive.
After the volume is mounted on the proxy virtual machine, the controller instructs the proxy virtual machine to replace the first drive in the volume with the second drive. And the proxy virtual machine selects a corresponding second drive according to the drive list of the target platform. The first drive is the drive required by the original platform to run the volume, and the second drive is the drive required by the target platform to run the volume.
204. The controller instructs the proxy virtual machine to offload the replaced volume.
After replacing the first drive with the second drive, the controller instructs the proxy virtual machine to unload the volume so that the volume becomes free.
205. The controller instructs the target platform to create the target virtual machine based on the management information of the original virtual machine.
And the control platform instructs the target platform to receive the management information of the volume in the original virtual machine through a pre-developed interface, and establishes the management information of the volume on the target platform. And the management information is used for establishing the target virtual machine on the target platform.
206. The controller instructs the target platform to mount the replaced volume to the target virtual machine.
The controller instructs the target platform to mount the replaced volume to the target virtual machine containing the volume management information.
After the target platform mounts the replaced volume to the target virtual machine, the target virtual machine may be started. The controller may also instruct the target platform to set a second operating right of the target virtual machine.
Optionally, if the original virtual machine and the volume in the original virtual machine have been previously set with the first operation permission, the volume and the first operation permission of the original virtual machine may be cancelled after the replaced volume is mounted to the target virtual machine.
Optionally, if the target platform makes a snapshot on the volume before, after the target virtual machine is started, whether the service usage of the target virtual machine is normal may be checked, and if so, the snapshot may be deleted. Snapshots (i.e., versions of the first drive in the volume) may be rolled back if not normal or if remorse is removed. If the snapshot is deleted, the second operation authority of the target virtual machine can be cancelled.
After the target virtual machine is started and can normally provide services, the controller instructs the original virtual machine to log off the original virtual machine (delete management data in the virtual machine and reserve the volume).
In the embodiment of the application, the timing for closing the original virtual machine may be the start of the switching method, or before the drive is replaced, if the original virtual machine starts to be closed, incremental updating of data does not occur, and incomplete data after the virtual machine is switched is avoided. If the original virtual machine is closed when the drive is to be replaced, the time for interrupting the customer service can be shortened.
According to the embodiment of the application, the volume is mounted in a bidirectional mode in advance, the cross-engine switching is arranged by using the controller, the agent is used for injecting the second drive suitable for the target platform into the volume, the cross-engine migration without the need of data relocation is automatically achieved, and therefore the migration duration is greatly reduced. And the password of the user does not need to be collected without entering the client system. There is no other lasting performance impact on the original service of the user except for the minute-scale short pause. And the Controller and the Agent load are reasonably deployed, so that the concurrent migration capability can be greatly improved, and the method is suitable for the migration of batch virtual machines.
The virtual machine migration method in the embodiment of the application may be applied to an X86 architecture, an ARM architecture, and the like, and is not limited herein specifically, as long as the target platform supports the architecture and can call the interface, the volume of the original platform can be implemented and identified, and the virtual machine migration efficiency can be improved.
With reference to fig. 3, the controller in the embodiment of the present application is described below, where the virtual machine migration method in the embodiment of the present application is described above, and an embodiment of the controller in the embodiment of the present application includes:
an indicating unit 301, configured to instruct the proxy virtual machine to mount a volume, where the volume includes a first driver for running the volume on an original platform.
The indicating unit 301 is further configured to indicate that the first drive in the replacement volume of the proxy virtual machine is a second drive, where the first drive is a drive required by the original platform to run the volume, and the second drive is a drive required by the target platform to run the volume.
The instructing unit 301 is further configured to instruct the target platform to mount the replaced volume to the target virtual machine.
The indicating unit 301 is further configured to instruct the target platform to obtain management information of the original virtual machine.
The indicating unit 301 is further configured to indicate the target platform to create the target virtual machine based on the management information of the original virtual machine, where the original virtual machine is located on the original platform.
The instructing unit 301 is further configured to instruct the proxy virtual machine to unload the replaced volume.
The instructing unit 301 is specifically configured to instruct the proxy virtual machine to mount a plurality of volumes, where the plurality of volumes belong to a plurality of virtual machines on the original platform.
The instructing unit 301 is specifically configured to instruct the proxy virtual machine to replace the first drive in the plurality of volumes as the second drive.
The instructing unit 301 is specifically configured to instruct the target platform to mount the replaced volumes to the target virtual machines respectively.
The indicating unit 301 is further configured to indicate the target platform to make a snapshot of the volume.
The indicating unit 301 is further configured to indicate the target platform to roll back the snapshot.
The indicating unit 301 is further configured to indicate the original platform to set an operation authority for the volume.
In this embodiment of the application, the indication unit 301 indicates the proxy virtual machine to mount the volume, the proxy virtual machine replaces the drive of the original platform in the volume with the drive of the target platform, and then mounts the replaced volume on the target virtual machine, so that the volume is not required to be transferred, and the cross-platform migration of the virtual machine is completed.
Fig. 4 is a schematic structural diagram of a controller according to an embodiment of the present disclosure, where the controller 400 may include one or more processors 401 and a memory 405, and one or more applications or data are stored in the memory 405.
Memory 405 may be volatile storage or persistent storage, among other things. The program stored in the memory 405 may include one or more modules, each of which may include a series of instruction operations in the controller 400. Further, the processor 401 may be configured to communicate with the memory 405 to execute a series of instruction operations in the memory 405 on the controller 400.
The controller 400 may also include one or more power supplies 402, one or more wired or wireless network interfaces 403, one or more input-output interfaces 404, and/or one or more operating systems, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The processor 401 may perform the operations performed by the controller in the embodiment shown in fig. 2, which are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:计算节点升级的方法和装置