Virtual machine migration method and device, equipment and medium
By migrating disks to a shared storage pool and converting configuration files and hardware devices during virtual machine migration, the compatibility and efficiency issues of cross-platform migration are resolved, enabling rapid startup of cross-platform virtual machines and business continuity, thus improving migration efficiency.
Patent Information
- Application Number
- CN202511190942.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-22
- Publication Date
- 2025-12-05
AI Technical Summary
Existing technologies suffer from performance loss and increased complexity when migrating virtual machines across platforms, resulting in low migration efficiency. In particular, compatibility issues between different virtualization platforms such as VMware and KVM are difficult to resolve.
By migrating the disks of the virtual machines to be migrated to a shared storage pool, and converting the configuration files and virtual hardware devices to a format compatible with the target platform, a cross-platform shared storage pool is built using the NFS protocol. Combined with a real-time metadata conversion engine, automatic compatibility and fast startup of virtual machines are achieved.
While ensuring virtual machine performance, the efficiency of cross-platform migration was improved, business interruption time was reduced, and the impact of data copying and snapshotting on performance was avoided, thus achieving cross-platform migration compatibility and business continuity.
Smart Images

Figure CN121070516A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of virtual machine migration, and particularly relates to a virtual machine migration method, device, equipment and medium. BACKGROUND
[0002] With the rapid development of cloud computing and virtualization technology, virtual machines have become a basic component in data centers and cloud environments. However, with the growth and change of business, the migration of virtual machines has become an urgent problem. When performing cross-platform virtual machine migration, researchers have proposed various solutions, such as using middleware or proxy servers to implement virtual machine migration. These solutions have the disadvantages of performance loss and increased complexity, and the migration efficiency is low.
[0003] Therefore, how to improve the efficiency of cross-platform virtual machine migration while ensuring the performance of the virtual machine is a problem to be solved by those skilled in the art. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a virtual machine migration method, device, equipment and medium, which can improve the efficiency of cross-platform virtual machine migration while ensuring the performance of the virtual machine. The specific scheme is as follows:
[0005] In a first aspect, the present application provides a virtual machine migration method, comprising:
[0006] migrating the disk of the virtual machine to be migrated from the local storage pool of the virtual machine to be migrated to a shared storage pool, wherein the virtual machine to be migrated is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform;
[0007] converting the configuration file of the virtual machine to be migrated into a configuration file compatible with the second virtualization platform to obtain a target configuration file;
[0008] converting the virtual hardware device of the virtual machine to be migrated into a target virtual hardware device compatible with the second virtualization platform;
[0009] registering a target virtual machine based on the target configuration file on the second virtualization platform, and starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool.
[0010] Optionally, before migrating the disk of the virtual machine to be migrated from the local storage pool of the virtual machine to be migrated to the shared storage pool, the method further comprises:
[0011] obtaining operating system information of the virtual machine to be migrated;
[0012] In a case that it is determined that the target operating system based on the operating system information, an input / output semi-virtualization driver is injected into the virtual machine to be migrated, so that the target virtual machine is started based on the input / output semi-virtualization driver.
[0013] Optionally, before migrating the disk of the virtual machine to be migrated from the local storage pool of the virtual machine to be migrated to the shared storage pool, the method further comprises:
[0014] The shared storage pool is mounted on the host corresponding to the first virtualization platform and the second virtualization platform respectively.
[0015] Optionally, the converting the virtual hardware device of the virtual machine to be migrated into the target virtual hardware device compatible with the second virtualization platform comprises:
[0016] The virtual hardware device of the virtual machine to be migrated is converted into the target virtual hardware device compatible with the second virtualization platform based on a preset mapping rule.
[0017] Optionally, after starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool, the method further comprises:
[0018] The disk is converted into a target format.
[0019] Optionally, the method further comprises:
[0020] If the target virtual machine fails to start, the virtual machine to be migrated is started to provide services through the virtual machine to be migrated.
[0021] Optionally, the converting the configuration file of the virtual machine to be migrated into the target configuration file compatible with the second virtualization platform comprises:
[0022] The configuration file of the virtual machine to be migrated is converted into the target configuration file compatible with the second virtualization platform through a preset conversion engine, and the virtual hardware device of the virtual machine to be migrated is converted into the target virtual hardware device compatible with the second virtualization platform.
[0023] Correspondingly, the method further comprises recording a log of the preset conversion engine, so as to analyze problems based on the log.
[0024] In a second aspect, the application provides a virtual machine migration device, comprising:
[0025] a disk migration module, configured to migrate a disk of a to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, wherein the to-be-migrated virtual machine is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform;
[0026] a configuration conversion module, configured to convert a configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file;
[0027] a device conversion module, configured to convert a virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform;
[0028] a virtual machine starting module, configured to register a target virtual machine based on the target configuration file on the second virtualization platform, and start the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool.
[0029] In a third aspect, the present application provides an electronic device, comprising:
[0030] a memory, configured to store a computer program;
[0031] a processor, configured to execute the computer program to implement the steps of the foregoing virtual machine migration method.
[0032] In a fourth aspect, the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the foregoing virtual machine migration method.
[0033] In a fifth aspect, the present application provides a computer program product, comprising computer programs / instructions, which are executed by a processor to implement the steps of the foregoing disclosed virtual machine migration method.
[0034] According to the above scheme, the present application provides a virtual machine migration method, comprising: migrating a disk of a to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, wherein the to-be-migrated virtual machine is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform; converting a configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file; converting a virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform; registering a target virtual machine based on the target configuration file on the second virtualization platform, and starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool.
[0035] It can be seen that the application has the beneficial effects that the application migrates the disk of the virtual machine on the first virtualization platform to the shared storage pool first, and the target virtual machine on the second virtualization platform directly references the disk in the shared storage pool, realizing the cross-platform sharing of the storage resource, avoiding the data copying link, and performing the automatic conversion of the configuration file and the virtual machine hardware device, guaranteeing the compatibility of the cross-platform migration, in combination with the shared storage pool and the automatic conversion of the configuration file and the virtual machine hardware device, the target virtual machine can be quickly started on the second virtualization platform, guaranteeing the business continuity and the migration efficiency, and in the virtual machine migration process, the snapshot is not needed, avoiding the influence of the snapshot on the virtual machine performance. In this way, the efficiency of the virtual machine cross-platform migration is improved under the guarantee of the virtual machine performance.
[0036] Correspondingly, the application provides a virtual machine migration device, equipment and medium, which also have the above technical effects. BRIEF DESCRIPTION OF DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the application, the drawings needed in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0038] Figure 1 A virtual machine migration method flow chart is provided for the embodiments of the application.
[0039] Figure 2 A virtual machine migration schematic diagram is provided for the embodiments of the application.
[0040] Figure 3 A virtual machine migration device structure schematic diagram is provided for the embodiments of the application.
[0041] Figure 4 An electronic equipment structure diagram is provided for the embodiments of the application. DETAILED DESCRIPTION
[0042] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only some of the embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.
[0043] The terms "including", "containing", "having" and their conjugates, as used herein, are meant to encompass the terms "consisting of" and "consisting essentially of". Methods recited as processes are understood to be encompassing all steps of the processes in the specific order described, unless otherwise understood.
[0044] With the rapid development of cloud computing and virtualization technology, virtual machines have become a basic component in data centers and cloud environments. However, with the growth and change of business, the migration of virtual machines has become an urgent problem. Traditional virtual machine migration methods have many limitations, such as long downtime, data inconsistency, etc. Therefore, how to realize the online migration of cross-platform virtual machines has become a problem to be solved. VMware and KVM are two of the most commonly used virtualization platforms, but the compatibility problem between them makes the migration of virtual machines difficult. VMware uses VMDK file format, while KVM uses qcow2 or raw file format, which makes direct migration impossible. The configuration files of virtual machines (such as VMX and libvirt XML) also have compatibility problems, which makes the migration process more complex. In order to solve these problems, researchers have proposed various solutions, such as using middleware or proxy servers to implement virtual machine migration. These solutions have the disadvantages of performance loss and increased complexity. Therefore, a new method is needed to realize the online migration of cross-platform virtual machines, which can solve the compatibility problem, reduce downtime and ensure data consistency, improve the efficiency of virtual machine cross-platform migration while ensuring the performance of virtual machines.
[0045] In order to enable those skilled in the art to better understand the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0046] Next, a virtual machine migration method provided by an embodiment of the present application will be described in detail. Figure 1 A flowchart of a virtual machine migration method provided by an embodiment of the present application, the virtual machine migration method comprising:
[0047] Step S11: migrating the disk of the virtual machine to be migrated from the local storage pool of the virtual machine to be migrated to a shared storage pool, wherein the virtual machine to be migrated is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform.
[0048] The first virtualization platform and the second virtualization platform are different virtualization platforms, for example, the first virtualization platform is a VMware platform and the second virtualization platform is a KVM platform. The embodiment can deploy a shared storage pool of an NFS (Network FileSystem) protocol. The NFS is one of the current mainstream heterogeneous platform shared file systems.
[0049] Before migrating the disk of the to-be-migrated virtual machine from the local storage pool of the to-be-migrated virtual machine to the shared storage pool, the embodiment further includes: mounting the shared storage pool on the host corresponding to the first virtualization platform and the second virtualization platform respectively. The host is a host corresponding to the virtual machine.
[0050] In addition, before migrating the disk of the to-be-migrated virtual machine from the local storage pool of the to-be-migrated virtual machine to the shared storage pool, the embodiment further includes: obtaining operating system information of the to-be-migrated virtual machine; in the case of determining that the target operating system based on the operating system information, injecting an input-output semi-virtualization driver into the to-be-migrated virtual machine, so as to start the target virtual machine based on the input-output semi-virtualization driver. The target operating system is Windows, so that the blue screen of the virtual machine after migration can be avoided.
[0051] Step S12: converting the configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file.
[0052] In an optional embodiment, a KVM (Kernel-based Virtual Machine, an open source system virtualization module) compatible virtual machine XML configuration file can be generated based on the configuration file of the to-be-migrated VMware virtual machine.
[0053] Step S13: converting the virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform.
[0054] In the embodiment, the virtual hardware device of the to-be-migrated virtual machine can be converted into a target virtual hardware device compatible with the second virtualization platform based on a preset mapping rule.
[0055] For example, the virtual hardware device VMXNET3 is converted into virtio-net.
[0056] In an optional embodiment, the configuration file of the virtual machine to be migrated can be converted into a configuration file compatible with the second virtualization platform by a preset conversion engine to obtain a target configuration file, and the virtual hardware device of the virtual machine to be migrated can be converted into a target virtual hardware device compatible with the second virtualization platform.
[0057] In an optional embodiment, the configuration file of the virtual machine to be migrated can be parsed by a preset conversion engine in a memory resident manner, and the configuration file can be converted into a configuration file compatible with the second virtualization platform to obtain a target configuration file, and the virtual hardware device of the virtual machine to be migrated can be converted into a target virtual hardware device compatible with the second virtualization platform. The configuration file of the virtual machine to be migrated can be loaded into the memory, the configuration file of the virtual machine to be migrated can be parsed into an abstract syntax tree and context association analysis is performed, and then configuration parameters are parsed, the parsed configuration parameters are injected into a template file, and a configuration file compatible with the second virtualization platform is obtained. In this way, the configuration file conversion and the virtual hardware device conversion can be automatically and quickly performed.
[0058] Step S14: The target virtual machine is registered based on the target configuration file on the second virtualization platform, and the target virtual machine is started based on the target virtual hardware device and the disk migrated into the shared storage pool.
[0059] In an optional embodiment, the VMware virtual machine can be safely closed, and after the VMware virtual machine is completely closed, the KVM virtual machine can be started by loading the VMDK disk in the shared storage pool through libvirt. Libvir is an open source virtualization management software, which realizes unified management of KVM, Xen, QEMU and other virtualization technologies through API, daemon (libvirtd) and command line tool (virsh).
[0060] Further, after the target virtual machine is started based on the target virtual hardware device and the disk migrated into the shared storage pool, the disk is further converted into a target format.
[0061] In an optional embodiment, the VMDK disk format can be converted into QCOW2 format online, and the entire process of online migration of the VMware virtual machine is completed. The QCOW2 format has better performance under the KVM platform.
[0062] With the first virtualization platform being VMware platform and the second virtualization platform being KVM platform as an example, the embodiment of the present application can deploy a shared storage pool of NFS protocol, and mount the NFS storage pool to the source VMware cluster and the target KVM cluster simultaneously. The virtual machine on the VMware side performs whole-machine online migration, stores the VMDK file of the virtual machine in the NFS shared directory, and the KVM side directly references the VMDK file in the same path through libvirt configuration. Through a real-time metadata conversion engine, i.e., a preset conversion engine, the VMware virtual machine configuration is dynamically converted to libvirt XML in the memory, and the virtual device adaptation is automatically completed, so as to convert the VMware virtual hardware device to a KVM compatible device (such as VMXNET3→virtio-net). The VMware virtual machine is safely closed, and after the VMware virtual machine is completely closed, the KVM virtual machine is started through libvirt loading the VMDK disk. The VMDK disk format is converted to QCOW2 format online, and the whole process of the VMware virtual machine online migration is completed. The online migration of the virtual machine is realized through the NFS storage pool and the storage mapping mechanism, and the configuration synchronization and the virtual device compatibility of the virtual machine are realized through the real-time metadata conversion engine and the virtual device adaptation layer, and at the same time, the influence of snapshot is avoided, and the performance of the virtual machine is greatly guaranteed.
[0063] That is, the embodiment of the present application provides a shared storage layer: deploying a shared storage pool based on NFS protocol, and mounting to the source VMware cluster and the target KVM cluster simultaneously. A storage mapping mechanism is adopted: storing the VMware virtual machine disk file (VMDK) in the NAS shared directory, and the KVM side directly references the VMDK file in the same path through libvirt configuration. Dynamic metadata conversion: through a real-time metadata conversion engine, the VMware virtual machine configuration (.vmx) is dynamically converted to libvirt XML in the memory, realizing the cross-platform compatible adaptation of the virtual hardware device. Device compatible processing: built-in device mapping rule library, automatically converting the VMware virtual device to KVM compatible device (such as VMXNET3→virtio-net, IDE controller→virtio-blk). Lossless switching process: after the VMware virtual machine is closed, the KVM virtual machine is started by libvirt loading the VMDK, and the VMDK is converted to QCOW2 format in the background asynchronously.
[0064] Further, in the embodiment of the present application, if the target virtual machine fails to start, the virtual machine to be migrated is started to provide services through the virtual machine to be migrated. In this way, the service interruption time can be minimized.
[0065] Moreover, the embodiment of the present application can record the log of the preset conversion engine, so as to analyze problems based on the log. For example, the above-mentioned start failure problem.
[0066] As can be seen, this embodiment of the invention first migrates the disks of virtual machines on the first virtualization platform to a shared storage pool. The target virtual machine on the second virtualization platform directly references the disks in the shared storage pool, achieving cross-platform sharing of storage resources and avoiding data copying. Furthermore, it automatically converts configuration files and virtual machine hardware devices, ensuring cross-platform migration compatibility. Combined with the shared storage pool and the automatic conversion of configuration files and virtual machine hardware devices, the target virtual machine can be quickly started on the second virtualization platform, ensuring business continuity and migration efficiency. Moreover, no snapshots are needed during the virtual machine migration process, avoiding the impact of snapshots on virtual machine performance. Thus, while ensuring virtual machine performance, the efficiency of cross-platform virtual machine migration is improved.
[0067] Further, see Figure 2 As shown, Figure 2 This diagram illustrates a virtual machine migration method provided by an embodiment of the present invention. The present invention provides a cross-platform online virtual machine migration solution, enabling online migration of virtual machines between VMware and KVM platforms. It achieves efficient migration of heterogeneous virtualization platforms through shared storage based on the NFS protocol and dynamic metadata conversion. An NFS shared storage pool is used as the intermediate storage medium for the cross-platform cloud platform, and is mounted on hosts of different platforms using the NFS protocol, achieving cross-platform sharing of storage resources and avoiding the data copying step in traditional migration processes. A real-time metadata conversion engine ensures cross-platform virtual device compatibility. It adopts a memory-resident design, dynamically parsing VMware virtual machine configurations (including CPU topology, memory allocation, and device parameters) and generating libvirt XML virtual machine configuration files conforming to the KVM specification in real time. It supports automatic conversion of various hardware devices such as VMXNET3 network cards to virtio-net and LSI Logic controllers to virtio-scsi. During the migration process, the consistency of virtual machine disk data across platforms is maintained through a storage mapping mechanism. The VMDK virtual disk file is kept as a single copy on NFS shared storage, and virtual machines on the KVM platform are directly mounted and used. At the same time, the conversion from VMDK to QCOW2 format is completed through a background asynchronous thread.
[0068] In the shared storage layer, a shared storage pool of NFS protocol is deployed, and multi-path IO (MPIO) is configured to improve reliability; the shared directory is mounted on VMware ESXi and KVM Hypervisor respectively, and the permission is set to read and write intercommunication. A metadata conversion engine, a lightweight conversion service, is provided to analyze VMware virtual machine configuration (.vmx file) in real time, dynamically generate libvirt XML, automatically convert VMware virtual hardware device into KVM compatible device, and support user-defined adaptation rules.
[0069] In the pre-migration preparation stage, for Windows virtual machine, Virtio driver needs to be injected in advance in VMware virtual machine through VMTools to avoid blue screen of virtual machine after migration. VMware virtual machine disk is actively online migrated from VMware's own local storage pool to NFS shared storage pool (vmkfstools -i source.vmdk / nfs / target.vmdk). In the online migration stage, the metadata conversion service is started to generate KVM compatible virtual machine XML configuration file; the virtual machine is registered through virsh define command, and the shared VMDK file is mounted (the <disk type="network" protocol="nfs">). In the switching and ending stage, the VMware virtual machine is safely closed, and after the data of the VMware virtual machine is completely written to a disk, the KVM virtual machine is started, and the background calls qemu-img convert -O qcow2 / nfs / target.vmdk / local / qcow2 / disk.qcow2 to complete the hot conversion of the disk format from vmdk to qcow2.
[0070] In addition, an exception handling mechanism is provided, including a rollback design and log tracking: the rollback design: if the KVM virtual machine fails to start, the VMware virtual machine is directly started, so that the business interruption time is minimized. The log tracking: the rule matching log of the conversion engine is recorded, so that fault positioning is facilitated.
[0071] In the embodiment of the application, the NFS protocol is used to build a cross-platform shared storage pool, so that the path-level mapping of the VMware VMDK and the KVM disk file is realized. Compared with the traditional storage migration scheme (which requires full data copying for the first time), the present scheme only needs to keep a single copy of the disk file on the NFS storage pool, and the KVM directly mounts the original VMDK during migration, thereby saving a large amount of storage transmission time and reducing the business impact and data inconsistency of the virtual machine. The lightweight real-time metadata conversion engine analyzes the VMware virtual machine configuration (the.vmx file) in real time, dynamically generates libvirt XML, automatically converts the VMware virtual hardware device into a KVM compatible device, and supports user-defined adaptation rules. The metadata conversion engine ensures the automatic compatibility of the virtual machine configuration and reduces manual intervention during migration.
[0072] In terms of cross-platform compatibility, seamless migration of the VMware and KVM heterogeneous virtualization platform is realized, the migration success rate is greatly improved, and the dynamic device conversion engine supports automatic compatible conversion and adaptation of the virtual hardware device. In terms of business continuity, the NFS storage mapping is used to realize the second-level switching of the VMware virtual machine to the KVM virtual machine, the virtual machine business interruption time can be controlled within 1 minute, and the real-time metadata conversion engine ensures the automatic synchronization of the configuration of the VMware virtual machine to the KVM virtual machine. In terms of performance, the migration time is shortened from several hours in the traditional scheme to minutes, the present application avoids the impact of snapshotting on the performance of the virtual machine, and no snapshot is needed for the virtual machine during the entire migration and conversion process, thereby guaranteeing the business performance of the virtual machine. In terms of technical expansibility, the modular design supports extension to Hyper-V / Xen platform migration, and the hot conversion mechanism can be adapted to future new disk formats.
[0073] Referring to Figure 3 illustrated, Figure 3 This is a schematic diagram of a virtual machine migration device provided in an embodiment of the present invention. The virtual machine migration device includes:
[0074] The disk migration module 31 is used to migrate the disk of the virtual machine to be migrated from the local storage pool of the virtual machine to the shared storage pool, wherein the virtual machine to be migrated is a virtual machine on the first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and the second virtualization platform.
[0075] Configuration conversion module 32 is used to convert the configuration file of the virtual machine to be migrated into a configuration file compatible with the second virtualization platform to obtain the target configuration file;
[0076] Device conversion module 33 is used to convert the virtual hardware device of the virtual machine to be migrated into a target virtual hardware device compatible with the second virtualization platform;
[0077] The virtual machine startup module 34 is used to register the target virtual machine on the second virtualization platform based on the target configuration file, and to start the target virtual machine based on the target virtual hardware device and the disk migrated to the shared storage pool.
[0078] The device further includes: a driver injection module, used to obtain the operating system information of the virtual machine to be migrated before migrating the disk of the virtual machine to be migrated from the local storage pool of the virtual machine to the shared storage pool; and if the target operating system is determined based on the operating system information, injecting an input / output paravirtualization driver into the virtual machine to be migrated so as to start the target virtual machine based on the input / output paravirtualization driver.
[0079] The device further includes a shared storage pool mounting module, used to mount the shared storage pool on the hosts corresponding to the first virtualization platform and the second virtualization platform respectively before migrating the disk of the virtual machine to be migrated from the local storage pool of the virtual machine to the shared storage pool.
[0080] The device conversion module 33 can be specifically used to convert the virtual hardware device of the virtual machine to be migrated into a target virtual hardware device compatible with the second virtualization platform based on a preset mapping rule.
[0081] The apparatus further includes a disk format conversion module, used to convert the disk migrated to the shared storage pool into a target format after the target virtual machine is started based on the target virtual hardware device and the disk migrated to the shared storage pool.
[0082] The device further comprises an exception processing module configured to start the to-be-migrated virtual machine to provide services through the to-be-migrated virtual machine if the target virtual machine fails to start.
[0083] In an optional embodiment, the configuration conversion module 32 and the device conversion module 33 can specifically convert the configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform through a preset conversion engine to obtain a target configuration file, and convert the virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform.
[0084] Correspondingly, the device further comprises a log recording module configured to record logs of the preset conversion engine to analyze problems based on the logs.
[0085] It can be seen that the embodiment of the present application first migrates the disk of the virtual machine on the first virtualization platform to the shared storage pool, and the target virtual machine on the second virtualization platform directly references the disk in the shared storage pool, thereby realizing cross-platform sharing of storage resources, avoiding the data copying link, and automatically converting the configuration file and the virtual machine hardware device to guarantee the compatibility of cross-platform migration. In combination with the shared storage pool and the automatic conversion of the configuration file and the virtual machine hardware device, the target virtual machine can be quickly started on the second virtualization platform, thereby guaranteeing the business continuity and the migration efficiency. Moreover, during the virtual machine migration process, there is no need to take snapshots, thereby avoiding the impact of taking snapshots on the performance of the virtual machine. In this way, the efficiency of cross-platform migration of the virtual machine is improved while guaranteeing the performance of the virtual machine.
[0086] Figure 3 The features of the corresponding embodiments can be seen from the above description of the Figure 1 The related description of the corresponding embodiments will not be repeated here.
[0087] Figure 4 A structural diagram of an electronic device provided by the embodiment of the present application is shown in Figure 4 The electronic device comprises a memory 40 configured to store a computer program.
[0088] A processor 41 configured to execute the computer program to implement the steps of the virtual machine migration method of the above-described embodiments.
[0089] The electronic device provided by the embodiment of the present application can include but is not limited to a smart phone, a tablet computer, a notebook computer or a desktop computer, a server, etc.
[0090] The processor 41 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 41 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 41 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 41 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 41 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.
[0091] The memory 40 may include one or more computer-readable storage media, which may be non-transitory. The memory 40 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 40 is used to store at least the following computer program 401, which, after being loaded and executed by the processor 41, is capable of implementing the relevant steps of the virtual machine migration method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 40 may also include an operating system 402 and data 403, and the storage method may be temporary or permanent storage. The operating system 402 may include Windows, Unix, Linux, etc. The data 403 may include, but is not limited to, configuration files.
[0092] In some embodiments, the electronic device may further include a display screen 42, an input / output interface 43, a communication interface 44, a power supply 45, and a communication bus 46.
[0093] Those skilled in the art will understand that Figure 4 The structures shown do not constitute a limitation on electronic devices and may include more or fewer components than those shown.
[0094] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: migrating a disk of a to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, wherein the to-be-migrated virtual machine is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform; converting a configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file; converting a virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform; registering a target virtual machine based on the target configuration file on the second virtualization platform, and starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool.
[0095] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: before migrating a disk of a to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, further comprising: obtaining operating system information of the to-be-migrated virtual machine; in a case where it is determined based on the operating system information that a target operating system, injecting an input-output semi-virtualization driver into the to-be-migrated virtual machine, so as to start the target virtual machine based on the input-output semi-virtualization driver.
[0096] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: before migrating a disk of a to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, further comprising: mounting the shared storage pool on a host corresponding to the first virtualization platform and a host corresponding to the second virtualization platform, respectively.
[0097] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: the converting of the virtual hardware device of the to-be-migrated virtual machine into the target virtual hardware device compatible with the second virtualization platform comprises: converting the virtual hardware device of the to-be-migrated virtual machine into the target virtual hardware device compatible with the second virtualization platform based on a preset mapping rule.
[0098] In this embodiment, when the processor executes the computer program stored in the memory, the following steps can be specifically implemented: after starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool, further comprising: converting the disk into a target format.
[0099] In the embodiment, the processor, when executing the computer program stored in the memory, can implement the following steps: if the target virtual machine fails to start, starting the to-be-migrated virtual machine to provide services through the to-be-migrated virtual machine.
[0100] In the embodiment, the processor, when executing the computer program stored in the memory, can implement the following steps: converting, by a preset conversion engine, a configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file, and converting a virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform. Logging the preset conversion engine to facilitate analysis of problems based on the log.
[0101] It can be understood that if the virtual machine migration method in the above embodiment is implemented in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and performs all or part of the steps of the method of each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), an electrically erasable programmable ROM, a register, a hard disk, a removable magnetic disk, a CD-ROM, a magnetic disk or an optical disk, and various media that can store program codes.
[0102] Based on this, the embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the steps of the virtual machine migration method.
[0103] In the embodiment, the computer program executed by the processor can implement the following steps: migrating a disk of the to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, wherein the to-be-migrated virtual machine is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform; converting a configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file; converting a virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform; registering a target virtual machine based on the target configuration file on the second virtualization platform, and starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool.
[0104] In the embodiment, the computer program executed by the processor can specifically implement the following steps: obtaining operating system information of the to-be-migrated virtual machine before migrating a disk of the to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool; in a case where it is determined that the target operating system based on the operating system information, injecting an input-output semi-virtualization driver into the to-be-migrated virtual machine, so as to start the target virtual machine based on the input-output semi-virtualization driver.
[0105] In the embodiment, the computer program executed by the processor can specifically implement the following steps: before migrating a disk of the to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, respectively mounting the shared storage pool on a host corresponding to the first virtualization platform and a host corresponding to the second virtualization platform.
[0106] In the embodiment, the computer program executed by the processor can specifically implement the following steps: converting the virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform based on a preset mapping rule.
[0107] In the embodiment, the computer program executed by the processor can specifically implement the following steps: after starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool, converting the disk into a target format.
[0108] In the embodiment, the computer program executed by the processor can specifically implement the following steps: if the target virtual machine fails to start, starting the to-be-migrated virtual machine to provide a service through the to-be-migrated virtual machine.
[0109] In the embodiment, the computer program executed by the processor can specifically implement the following steps: converting, through a preset conversion engine, a configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file, and converting a virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform; and recording a log of the preset conversion engine, so as to analyze a problem based on the log.
[0110] Further, the embodiment of the present application also provides a computer program product, comprising computer programs / instructions, which are executed by a processor to implement the steps of the virtual machine migration method.
[0111] The above describes in detail a virtual machine migration method, device, equipment and medium provided by the embodiment of the present application. The embodiments in the specification are described in a progressive manner, and each embodiment mainly describes the difference from other embodiments. The same or similar parts of each embodiment can be understood by referring to each other. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be understood by referring to the method part.
[0112] Those skilled in the art will further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been described in general terms in the above description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0113] The above describes in detail a virtual machine migration method, device, equipment and medium provided by the embodiment of the present application. The embodiments in the specification are described in a progressive manner, and each embodiment mainly describes the difference from other embodiments. The same or similar parts of each embodiment can be understood by referring to each other. For the device disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be understood by referring to the method part.< / disk>
Claims
1. A virtual machine migration method characterized by comprising: The method comprises: migrating a disk of a to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, wherein the to-be-migrated virtual machine is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform; converting a configuration file of the to-be-migrated virtual machine into a configuration file compatible with the second virtualization platform to obtain a target configuration file; converting a virtual hardware device of the to-be-migrated virtual machine into a target virtual hardware device compatible with the second virtualization platform; registering a target virtual machine based on the target configuration file on the second virtualization platform, and starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool.
2. The virtual machine migration method according to claim 1, wherein, Before migrating the disk of the to-be-migrated virtual machine from the local storage pool of the to-be-migrated virtual machine to the shared storage pool, the method further comprises: obtaining operating system information of the to-be-migrated virtual machine; in a case where it is determined that the target operating system based on the operating system information, injecting an input-output semi-virtualization driver into the to-be-migrated virtual machine, so as to start the target virtual machine based on the input-output semi-virtualization driver.
3. The virtual machine migration method of claim 1, wherein, Before migrating the disk of the to-be-migrated virtual machine from the local storage pool of the to-be-migrated virtual machine to the shared storage pool, the method further comprises: mounting the shared storage pool on a host corresponding to the first virtualization platform and the second virtualization platform respectively.
4. The virtual machine migration method of claim 1, wherein, The converting of the virtual hardware device of the to-be-migrated virtual machine into the target virtual hardware device compatible with the second virtualization platform comprises: converting the virtual hardware device of the to-be-migrated virtual machine into the target virtual hardware device compatible with the second virtualization platform based on a preset mapping rule.
5. The virtual machine migration method of claim 1, wherein, After starting the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool, the method further comprises: converting the disk into a target format.
6. The virtual machine migration method of claim 1, wherein, The method further comprises: if the target virtual machine fails to start, starting the to-be-migrated virtual machine to provide a service through the to-be-migrated virtual machine.
7. The virtual machine migration method according to any one of claims 1 to 6, characterized by, The converting of the configuration file of the to-be-migrated virtual machine into the configuration file compatible with the second virtualization platform to obtain the target configuration file; The converting of the virtual hardware device of the to-be-migrated virtual machine into the target virtual hardware device compatible with the second virtualization platform comprises: converting, by a preset conversion engine, the configuration file of the to-be-migrated virtual machine into the configuration file compatible with the second virtualization platform to obtain the target configuration file, and converting the virtual hardware device of the to-be-migrated virtual machine into the target virtual hardware device compatible with the second virtualization platform; Correspondingly, the method further comprises: recording a log of the preset conversion engine, so as to analyze a problem based on the log.
8. A virtual machine migration apparatus characterized by comprising: The method comprises: a disk migration module configured to migrate a disk of a to-be-migrated virtual machine from a local storage pool of the to-be-migrated virtual machine to a shared storage pool, wherein the to-be-migrated virtual machine is a virtual machine on a first virtualization platform, and the shared storage pool is a storage pool shared by the first virtualization platform and a second virtualization platform; a configuration conversion module, configured to convert a configuration file of the virtual machine to be migrated into a configuration file compatible with the second virtualization platform to obtain a target configuration file; a device conversion module, configured to convert a virtual hardware device of the virtual machine to be migrated into a target virtual hardware device compatible with the second virtualization platform; a virtual machine starting module, configured to register a target virtual machine based on the target configuration file on the second virtualization platform, and start the target virtual machine based on the target virtual hardware device and the disk migrated into the shared storage pool.
9. An electronic device, comprising: comprising: a memory, configured to store a computer program; a processor, configured to execute the computer program to implement steps of the virtual machine migration method according to any one of claims 1 to 7.
10. A computer readable storage medium characterized by, The computer readable storage medium has a computer program stored thereon, and the computer program is executed by the processor to implement steps of the virtual machine migration method according to any one of claims 1 to 7.