Disclosure of Invention
The embodiment of the invention provides a migration method, a migration device, a storage medium and an electronic device of a cross-cloud platform virtual machine, which at least solve the problems that in the related art, the migration in a data center cannot be completed in different places, manual intervention is required in the whole process of import and export, and consistency of a disk file chain structure cannot be maintained.
According to one embodiment of the invention, a virtual machine migration method across cloud platforms is provided, which comprises the steps of creating migrated destination virtual machines on a destination cloud platform, wherein configuration information of the destination virtual machines is consistent with configuration information of source virtual machines of a source cloud platform, network port groups of the destination virtual machines are configured as network port groups of the destination cloud platform, disk storage libraries of the destination virtual machines are configured as magnetic storage libraries of the destination cloud platform, and migrating file nodes into the magnetic storage libraries of the destination virtual machines of the destination cloud platform one by one in a network copy mode according to a disk file chain structure of the source virtual machines of the source cloud platform.
In an exemplary embodiment, before the destination cloud platform creates the migrated destination virtual machine, the method further includes adding the source virtual machine to be migrated to a migration list through a management interface.
Further, after the source virtual machine to be migrated is added into the migration list through the management interface, the method further comprises the steps of setting migration starting time of the source virtual machine, and triggering migration operation of the source virtual machine when the migration time is reached.
In an exemplary embodiment, according to the disk file chain structure of the source virtual machine of the source cloud platform, file nodes are migrated one by one to a disk storage of a destination virtual machine of the destination cloud platform in a network copy mode, and the method further comprises the steps of constructing a disk list to be migrated of the source virtual machine, constructing a file list to be migrated for each disk, selecting a host in the source cloud platform or the destination cloud platform, and copying and operating the disk file of the source virtual machine to the disk storage of the virtual machine.
Further, selecting the host in the source cloud platform or the destination cloud platform to copy the disk file of the source virtual machine to the disk storage library of the virtual machine includes selecting the host of the source cloud platform to copy the disk file, sending a message to the destination cloud platform to judge whether the destination virtual machine has a copied shared node, waiting for the shared node to be copied by the host of the source cloud platform when the shared node is being copied, and stopping the copying operation of the shared node by the host of the source cloud platform and copying the next disk file node when the shared node is completed.
Further, after sending a message to the destination cloud platform and judging whether the destination virtual machine has a copied shared node, sending a message to a host of the destination cloud platform when the shared node is copied for the first time, so as to start the host of the destination cloud platform to copy the shared node on the network.
According to another embodiment of the invention, a virtual machine migration device crossing a cloud platform is provided, which comprises a creation module and a migration module, wherein the creation module is used for creating a migrated destination virtual machine on a destination cloud platform, configuration information of the destination virtual machine is consistent with that of a source virtual machine of a source cloud platform, a network port group of the destination virtual machine is configured as a network port group of the destination cloud platform, a disk storage library of the destination virtual machine is configured as a disk storage library of the destination cloud platform, and the migration module is used for migrating file nodes into the disk storage libraries of the destination virtual machine of the destination cloud platform one by one in a network copy mode according to a disk file chain structure of the source virtual machine of the source cloud platform.
In an exemplary embodiment, the system further comprises a management module, wherein the management module is used for adding the source virtual machine needing to be migrated into a migration list through a management interface before the destination virtual machine is created.
Further, the system also comprises a setting module, which is used for setting the migration starting time of the source virtual machine so as to trigger the migration operation of the source virtual machine when the migration time arrives.
In an exemplary embodiment, the migration module further comprises a list construction unit, an execution unit and a storage unit, wherein the list construction unit is used for constructing a disk list to be migrated of the source virtual machine and constructing a file list to be migrated for each disk, and the execution unit is used for selecting a host in the source cloud platform or the destination cloud platform to operate disk file copy of the source virtual machine into a disk storage of the virtual machine.
Further, the execution unit is further configured to select a host of a source cloud platform to perform disk file copying operation, send a message to the destination cloud platform, determine whether the destination virtual machine has a copied shared node, wait for the shared node to complete copying if the shared node is copying, and not perform the copying operation of the shared node and perform copying of a next disk file node if the shared node has completed copying.
Further, the executing unit is further configured to send a message to the host of the destination cloud platform when the common node is the first copy, so as to start the host of the destination cloud platform to perform network copy on the common node.
According to a further embodiment of the invention, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
According to a further embodiment of the invention, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to the embodiment of the invention, the message channel of the message component among the different-place cloud platforms is opened by creating the target virtual machine without the disk entity in the different-place data center, and the disk file chain is copied in a completely symmetrical mode based on the network copy mode of the management network, so that the problems that the migration in the data center in the related art cannot be completed, the manual intervention is required in the whole process of importing and exporting, and the consistency of the disk file chain structure cannot be maintained in the related art can be solved, and the effects of realizing the different-place migration of the virtual machine across the cloud platforms and keeping the consistency of the disk file chain structure are achieved.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
In this embodiment, a method for migrating a virtual machine across a cloud platform is provided, and fig. 1 is a flowchart of the method for migrating a virtual machine across a cloud platform according to an embodiment of the present invention, as shown in fig. 1, where the flowchart includes the following steps:
Step S101, a migrated destination virtual machine is created on a destination cloud platform, wherein configuration information of the destination virtual machine is consistent with configuration information of a source virtual machine of a source cloud platform, a network port group of the destination virtual machine is configured as a network port group of the destination cloud platform, and a disk storage library of the destination virtual machine is configured as a magnetic disk storage library of the destination cloud platform;
step S102, migrating file nodes one by one to a magnetic disk storage of a target virtual machine of the target cloud platform in a network copy mode according to a magnetic disk file chain structure of the source virtual machine of the source cloud platform.
Before step S101 of this embodiment, the method may further include adding, through a management interface, the source virtual machine that needs to be migrated to a migration list.
In this embodiment, after the source virtual machine to be migrated is added to the migration list through the management interface, the method may further include setting a migration start time of the source virtual machine, and triggering a migration operation on the source virtual machine when the migration time arrives.
In this embodiment, step S102 may include constructing a disk list to be migrated of the source virtual machine, and constructing a file list to be migrated for each disk, and selecting a host in the source cloud platform or the destination cloud platform to copy and operate the disk file of the source virtual machine to a disk repository of the virtual machine.
In this embodiment, selecting the host in the source cloud platform or the destination cloud platform to copy the disk file of the source virtual machine to the disk storage library of the virtual machine may include selecting the host of the source cloud platform to copy the disk file, sending a message to the destination cloud platform to determine whether a copied common node exists in the destination virtual machine, waiting for the common node to be copied by the host of the source cloud platform when the common node is being copied, and not performing the copy operation of the common node and copying the next disk file node by the host of the source cloud platform when the common node is completed.
In this embodiment, after sending a message to the destination cloud platform and determining whether the destination virtual machine has a shared node that has been copied, when the shared node is first copied, sending a message to a host of the destination cloud platform to start the host of the destination cloud platform to perform network copying on the shared node may be further included.
Through the steps, the destination virtual machine without a disk entity is created in the remote data center, the message channel of the message component among the remote cloud platforms is opened, the disk file chain is copied in a completely symmetrical mode based on the network copy mode of the management network, the problems that the remote migration cannot be completed in the data center, manual intervention is required in the whole import and export process, and consistency of the disk file chain structure cannot be maintained in the related art are solved, and the effects of realizing the remote migration of the virtual machine across the cloud platforms and keeping the consistency of the disk file chain structure are achieved.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiment also provides a cross-cloud-platform virtual machine migration device, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the terms "module," "unit" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 2 is a block diagram of a cross-cloud-platform virtual machine migration apparatus according to an embodiment of the present invention, and as shown in fig. 2, the apparatus includes a creation module 10 and a migration module 20.
The creating module 10 is configured to create a migrated destination virtual machine on a destination cloud platform, where configuration information of the destination virtual machine is consistent with configuration information of a source virtual machine of a source cloud platform, a network port group of the destination virtual machine is configured as a network port group of the destination cloud platform, and a disk storage library of the destination virtual machine is configured as a disk storage library of the destination cloud platform;
The migration module 20 is configured to migrate file nodes one by one to a disk storage of a destination virtual machine of the destination cloud platform in a network copy manner according to a disk file chain structure of the source virtual machine of the source cloud platform.
Fig. 3 is a block diagram of a cross-cloud-platform virtual machine migration apparatus with a management module according to an embodiment of the present invention, and as shown in fig. 3, the apparatus may further include a management module 30 and a setting module 40 in addition to all the modules shown in fig. 2.
The management module 30 is configured to add, through a management interface, the source virtual machine to be migrated to a migration list before creating the destination virtual machine.
The setting module 40 is configured to set the migration start time of the source virtual machine, so as to trigger a migration operation on the source virtual machine when the migration time arrives.
Fig. 4 is a block diagram of a cross-cloud-platform virtual machine migration apparatus with an execution unit according to an embodiment of the present invention, and as shown in fig. 4, the migration module 20 may further include a list construction unit 21 and an execution unit 22, in addition to all the modules shown in fig. 2.
The list construction unit 21 is configured to construct a disk list to be migrated of the source virtual machine, and construct a file list to be migrated for each disk;
The executing unit 22 is configured to select a host in the source cloud platform or the destination cloud platform to copy and operate a disk file of the source virtual machine to a disk storage of the virtual machine.
In this embodiment, the executing unit 22 may be further configured to select a host of a source cloud platform to perform a disk file copying operation, send a message to the destination cloud platform, determine whether the destination virtual machine has a shared node that has already been copied, wait for the shared node to complete copying if the shared node is being copied, and not perform a copying operation of the shared node and perform copying of a next disk file node if the shared node has completed copying.
In this embodiment, the executing unit 22 may be further configured to send a message to the host of the destination cloud platform to start the host of the destination cloud platform to perform network copy on the common node if the common node is the first copy.
It should be noted that each of the above modules may be implemented by software or hardware, and the latter may be implemented by, but not limited to, the above modules all being located in the same processor, or each of the above modules being located in different processors in any combination.
Embodiments of the present invention also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In an exemplary embodiment, the computer readable storage medium may include, but is not limited to, a U disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, etc. various media in which a computer program may be stored.
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
In order to facilitate understanding of the technical solutions provided by the present invention, the following details will be described in connection with embodiments of specific scenarios.
The invention provides a method for migrating a virtual machine across a cloud platform in different places. The method has the advantages that the destination virtual machine without disk entities is created in the remote data center, the message channel of the message component among the remote cloud platforms is opened, the disk file chains are copied in a completely symmetrical mode based on the network copy mode of the management network, the remote migration of the virtual machine across the cloud platforms is finally realized, meanwhile, the design that the common nodes of the disks are not repeatedly copied is carried out, and the efficiency of the remote migration is improved.
The invention aims at providing a method for migration of a virtual machine in different places based on a network copy mode in a scene of using a cloud desktop in different places. Firstly, the scheme can realize that the whole virtual machine is migrated from the cloud platform of the data center A to the cloud platform of the data center B. Secondly, the scheme can set the starting time and the ending time of migration, and migration can be performed in non-working time to avoid influencing normal use of users. Moreover, the migration failure of the scheme does not affect the source virtual machine, and the user can still normally use the cloud desktop. In addition, the scheme keeps the structure of the disk file chain of the virtual machine, and the disk structures of the target virtual machine and the source virtual machine are consistent. Finally, the scheme does not repeat copying of the copied virtual machine shared file nodes, and migration efficiency is improved.
The core content of the alternative embodiment of the invention is that the management platforms can communicate with each other to obtain the management data of the virtual machine by opening message components among different cloud platforms, the successive copying of the disk file nodes of the virtual machine is completed based on a network copying mode, the copying process is completely symmetrical, the consistency of the disk structures of the source virtual machine and the destination virtual machine is ensured, and the shared disk file nodes are not repeatedly copied, so that the migration of the whole machine of the virtual machine in different places under extremely limited conditions is completed.
Fig. 5 is a schematic diagram of a scheme for migrating a virtual machine to a remote cloud platform by means of export import according to the related art, and as shown in fig. 5, migrating a virtual machine from a-land cloud platform to a remote cloud platform by means of export import operation of the virtual machine. Firstly, exporting the A-place virtual machine to an nfs storage, and secondly, importing the disk image file on the nfs storage and the configuration information of the virtual machine into the B-place cloud platform through an importing operation.
Fig. 6 is a schematic diagram of completing migration of a whole virtual machine through cross-cloud platform migration according to an alternative embodiment of the present invention, as shown in fig. 6, firstly, creating a migrated destination virtual machine in a B-site cloud platform, where various basic configuration information of the virtual machine is consistent with a source virtual machine, the virtual machine does not have a disk entity file, a storage library of a disk is a storage library of a selected B-site cloud platform, a network card of the virtual machine is configured as a network port group in the destination cloud platform, and secondly, migrating file nodes one by one to the storage library of the B-site cloud platform through a network copy mode according to a disk file chain structure.
By comparing the schematic diagrams of fig. 5 and fig. 6, the advantages of the migration scheme across the data center over the import and export scheme can be seen, namely, firstly, the migration process is completely automatic without multiple human intervention, the operation flow is convenient, and secondly, the disk file chain structure is maintained, and the parent-child relationship of the file nodes can still be maintained.
Fig. 7 is a schematic diagram of a migration scheme of a whole machine inside a cloud platform according to an alternative embodiment of the present invention, and fig. 8 is a flowchart of a migration method of a whole machine inside a cloud platform according to an alternative embodiment of the present invention, as shown in fig. 7 and 8, the method includes the steps of:
step S801, a disk list to be migrated of a virtual machine is constructed;
step S802, constructing a file list to be migrated of each disk of the virtual machine;
step S803, selecting a host in the platform for each disk file node to copy data;
In step S804, the virtual machine may run in the new resource pool and the new storage library after the disk file copying is completed.
FIG. 9 is a schematic diagram comparing networking conditions relied on by internal migration and cross-platform migration of a cloud platform according to an alternative embodiment of the present invention, as shown in FIG. 9, in the same platform, storage libraries may be all communicated with a host, and then copy migration of disk data may be completed by directly selecting a single host through a storage network. The virtual machine migration across the data center, the storage networks in the two places are isolated, so that the migration of the disk file nodes is completed by the mutual cooperation of two hosts in the two cloud platforms depending on the management network. Therefore, the cross-cloud platform can complete migration of the virtual machine under extreme conditions without depending on a storage network.
The cross-platform migration scheme is exported through the import of fig. 5 and 6, and the virtual machine migration within the platform of fig. 9 is compared with the migration across the cloud platform. The advantages of the present solution can be summarized in the following points:
(1) The operation flow is completely automatic, and the platform can complete the migration operation of the virtual machine only by adding the virtual machine to be migrated into a to-be-migrated list and setting the starting time and the ending time of migration;
(2) Migration does not change the structure of the disk file chain, so that the characteristic of difference, such as a virtual machine restoration function, can be maintained;
(3) The whole migration of the virtual machine can be completed under a specific scene without depending on a storage network.
The implementation of the technical solution of this alternative embodiment is described in further detail below with reference to the accompanying drawings:
the application scene of the optional embodiment of the invention is in a large data center virtualized cloud platform environment;
FIG. 10 is a flowchart of a method for migrating a virtual machine across cloud platforms in place, according to an alternative embodiment of the present invention, as shown in FIG. 10, the method comprising the steps of:
s1001, adding a virtual machine to be migrated into a migration list through a management interface;
S1002, setting the starting and ending time of virtual machine migration;
s1003, triggering the inter-data center remote migration operation of the virtual machine after the migration time is reached;
And S1004, sending a message to a destination cloud platform to create a destination virtual machine, wherein the basic configuration information of the destination virtual machine is consistent with that of the source virtual machine. The network card port group and the magnetic disk storage use a network and a storage library on a target cloud platform;
s1005, constructing a disk file list to be migrated;
S1006, selecting a host of the source cloud platform to perform disk file copy operation;
S1007, sending a message to the selected target cloud platform, and judging whether the copied public node exists at the opposite end;
S1008, if the shared node is being copied, waiting for the copying to be completed, if the shared node is already copied, copying the next file node without copying;
S1009, if the shared node is copied for the first time, sending a message to the destination end host to start the network copy server;
S1010, a host on a source platform starts a network copy client;
s1011, copying the file node, and copying the file node of the lower disk;
and S1012, finishing migration of the virtual machine disks and finishing migration of the whole machine.
The method and the device can carry out whole machine migration of the business virtual machine across the data center in different places aiming at a large-scale data center scene, carry out complete symmetrical copying aiming at the disk of the virtual machine by opening a single-instance mode of a message component, and finish the whole machine migration of the virtual machine based on a network copying mode. Meanwhile, the common node is not repeatedly copied, so that the migration efficiency is improved. The scheme can complete the whole machine remote migration of the virtual machine conveniently, improve user experience, reduce operation and maintenance cost and reasonably schedule resources among the data centers.
The foregoing is a further detailed description of the present systems and methods in connection with the specific embodiments, and is not intended to limit the practice of the present systems and methods to only those descriptions. It should be understood that those skilled in the art to which the present system and method pertains may make several simple deductions or substitutions without departing from the spirit of the present invention, and should be considered to fall within the scope of the present system and method.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention should be included in the protection scope of the present invention.