Virtual machine migration method, device, electronic device and storage medium

By creating a second virtual machine on the target host and configuring a disk environment, synchronizing the data of the first virtual machine to the second disk environment, the problem of unstable resource occupation when concurrent virtual machine migration tasks in the prior art is solved, and high concurrency of virtual machine migration tasks is achieved.

CN113918269BActive Publication Date: 2025-04-29CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010648453.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-07
Publication Date
2025-04-29
Estimated Expiration
2040-07-07

AI Technical Summary

Technical Problem

When migrating virtual machines, the existing technology occupies physical resources and network resources of the target device, resulting in the continuous change of resource occupancy when multiple virtual machine migration tasks are concurrent, which may cause overload of the target host and affect the progress of the migration task.

Method used

By generating instructions on the source host, sending these instructions to the target host, the target host creates a second virtual machine based on the set image, and configures the disk environment through the second virtual machine, synchronizes the data of the first virtual machine to the second disk environment to create a third virtual machine.

Benefits of technology

It is realized that the second virtual machine is created on the target host, the disk environment is configured through the second virtual machine, and the data of the first virtual machine is synchronized to the second disk environment, solving the problem of unstable resource occupancy when multiple virtual machine migration tasks are concurrent, and achieving high concurrency of virtual machine migration tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113918269B_ABST
    Figure CN113918269B_ABST
Patent Text Reader

Abstract

The present invention is applicable to the field of computer technology, and provides a virtual machine migration method, device, electronic device and storage medium, wherein the virtual machine migration method includes: generating a first instruction according to the disk information of the first virtual machine on the source host; sending the first instruction to the destination host, so that the destination host creates a second virtual machine in the first disk environment based on the set first image according to the first instruction, and runs the second virtual machine to configure the corresponding second disk environment based on the disk information through the first service; the virtual machine created based on the first image automatically starts the first service when running; the first service is used to configure the disk environment; based on the communication with the second virtual machine, the data of the first virtual machine is synchronized to the second disk environment, so that the destination host creates a third virtual machine in the second disk environment. The present invention can achieve high concurrency of virtual machine migration tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a virtual machine migration method, device, electronic device and storage medium. Background Art

[0002] Virtual machine migration refers to migrating the virtual machine on the source device to the target device. When the current related technologies are performing virtual machine migration, the migration process of the virtual machine will occupy the physical resources and network resources of the target device. When multiple virtual machine migration tasks are concurrent, since multiple virtual machine migration tasks occupy the resources of the same target device, the resource ratio occupied by each virtual machine migration task changes all the time. When a virtual machine migration task is abnormal, it may occupy too many resources of the target device, making the target host unable to carry additional virtual machine migration tasks. It will also cause the target device to be overloaded, affecting the progress of all virtual machine migration tasks. Summary of the invention

[0003] In order to solve the above problems, embodiments of the present invention provide a virtual machine migration method, device, electronic device and storage medium, so as to at least solve the problem that the related technology cannot support multiple virtual machine migration tasks concurrently.

[0004] The technical solution of the present invention is achieved in this way:

[0005] In a first aspect, an embodiment of the present invention provides a virtual machine migration method, which is applied to a source host, and the method includes:

[0006] Generate a first instruction according to disk information of a first virtual machine on a source host;

[0007] Sending the first instruction to the destination host, so that the destination host creates a second virtual machine in the first disk environment based on the set first image according to the first instruction, and runs the second virtual machine, so as to configure the corresponding second disk environment based on the disk information through the first service; the virtual machine created based on the first image automatically starts the first service when running; the first service is used to configure the disk environment;

[0008] Based on the communication with the second virtual machine, the data of the first virtual machine is synchronized to the second disk environment, so that the destination host creates a third virtual machine in the second disk environment.

[0009] In the above solution, the step of generating the first instruction according to the disk information of the first virtual machine on the source host includes:

[0010] Sending a second instruction to the destination host, so that the destination host verifies whether the destination host has the conditions to run the first virtual machine based on the disk information according to the second instruction; the second instruction carries the disk information;

[0011] A verification result of the destination host is received, and if the verification result indicates that the destination host is capable of running the first virtual machine, the first instruction is generated according to the disk information.

[0012] In the above scheme, the method further comprises:

[0013] A third instruction is sent to the destination host, so that the destination host uninstalls the second virtual machine after data synchronization of the first virtual machine is completed according to the third instruction.

[0014] In a second aspect, an embodiment of the present invention provides a virtual machine migration method, which is applied to a target host, and the method includes:

[0015] Receiving a first instruction sent by at least one source host; the first instruction is generated and sent by the corresponding source host according to the disk information of the first virtual machine on the source host;

[0016] For each of the first instructions sent by the at least one source host, the method further includes:

[0017] Creating a second virtual machine in the first disk environment based on the set first image; automatically starting a first service when the virtual machine created based on the first image is running; the first service is used to configure the disk environment;

[0018] Running the second virtual machine to configure a corresponding second disk environment based on the corresponding disk information through the first service;

[0019] After the corresponding source host synchronizes the data of the corresponding first virtual machine to the corresponding second disk environment based on communication with the corresponding second virtual machine, the corresponding third virtual machine is created in the corresponding second disk environment.

[0020] In the above scheme, the method further comprises:

[0021] Receive a second instruction sent by at least one source host; the second instruction carries disk information of a first virtual machine on the corresponding source host;

[0022] For each of the second instructions sent by the at least one source host, the method further includes:

[0023] Verifying whether the destination host has the conditions for running the corresponding first virtual machine based on the corresponding disk information, and obtaining a verification result;

[0024] The verification result is sent to a corresponding source host, so that the corresponding source host generates a first instruction according to the disk information when the verification result indicates that the destination host has the conditions for running the corresponding first virtual machine.

[0025] In the above scheme, the method further comprises:

[0026] receiving a third instruction sent by at least one source host;

[0027] After the source host that sends the third instruction completes synchronization of the data of the corresponding first virtual machine to the corresponding second virtual machine, the corresponding second virtual machine is deleted.

[0028] In a third aspect, an embodiment of the present invention provides a virtual machine migration device, the device comprising:

[0029] A generating module, used to generate a first instruction according to the disk information of the first virtual machine on the source host;

[0030] A sending module, used for sending a first instruction to a destination host, so that the destination host creates a second virtual machine in a first disk environment based on a set first image according to the first instruction, and runs the second virtual machine, so as to configure the corresponding second disk environment based on the disk information through a first service; the virtual machine created based on the first image automatically starts the first service when running; the first service is used to configure the disk environment;

[0031] A synchronization module is used to synchronize the data of the first virtual machine to the second disk environment based on communication with the second virtual machine, so that the destination host creates a third virtual machine in the second disk environment.

[0032] In a fourth aspect, an embodiment of the present invention provides a virtual machine migration device, the device comprising:

[0033] A receiving module, configured to receive a second instruction sent by at least one source host; the second instruction carries disk information of a first virtual machine on the corresponding source host;

[0034] For each of the first instructions sent by the at least one source host, the apparatus further comprises:

[0035] A first creation module is used to create a second virtual machine in a first disk environment based on a set first image; the virtual machine created based on the first image automatically starts a first service when running; the first service is used to configure the disk environment;

[0036] a configuration module, configured to run the second virtual machine to configure a corresponding second disk environment based on the corresponding disk information through the first service;

[0037] The second creation module is used to create a corresponding third virtual machine in the corresponding second disk environment after the corresponding source host synchronizes the data of the corresponding first virtual machine to the corresponding second disk environment based on communication with the corresponding second virtual machine.

[0038] In a fifth aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the steps of the virtual machine migration method provided in the first aspect or the second aspect of the embodiment of the present invention.

[0039] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, including: the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the virtual machine migration method provided in the first aspect or the second aspect of the embodiment of the present invention are implemented.

[0040] The embodiment of the present invention generates a first instruction according to the disk information of the first virtual machine on the source host; sends the first instruction to the destination host, so that the destination host creates a second virtual machine in the first disk environment based on the set first image according to the first instruction, and runs the second virtual machine, so as to configure the corresponding second disk environment based on the disk information through the first service; the virtual machine created based on the first image automatically starts the first service when running; based on the communication with the second virtual machine, the data of the first virtual machine is synchronized to the second disk environment, so that the destination host creates a third virtual machine in the second disk environment. The embodiment of the present invention creates a second virtual machine on the target host, configures the corresponding second disk environment through the second virtual machine, and synchronizes the data of the first virtual machine to the second disk environment based on the communication with the second virtual machine. When the embodiment of the present invention processes multiple virtual machine migration tasks at the same time, each second virtual machine will not affect each other, each virtual machine migration task occupies the resources of the corresponding second virtual machine, will not be affected by other virtual machine migration tasks, and will not affect other virtual machine migration tasks, so that high concurrency of virtual machine migration tasks can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a schematic diagram of an implementation flow of a virtual machine migration method provided by an embodiment of the present invention;

[0042] Figure 2 It is a schematic diagram of the implementation process of another virtual machine migration method provided by an embodiment of the present invention;

[0043] Figure 3 It is a schematic diagram of the implementation process of another virtual machine migration method provided by an embodiment of the present invention;

[0044] Figure 4 It is a schematic diagram of the implementation process of another virtual machine migration method provided by an embodiment of the present invention;

[0045] Figure 5 It is a schematic diagram of a framework of a virtual machine migration service provided by an application embodiment of the present invention;

[0046] Figure 6 It is a structural diagram of a virtual machine migration system provided by an application embodiment of the present invention;

[0047] Figure 7 It is a functional architecture diagram of a virtual machine migration service provided by an application embodiment of the present invention;

[0048] Figure 8 It is a flow chart of a virtual machine migration method provided by an application embodiment of the present invention;

[0049] Fig. 9 is a schematic diagram of a virtual machine migration device provided by an embodiment of the present invention;

[0050] Fig.10 is a schematic diagram of a virtual machine migration device provided by an embodiment of the present invention;

[0051] Fig.11 It is a schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0053] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0054] It should be noted that the technical solutions described in the embodiments of the present invention can be arbitrarily combined without conflict.

[0055] In addition, in the embodiments of the present invention, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0056] A virtual machine is a complete computer system that is simulated by software and has complete hardware system functions and runs in a completely isolated environment. All tasks that can be completed in a physical computer can be completed in a virtual machine. When creating a virtual machine in a computer, part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine.

[0057] Virtual machine migration refers to migrating a virtual machine from one electronic device to another electronic device, for example, migrating a virtual machine on a physical machine to another physical machine, or migrating a virtual machine on a physical machine to a cloud server. At present, there are many methods for virtual machine migration, such as cold migration and hot migration. Cold migration refers to migration when the virtual machine is turned off, while hot migration requires that the virtual machine is always running. Regardless of the migration method, the physical resources and network resources of the target host need to be occupied during the migration process. When multiple virtual machine migration tasks are concurrent, since multiple virtual machine migration tasks occupy the resources of the same target host, the resource ratio occupied by each migration task changes all the time during the virtual machine migration process, and an abnormal virtual machine migration task will affect the normal operation of other virtual machine migration tasks. For example, when a migration task abnormally occupies 99% of the memory or 99% of the bandwidth of the target host, other migration tasks will be suspended. This will also cause the resources of the target host to be quickly occupied, making the target host unable to carry additional virtual machine migration tasks. Therefore, the relevant technology cannot support multiple virtual machine migration tasks concurrently.

[0058] In view of the shortcomings of the above-mentioned related technologies, an embodiment of the present invention provides a virtual machine migration method, which can support multiple virtual machine migration tasks concurrently, and the multiple virtual machine migration tasks do not affect each other. In order to illustrate the technical solution of the present invention, a specific embodiment is used for description below.

[0059] Figure 1 1 is a schematic diagram of a virtual machine migration method according to an embodiment of the present invention. The method is performed by a source host, which includes a computer, a tablet, a server, etc. Figure 1 As shown, the virtual machine migration method includes:

[0060] S101, generating a first instruction according to disk information of a first virtual machine on a source host.

[0061] Before performing virtual machine migration, you need to detect the network status between the source host and the target host to ensure network connectivity. Communication between the source host and the target host is a necessary condition for virtual machines to migrate from the source host to the target host.

[0062] Before performing a virtual machine migration, you need to perform a virtual machine migration feasibility check. Figure 2 In one embodiment, generating the first instruction according to the disk information of the first virtual machine on the source host includes:

[0063] S201, sending a second instruction to the destination host, so that the destination host verifies whether the destination host has the conditions to run the first virtual machine based on the disk information according to the second instruction; the second instruction carries the disk information.

[0064] The source host collects disk information of the first virtual machine. In actual applications, the disk information of the first virtual machine includes: operating system version, firmware type, file system type, disk partition information and other information.

[0065] The source host sends a second instruction to the destination host, the second instruction carrying the disk information of the first virtual machine, and the second instruction is used to control the destination host to verify whether the destination host has the hardware conditions for running the first virtual machine based on the disk information of the first virtual machine.

[0066] For example, the verification includes: determining whether the disk specification of the target host is greater than the disk specification of the first virtual machine, determining whether the central processing unit (CPU) and memory of the target host can run the first virtual machine, and the like.

[0067] After obtaining the verification result, the target host feeds back the verification result to the source host. The verification result includes: the target host has the hardware conditions for running the first virtual machine, and the target host does not have the hardware conditions for running the first virtual machine.

[0068] S202: Receive a verification result of the destination host, and generate the first instruction according to the disk information when the verification result indicates that the destination host is capable of running the first virtual machine.

[0069] The source host receives the verification result sent by the target host, and generates a first instruction according to the disk information of the first virtual machine if the verification result indicates that the target host has the hardware conditions for running the first virtual machine.

[0070] S102, sending the first instruction to the destination host, so that the destination host creates a second virtual machine in the first disk environment based on the set first image according to the first instruction, and runs the second virtual machine, so as to configure the corresponding second disk environment based on the disk information through the first service; the virtual machine created based on the first image automatically starts the first service at runtime; the first service is used to configure the disk environment.

[0071] The source host sends a first instruction to the target host. After the target host obtains the first instruction, it creates a second virtual machine in the first disk environment based on the set first image. The disk environment includes: the number of disks, the size of the disk, the type of disk partitions, the type of disk file system, etc. The first disk environment is the disk environment created by the target host for the second virtual machine. A part of the hardware resources of the target host is allocated to the second virtual machine. For example, 50G capacity is allocated from the hard disk of the target host to the second virtual machine. This 50G capacity is used to create a separate disk. The disk is partitioned, formatted, the file system type is set, and mounted, etc., so as to form the first disk environment.

[0072] In actual applications, the second virtual machine can be created by calling the application programming interface (API) of openstack (cloud computing management platform). When calling this API interface, the target host will specify the set first image and create the second virtual machine through the set first image.

[0073] In actual applications, the first image set can be a Community Enterprise Operating System (CentOS) image. CentOS is an operating system based on Linux, but Linux is a kernel system with only a terminal command interface and no graphical interface. CentOS has both a terminal command interface and a graphical interface, and having a graphical interface can facilitate user operation.

[0074] In the embodiment of the present invention, the task performed by the second virtual machine is relatively simple, so the second virtual machine does not need a high-specification hardware configuration. For example, 1 core CPU and 1G memory are allocated to the second virtual machine. In addition, disk and bandwidth need to be allocated to the second virtual machine. In actual applications, the cloud server can simultaneously create thousands or tens of thousands of such second virtual machines with hardware rules. Therefore, the cloud server can perform multiple virtual machine migration tasks with high concurrency.

[0075] After the second virtual machine is created, the second virtual machine is run, and the second virtual machine automatically starts the first service when running. The first service is used to configure the corresponding second disk environment based on the disk information of the first virtual machine.

[0076] Here, the second disk environment is the disk environment where the first virtual machine is located after migrating to the target host. The first virtual machine becomes the third virtual machine after migrating to the target host. To create the third virtual machine, the second disk environment is the disk environment corresponding to the third virtual machine.

[0077] The related art configures the second disk environment through the target host, while the embodiment of the present invention configures the second disk environment based on the disk information through the second virtual machine.

[0078] The first service configures the corresponding second disk environment based on the disk information of the first virtual machine. The second disk environment needs to be the same as some disk environments of the first virtual machine. If some disk information of the third virtual machine is inconsistent with that of the first virtual machine, the third virtual machine will not be able to start normally on the target host, and even the data cannot be synchronized to the second disk environment. For example, the disk partition format of the third virtual machine must be the same as that of the first virtual machine. The disk information of the third virtual machine does not have to be exactly the same as that of the first virtual machine. Except for some disk information that must be the same, other disk information can be improved according to actual conditions. For example, the disk capacity can be expanded or reduced.

[0079] The first service configuration second disk environment mainly includes the following aspects:

[0080] 1. Disk creation: A portion of the disk capacity of the target host disk is used to create the disk of the third virtual machine, or a portion of the disk capacity of the second virtual machine disk is used to create the disk of the third virtual machine.

[0081] 2. Disk partitioning. Complete the disk partitioning according to the disk partition type, disk name, number of disk partitions, and capacity of each disk partition of the first virtual machine. The disk partition information of the third virtual machine does not have to be completely consistent with the disk partition information of the first disk. For example, the disk capacity can be expanded or reduced, and the disk name can be renamed.

[0082] 3. Disk formatting: Format the disk of the third virtual machine according to the file system types corresponding to the partitions of the disk of the first virtual machine, so that the file system type of the disk of the third virtual machine is consistent with the file system type of the disk of the first virtual machine.

[0083] 4. Mount the disk. Mount the disk of the third virtual machine on the second virtual machine. The purpose of this step is to synchronize the data of the first virtual machine to the disk of the third virtual machine. Therefore, data can be written to the disk only after the disk is mounted. Mounting it on the second virtual machine does not occupy the resources of the target host and does not affect the performance of the target host.

[0084] 5. Other disk configurations. For example, installing Bootloader, modifying Grub configuration files, modifying Fstab configuration files, etc. Bootloader is a small program that is executed before the operating system runs. Through this small program, we can initialize hardware devices and establish a mapping table of memory space, thereby establishing an appropriate system hardware and software environment to prepare for the final call to the operating system kernel. Grub is a boot loader. Grub is an implementation of the multi-boot specification. It allows users to have multiple operating systems in the computer at the same time and select the operating system they want to run when the computer starts. Grub can be used to select different kernels on the operating system partition, and can also be used to pass startup parameters to these kernels. Fstab is a file used to store static information of the file system. When the system starts, the system will automatically read information from this file and automatically mount the file system specified in this file to the specified directory.

[0085] In the embodiment of the present invention, one second virtual machine is configured with one second disk environment. That is, the configuration of the second disk environment is only affected by the second virtual machine, and other virtual machine migration tasks on the target host will not affect the configuration of the second disk environment.

[0086] S103: Based on the communication with the second virtual machine, synchronize the data of the first virtual machine to the second disk environment, so that the destination host creates a third virtual machine in the second disk environment.

[0087] In the embodiment of the present invention, the source host sends the data of the first virtual machine to the target host based on the communication with the second virtual machine, and the target host synchronizes the data of the first virtual machine to the second disk environment through the second virtual machine.

[0088] Here, the source host can use a variety of data synchronization methods to synchronize the data of the first virtual machine to the second disk environment, such as full synchronization and incremental synchronization. In actual applications, the source host can first generate an image of the first virtual machine, send the image to the second virtual machine, and the second virtual machine stores the image in the second disk environment. Alternatively, after the source host synchronizes all the data of the first virtual machine to the second disk environment, the second virtual machine generates an image of the first virtual machine based on the data in the second disk environment.

[0089] The data of the first virtual machine is synchronized to the second disk environment through the second virtual machine, so that the data synchronization process will only be affected by the hardware resources and network resources of the second virtual machine, and other virtual machine migration tasks on the target host will not affect the data synchronization of the first virtual machine. In addition, as an independent virtual computer, the hardware resources and network resources of the second virtual machine will not be affected by other virtual machines in the target host. Therefore, the data synchronization process of the first virtual machine can occupy all the resources of the second virtual machine, the data synchronization speed is fast, and it will not be affected by other virtual machine migration tasks, nor will it affect other virtual machine migration tasks.

[0090] In actual applications, an exclude-from file is created in the source host. The exclude-from file is used to exclude mappings in the memory file system during data synchronization.

[0091] After synchronizing the data of the first virtual machine to the second disk environment, the target host completes the boot and other settings, and the third virtual machine can be run normally on the target host. At this point, the migration of the first virtual machine is completed.

[0092] The embodiment of the present invention generates a first instruction according to the disk information of the first virtual machine on the source host; sends the first instruction to the destination host, so that the destination host creates a second virtual machine in the first disk environment based on the set first image according to the first instruction, and runs the second virtual machine, so as to configure the corresponding second disk environment based on the disk information through the first service; the virtual machine created based on the first image automatically starts the first service when running; based on the communication with the second virtual machine, the data of the first virtual machine is synchronized to the second disk environment, so that the destination host creates a third virtual machine in the second disk environment. The embodiment of the present invention creates a second virtual machine on the target host, configures the corresponding second disk environment through the second virtual machine, and synchronizes the data of the first virtual machine to the second disk environment based on the communication of the second virtual machine. When processing multiple virtual machine migration tasks at the same time, each second virtual machine will not affect each other, each virtual machine migration task occupies the resources of the corresponding second virtual machine, will not be affected by other virtual machine migration tasks, and will not affect other virtual machine migration tasks, so that high concurrency of virtual machine migration tasks can be achieved.

[0093] Furthermore, in one embodiment, the virtual machine migration method further includes:

[0094] The source host sends a third instruction to the destination host, so that the destination host uninstalls the second virtual machine after data synchronization of the first virtual machine is completed according to the third instruction.

[0095] After the data of the first virtual machine is synchronized to the second disk environment, the task of the second virtual machine is completed. At this time, you can choose to delete the second virtual machine to reduce the load of the target host and release the resources of the target host. Deleting the second virtual machine includes: deleting the disk data of the second virtual machine in the target host and returning the hardware resources and network resources of the second virtual machine to the target host.

[0096] refer to Figure 3 , which shows a flow chart of another virtual machine migration method provided by an embodiment of the present invention, the method is performed by a target host, and the target host includes: a computer, a tablet, a server, etc. Figure 3 As shown, the virtual machine migration method includes:

[0097] S301, receiving a first instruction sent by at least one source host; the first instruction is generated and sent by the corresponding source host according to the disk information of the first virtual machine on the source host.

[0098] The target host can process virtual machine migration tasks issued by multiple source hosts at the same time. One source host can migrate one virtual machine to the target host, or one source host can migrate multiple virtual machines to the target host.

[0099] The disk information of the first virtual machine includes: operating system version, firmware type, file system type, disk partition information, etc.

[0100] The source host generates a first instruction according to the disk information of the first virtual machine on the source host, and sends the first instruction to the destination host.

[0101] For further reference, Figure 4 In one embodiment, before receiving the first instruction sent by at least one source host, the virtual machine migration method further includes:

[0102] S401, receiving a second instruction sent by at least one source host; the second instruction carries disk information of a first virtual machine on the corresponding source host.

[0103] The source host sends a second instruction to the destination host, the second instruction carrying disk information of the first virtual machine on the corresponding source host, and the second instruction is used to control the destination host to verify whether the destination host has the hardware conditions to run the first virtual machine based on the disk information.

[0104] For each of the second instructions sent by the at least one source host, the method further includes:

[0105] S402: Verify whether the destination host has the conditions for running the corresponding first virtual machine based on the corresponding disk information, and obtain a verification result.

[0106] For example, the verification includes: determining whether the disk specification of the target host is greater than the disk specification of the first virtual machine, determining whether the central processing unit (CPU) and memory of the target host can run the first virtual machine, and the like.

[0107] The verification result includes: the destination host has the hardware conditions for running the first virtual machine, and the destination host does not have the hardware conditions for running the first virtual machine.

[0108] S403: Send the verification result to the corresponding source host, so that the corresponding source host generates a first instruction according to the disk information when the verification result indicates that the destination host has the conditions to run the corresponding first virtual machine.

[0109] After obtaining the verification result, the target host feeds back the verification result to the source host. If the verification result indicates that the target host has the hardware conditions to run the corresponding first virtual machine, the source host generates a first instruction according to the disk information and sends the first instruction to the target host.

[0110] For each of the first instructions sent by the at least one source host, the virtual machine migration method further includes:

[0111] S302, creating a second virtual machine in a first disk environment based on a set first image; the virtual machine created based on the first image automatically starts a first service when running; the first service is used to configure the disk environment.

[0112] The source host sends a first instruction to the target host. After the target host obtains the first instruction, it creates a second virtual machine in the first disk environment based on the set first image. The disk environment includes: the number of disks, the size of the disk, the type of disk partitions, the type of disk file system, etc. The first disk environment is the disk environment created by the target host for the second virtual machine. A part of the hardware resources of the target host is allocated to the second virtual machine. For example, 50G capacity is allocated from the hard disk of the target host to the second virtual machine. This 50G capacity is used to create a separate disk. The disk is partitioned, formatted, the file system type is set, and mounted, etc., so as to form the first disk environment.

[0113] In actual applications, the second virtual machine can be created by calling the application programming interface (API) of openstack (cloud computing management platform). When calling this API interface, the target host will specify the set first image and create the second virtual machine through the set first image.

[0114] In actual applications, the first image set can be a Community Enterprise Operating System (CentOS) image. CentOS is an operating system based on Linux, but Linux is a kernel system with only a terminal command interface and no graphical interface. CentOS has both a terminal command interface and a graphical interface, and having a graphical interface can facilitate user operation.

[0115] In the embodiment of the present invention, the task performed by the second virtual machine is relatively simple, so the second virtual machine does not need a high-specification hardware configuration. For example, 1 core CPU and 1G memory are allocated to the second virtual machine. In addition, disk and bandwidth need to be allocated to the second virtual machine. In actual applications, the cloud server can simultaneously create thousands or tens of thousands of such second virtual machines with hardware rules. Therefore, the cloud server can perform multiple virtual machine migration tasks with high concurrency.

[0116] S303: Run the second virtual machine to configure a corresponding second disk environment based on the corresponding disk information through the first service.

[0117] After the second virtual machine is created, the second virtual machine is run, and the second virtual machine automatically starts the first service when running. The first service is used to configure the corresponding second disk environment based on the disk information of the first virtual machine.

[0118] Here, the second disk environment is the disk environment where the first virtual machine is located after it is migrated to the target host. The first virtual machine becomes the third virtual machine after it is migrated to the target host. To create the third virtual machine, you first need to configure the corresponding second disk environment. Only with the second disk environment can the data of the first virtual machine be synchronized to the second disk environment.

[0119] The related art configures the second disk environment through the target host, while the embodiment of the present invention configures the second disk environment based on the disk information through the second virtual machine.

[0120] The first service configures the corresponding second disk environment based on the disk information of the first virtual machine. The second disk environment needs to be the same as some disk environments of the first virtual machine. If some disk information of the third virtual machine is inconsistent with that of the first virtual machine, the third virtual machine will not be able to start normally on the target host, and even the data cannot be synchronized to the second disk environment. For example, the disk partition format of the third virtual machine must be the same as that of the first virtual machine. The disk information of the third virtual machine does not have to be exactly the same as that of the first virtual machine. Except for some disk information that must be the same, other disk information can be improved according to actual conditions. For example, the disk capacity can be expanded or reduced.

[0121] The first service configuration second disk environment mainly includes the following aspects:

[0122] 1. Disk creation: A portion of the disk capacity of the target host disk is used to create the disk of the third virtual machine, or a portion of the disk capacity of the second virtual machine disk is used to create the disk of the third virtual machine.

[0123] 2. Disk partitioning. Complete the disk partitioning according to the disk partition type, disk name, number of disk partitions, and capacity of each disk partition of the first virtual machine. The disk partition information of the third virtual machine does not have to be completely consistent with the disk partition information of the first disk. For example, the disk capacity can be expanded or reduced, and the disk name can be renamed.

[0124] 3. Disk formatting: Format the disk of the third virtual machine according to the file system types corresponding to the partitions of the disk of the first virtual machine, so that the file system type of the disk of the third virtual machine is consistent with the file system type of the disk of the first virtual machine.

[0125] 4. Mount the disk. Mount the disk of the third virtual machine on the second virtual machine. The purpose of this step is to synchronize the data of the first virtual machine to the disk of the third virtual machine. Therefore, data can be written to the disk only after the disk is mounted. Mounting it on the second virtual machine does not occupy the resources of the target host and does not affect the performance of the target host.

[0126] 5. Other disk configurations. For example, installing Bootloader, modifying Grub configuration files, modifying Fstab configuration files, etc. Bootloader is a small program that is executed before the operating system runs. Through this small program, we can initialize hardware devices and establish a mapping table of memory space, thereby establishing an appropriate system hardware and software environment to prepare for the final call to the operating system kernel. Grub is a boot loader. Grub is an implementation of the multi-boot specification. It allows users to have multiple operating systems in the computer at the same time and select the operating system they want to run when the computer starts. Grub can be used to select different kernels on the operating system partition, and can also be used to pass startup parameters to these kernels. Fstab is a file used to store static information of the file system. When the system starts, the system will automatically read information from this file and automatically mount the file system specified in this file to the specified directory.

[0127] In the embodiment of the present invention, one second virtual machine is configured with one second disk environment. That is, the configuration of the second disk environment is only affected by the second virtual machine, and other virtual machine migration tasks on the target host will not affect the configuration of the second disk environment.

[0128] S304: After the corresponding source host synchronizes the data of the corresponding first virtual machine to the corresponding second disk environment based on communication with the corresponding second virtual machine, a corresponding third virtual machine is created in the corresponding second disk environment.

[0129] In the embodiment of the present invention, the source host sends the corresponding data of the first virtual machine to the target host based on the communication with the second virtual machine, and the target host synchronizes the corresponding data of the first virtual machine to the corresponding second disk environment through the second virtual machine.

[0130] Here, the source host can use a variety of data synchronization methods to synchronize the data of the first virtual machine to the second disk environment, such as full synchronization and incremental synchronization. In actual applications, the source host can first generate an image of the first virtual machine, send the image to the second virtual machine, and the second virtual machine stores the image in the second disk environment. Alternatively, after the source host synchronizes all the data of the first virtual machine to the second disk environment, the second virtual machine generates an image of the first virtual machine based on the data in the second disk environment.

[0131] The data of the first virtual machine is synchronized to the second disk environment through the second virtual machine, so that the data synchronization process will only be affected by the hardware resources and network resources of the second virtual machine, and other virtual machine migration tasks on the target host will not affect the data synchronization of the first virtual machine. In addition, as an independent virtual computer, the hardware resources and network resources of the second virtual machine will not be affected by other virtual machines in the target host. Therefore, the data synchronization process of the first virtual machine can occupy all the resources of the second virtual machine, the data synchronization speed is fast, and it will not be affected by other virtual machine migration tasks, nor will it affect other virtual machine migration tasks.

[0132] After synchronizing the data of the first virtual machine to the corresponding second disk environment, the target host completes the boot and other settings, and the third virtual machine corresponding to the first virtual machine can be normally operated on the target host. At this point, the migration of the first virtual machine is completed.

[0133] The embodiment of the present invention receives a first instruction sent by at least one source host; the first instruction is generated and sent by the corresponding source host according to the disk information of the first virtual machine on the source host; for each first instruction, a second virtual machine is created in the first disk environment based on the set first image; the virtual machine created based on the first image automatically starts the first service when running; the first service is used to configure the disk environment; the second virtual machine is run to configure the corresponding second disk environment based on the corresponding disk information through the first service; after the corresponding source host synchronizes the data of the corresponding first virtual machine to the corresponding second disk environment based on the communication with the corresponding second virtual machine, the corresponding third virtual machine is created in the corresponding second disk environment. The embodiment of the present invention creates a second virtual machine on the target host, configures the corresponding second disk environment through the second virtual machine, and synchronizes the data of the first virtual machine to the second disk environment through the second virtual machine. When the target host processes multiple virtual machine migration tasks at the same time, each second virtual machine will not affect each other, each virtual machine migration task occupies the resources of the corresponding second virtual machine, will not be affected by other virtual machine migration tasks, and will not affect other virtual machine migration tasks, so that high concurrency of virtual machine migration tasks can be achieved.

[0134] Furthermore, in one embodiment, the virtual machine migration method further includes:

[0135] A third instruction is received from at least one source host; after the source host that sends the third instruction completes synchronization of the data of the corresponding first virtual machine to the corresponding second virtual machine, the corresponding second virtual machine is deleted.

[0136] The source host sends a third instruction to the destination host, so that the destination host deletes the second virtual machine after synchronizing the data of the first virtual machine to the second disk environment according to the third instruction.

[0137] After the data of the first virtual machine is synchronized to the second disk environment, the task of the second virtual machine is completed. At this time, you can choose to delete the second virtual machine to reduce the load of the target host and release the resources of the target host. Deleting the second virtual machine includes: deleting the disk data of the second virtual machine in the target host and returning the hardware resources and network resources of the second virtual machine to the target host.

[0138] refer to Figure 5 , Figure 5 It is a schematic diagram of a framework of a virtual machine migration service provided by an application embodiment of the present invention.

[0139] The user installs the migration agent on the source host. The migration agent refers to a program that has a certain degree of intelligence, can run autonomously and provide corresponding services. In an embodiment of the present invention, the migration agent can complete the virtual machine migration service, and the user can trigger the migration of the first virtual machine by triggering and clicking the migration agent. The migration agent on the source host sends the disk information of the virtual machine running on the source host to the target host. After the target host completes the migration feasibility check, it creates the second virtual machine through the set first image. The second virtual machine executes the first service, and the first service is mainly used to configure the disk environment. The second disk environment of the first virtual machine on the target host is configured based on the disk information through the first service. The source host synchronizes the data of the first virtual machine to the second disk environment, so that the destination host creates a third virtual machine corresponding to the first virtual machine in the second disk environment.

[0140] refer to Figure 6 , Figure 6 It is a structural diagram of a virtual machine migration system provided by an application embodiment of the present invention.

[0141] The virtual machine migration system includes a source host and a target host. The first virtual machine runs on the source host. When the first virtual machine needs to be migrated from the source host to the target host, the source host establishes a communication connection with the target host. The source host sends the information of the first virtual machine to the target host. The target host creates a second virtual machine based on the set first image and configures the second disk environment through the second virtual machine. Based on the communication with the second virtual machine, the source host sends the data of the first virtual machine to the second virtual machine through full synchronization or incremental synchronization. The second virtual machine receives and stores the data of the first virtual machine in the second disk environment. After the data synchronization is completed, the target host creates a third virtual machine corresponding to the first virtual machine in the disk environment. At this point, the virtual machine migration is completed.

[0142] refer to Figure 7 , Figure 7 It is a functional architecture diagram of a virtual machine migration service provided by an application embodiment of the present invention.

[0143] In an embodiment of the present invention, the virtual machine migration service includes a flow control function, a migration detection function, a power-on migration function, a full migration function, an incremental migration function, and a file-level data synchronization function. Flow control refers to setting a bandwidth limit on the second virtual machine to limit the flow rate of data synchronization; power-on migration refers to the virtual machine of the source host being able to remain powered on when the virtual machine is migrating; the file level is relative to block data, and a block generally refers to a combination of sectors on the underlying disk, and a certain file can correspond to one or more such blocks; full synchronization refers to synchronizing all data at one time, and incremental synchronization refers to synchronizing only different parts; the migration detection function refers to detecting whether the target host has the ability to run the virtual machine of the source host. The embodiment of the present invention uses incremental synchronization at the file level so that the downtime of the service no longer depends on the specific service data volume and bandwidth, and can achieve minute-level service downtime. The embodiment of the present invention migrates the file system at the OS level of the operating system, which is not affected by the service type and can shield service differences. The embodiment of the present invention controls the network traffic to ensure that the load of the virtual machine during the migration process remains within a controllable range.

[0144] like Figure 8 As shown, Figure 8 1 is a schematic diagram of an implementation process of a virtual machine migration method provided by an application embodiment of the present invention. The virtual machine migration process includes:

[0145] S801, check whether the network is connected.

[0146] If the network is not connected, execute step S809.

[0147] S802: Obtain information about a first virtual machine on a source host.

[0148] S803, verify whether the migration conditions are met.

[0149] If the migration condition is not met, execute step S809.

[0150] S804: Create a second virtual machine.

[0151] S805, configure the disk environment.

[0152] Configuring the disk environment includes the following aspects.

[0153] 1. Disk creation: A portion of the disk capacity of the target host disk is used to create the disk of the third virtual machine, or a portion of the disk capacity of the second virtual machine disk is used to create the disk of the third virtual machine.

[0154] 2. Disk partitioning. Complete the disk partitioning according to the disk partition type, disk name, number of disk partitions, and capacity of each disk partition of the first virtual machine. The disk partition information of the third virtual machine does not have to be completely consistent with the disk partition information of the first disk. For example, the disk capacity can be expanded or reduced, and the disk name can be renamed.

[0155] 3. Disk formatting: Format the disk of the third virtual machine according to the file system types corresponding to the partitions of the disk of the first virtual machine, so that the file system type of the disk of the third virtual machine is consistent with the file system type of the disk of the first virtual machine.

[0156] 4. Mount the disk. Mount the disk of the third virtual machine on the second virtual machine. The purpose of this step is to synchronize the data of the first virtual machine to the disk of the third virtual machine. Therefore, data can be written to the disk only after the disk is mounted. Mounting it on the second virtual machine does not occupy the resources of the target host and does not affect the performance of the target host.

[0157] 5. Other disk configurations. For example, installing Bootloader, modifying Grub configuration files, modifying Fstab configuration files, etc. Bootloader is a small program that is executed before the operating system runs. Through this small program, we can initialize hardware devices and establish a mapping table of memory space, thereby establishing an appropriate system hardware and software environment to prepare for the final call to the operating system kernel. Grub is a boot loader. Grub is an implementation of the multi-boot specification. It allows users to have multiple operating systems in the computer at the same time and select the operating system they want to run when the computer starts. Grub can be used to select different kernels on the operating system partition, and can also be used to pass startup parameters to these kernels. Fstab is a file used to store static information of the file system. When the system starts, the system will automatically read information from this file and automatically mount the file system specified in this file to the specified directory.

[0158] S806, data synchronization.

[0159] S807: Delete the second virtual machine.

[0160] S808: Create a third virtual machine.

[0161] S809, end.

[0162] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0163] Fig. 9 is a schematic diagram of a virtual machine migration device provided by an embodiment of the present invention, such as Fig. 9 As shown, the device includes: a generating module, a sending module and a synchronizing module.

[0164] A generating module, used to generate a first instruction according to the disk information of the first virtual machine on the source host;

[0165] A sending module, used for sending a first instruction to a destination host, so that the destination host creates a second virtual machine in a first disk environment based on a set first image according to the first instruction, and runs the second virtual machine, so as to configure the corresponding second disk environment based on the disk information through a first service; the virtual machine created based on the first image automatically starts the first service when running; the first service is used to configure the disk environment;

[0166] A synchronization module is used to synchronize the data of the first virtual machine to the second disk environment based on communication with the second virtual machine, so that the destination host creates a third virtual machine in the second disk environment.

[0167] The generating module is further used to: send a second instruction to the destination host, so that the destination host verifies whether the destination host has the conditions to run the first virtual machine based on the disk information according to the second instruction; the second instruction carries the disk information;

[0168] A verification result of the destination host is received, and if the verification result indicates that the destination host is capable of running the first virtual machine, the first instruction is generated according to the disk information.

[0169] The sending module is further used to send a third instruction to the destination host, so that the destination host uninstalls the second virtual machine after the data synchronization of the first virtual machine is completed according to the third instruction.

[0170] Fig.10 is a schematic diagram of a virtual machine migration device provided by an embodiment of the present invention, such as Fig.10 As shown, the device includes: a receiving module, a first creating module, a configuration module and a second creating module.

[0171] A receiving module, configured to receive a second instruction sent by at least one source host; the second instruction carries disk information of a first virtual machine on the corresponding source host;

[0172] For each of the first instructions sent by the at least one source host, the apparatus further comprises:

[0173] A first creation module is used to create a second virtual machine in a first disk environment based on a set first image; the virtual machine created based on the first image automatically starts a first service when running; the first service is used to configure the disk environment;

[0174] a configuration module, configured to run the second virtual machine to configure a corresponding second disk environment based on the corresponding disk information through the first service;

[0175] The second creation module is used to create a corresponding third virtual machine in the corresponding second disk environment after the corresponding source host synchronizes the data of the corresponding first virtual machine to the corresponding second disk environment based on communication with the corresponding second virtual machine.

[0176] The generating module is specifically used to receive a second instruction sent by at least one source host; the second instruction carries the disk information of the first virtual machine on the corresponding source host;

[0177] For each of the second instructions sent by the at least one source host, the method further includes:

[0178] Verifying whether the destination host has the conditions for running the corresponding first virtual machine based on the corresponding disk information, and obtaining a verification result;

[0179] The verification result is sent to a corresponding source host, so that the corresponding source host generates a first instruction according to the disk information when the verification result indicates that the destination host has the conditions for running the corresponding first virtual machine.

[0180] The device also includes:

[0181] A deletion module, configured to receive a third instruction sent by at least one source host;

[0182] After the source host that sends the third instruction completes synchronization of the data of the corresponding first virtual machine to the corresponding second virtual machine, the corresponding second virtual machine is deleted.

[0183] It should be noted that: the virtual machine migration device provided in the above embodiment only uses the division of the above modules as an example when performing virtual machine migration. In actual applications, the above processing can be assigned to different modules as needed, that is, the internal structure of the device is divided into different modules to complete all or part of the processing described above. In addition, the virtual machine migration device provided in the above embodiment and the virtual machine migration method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0184] Fig.11 is a schematic diagram of an electronic device provided by an embodiment of the present invention. The electronic device may be a server, etc. Fig.11 As shown, the device of this embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above-mentioned various method embodiments are implemented, for example Figure 1 Alternatively, when the processor executes the computer program, the functions of each module in the above-mentioned device embodiments are implemented, for example Fig.10 The functions of the receiving module, the first creating module, the configuration module and the second creating module are shown.

[0185] Exemplarily, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the device.

[0186] The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Fig.11 These are merely examples of electronic devices and do not constitute a limitation of the electronic device. The device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, the device may also include input and output devices, network access devices, buses, etc.

[0187] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0188] The memory may be an internal storage module of the device, such as a hard disk or memory of the device. The memory may also be an external storage device of the device, such as a plug-in hard disk, a smart memory card (SMC, SmartMedia Card), a secure digital (SD, Secure Digital) card, a flash card, etc. equipped on the device. Furthermore, the memory may also include both an internal storage module of the device and an external storage device. The memory is used to store the computer program and other programs and data required by the device. The memory may also be used to temporarily store data that has been output or is to be output.

[0189] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules and modules is used as an example. In actual application, the above-mentioned function allocation can be completed by different functional modules and modules as needed, that is, the internal structure of the device can be divided into different functional modules or modules to complete all or part of the functions described above. The functional modules and modules in the embodiment can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, the specific names of the functional modules and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the modules and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0190] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0191] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0192] In the embodiments provided by the present invention, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the modules or module divisions are only a logical function division, and there may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0193] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0194] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of software functional modules.

[0195] If the integrated module / module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0196] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A virtual machine migration method, characterized in that: Applied to a source host, the method comprises: Generate a first instruction according to disk information of a first virtual machine on a source host; Sending the first instruction to the destination host, so that the destination host creates a second virtual machine in the first disk environment based on the set first image according to the first instruction, and runs the second virtual machine, so as to configure the corresponding second disk environment based on the disk information through the first service; the virtual machine created based on the first image automatically starts the first service when running; the first service is used to configure the disk environment; Based on the communication with the second virtual machine, the data of the first virtual machine is synchronized to the second disk environment, so that the destination host creates a third virtual machine in the second disk environment, and the first virtual machine becomes the third virtual machine after being migrated to the target host.

2. The method according to claim 1, characterized in that The generating the first instruction according to the disk information of the first virtual machine on the source host includes: Sending a second instruction to the destination host, so that the destination host verifies whether the destination host has the conditions to run the first virtual machine based on the disk information according to the second instruction; the second instruction carries the disk information; A verification result of the destination host is received, and if the verification result indicates that the destination host is capable of running the first virtual machine, the first instruction is generated according to the disk information.

3. The method according to claim 1, characterized in that The method further comprises: A third instruction is sent to the destination host, so that the destination host uninstalls the second virtual machine after data synchronization of the first virtual machine is completed according to the third instruction.

4. A virtual machine migration method, characterized in that: Applied to the destination host, the method comprises: Receiving a first instruction sent by at least one source host; the first instruction is generated and sent by the corresponding source host according to the disk information of the first virtual machine on the source host; For each of the first instructions sent by the at least one source host, the method further includes: Creating a second virtual machine in the first disk environment based on the set first image; automatically starting a first service when the virtual machine created based on the first image is running; the first service is used to configure the disk environment; Running the second virtual machine to configure a corresponding second disk environment based on the corresponding disk information through the first service; After the corresponding source host synchronizes the data of the corresponding first virtual machine to the corresponding second disk environment based on communication with the corresponding second virtual machine, a corresponding third virtual machine is created in the corresponding second disk environment, and the first virtual machine becomes the third virtual machine after migrating to the target host.

5. The method according to claim 4, characterized in that The method further comprises: Receive a second instruction sent by at least one source host; the second instruction carries disk information of a first virtual machine on the corresponding source host; For each of the second instructions sent by the at least one source host, the method further includes: Verifying whether the destination host has the conditions for running the corresponding first virtual machine based on the corresponding disk information, and obtaining a verification result; The verification result is sent to a corresponding source host, so that the corresponding source host generates a first instruction according to the disk information when the verification result indicates that the destination host has the conditions for running the corresponding first virtual machine.

6. The method according to claim 4, characterized in that The method further comprises: receiving a third instruction sent by at least one source host; After the source host that sends the third instruction completes synchronization of the data of the corresponding first virtual machine to the corresponding second virtual machine, the corresponding second virtual machine is deleted.

7. A virtual machine migration device, characterized in that: include: A generating module, used to generate a first instruction according to the disk information of the first virtual machine on the source host; A sending module, configured to send a first instruction to a destination host, so that the destination host creates a second virtual machine in a first disk environment based on a set first image according to the first instruction, and runs the second virtual machine to configure a corresponding second disk environment based on the disk information through a first service; The virtual machine created based on the first image automatically starts the first service when running; The first service is used to configure the disk environment; A synchronization module is used to synchronize the data of the first virtual machine to the second disk environment based on communication with the second virtual machine, so that the destination host creates a third virtual machine in the second disk environment, and the first virtual machine becomes the third virtual machine after migration to the target host.

8. A virtual machine migration device, characterized in that: include: A receiving module, configured to receive a second instruction sent by at least one source host; the second instruction carries disk information of a first virtual machine on the corresponding source host; For each of the first instructions sent by the at least one source host, the apparatus further comprises: A first creation module is used to create a second virtual machine in a first disk environment based on a set first image; the virtual machine created based on the first image automatically starts a first service when running; the first service is used to configure the disk environment; a configuration module, configured to run the second virtual machine to configure a corresponding second disk environment based on the corresponding disk information through the first service; The second creation module is used to create a corresponding third virtual machine in the corresponding second disk environment after the corresponding source host synchronizes the data of the corresponding first virtual machine to the corresponding second disk environment based on communication with the corresponding second virtual machine. The first virtual machine becomes the third virtual machine after migrating to the target host.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it implements the virtual machine migration method according to any one of claims 1 to 3, or implements the virtual machine migration method according to any one of claims 4 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the virtual machine migration method as described in any one of claims 1 to 3, or executes the virtual machine migration method as described in any one of claims 4 to 6.

Citation Information

Patent Citations

  • Virtual machine migration method and device

    CN109739618A