Virtual Machine Migration Method, Apparatus, Electronic Device, and Storage Medium

By creating a new second virtual machine in the host and migrating the memory data and pass-through devices of the first virtual machine to the second virtual machine, the problem of large resource loss in the existing technology is solved, and efficient virtual machine migration is achieved.

CN113986451BActive Publication Date: 2025-06-27ALIBABA (CHINA) CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111156226.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-29
Publication Date
2025-06-27
Estimated Expiration
2041-09-29

AI Technical Summary

Technical Problem

When performing local migration methods for existing virtual machine migration, two sets of IO devices need to be configured, resulting in large resource losses.

Method used

By creating a new second virtual machine in the host, configuring memory, and copying the memory data of the first virtual machine to the second virtual machine, disconnecting the first virtual machine from the pass-through device, and establishing a connection between the second virtual machine and the pass-through device, the virtual machine migration is completed.

Benefits of technology

Reduce resource loss, avoid the need to configure two sets of direct-through devices, and improve the efficiency of virtual machine migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986451B_ABST
    Figure CN113986451B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a virtual machine migration method, apparatus, electronic device, and storage medium. The method includes: in response to a local hot migration instruction for a first virtual machine, creating a second virtual machine in a host machine, where the first virtual machine is connected to at least one direct device; configuring memory for the second virtual machine and copying memory data in the memory of the first virtual machine to the memory of the second virtual machine; upgrading the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the direct device, and after the direct device is disconnected from the first virtual machine, establishing a connection between the direct device and the second virtual machine; loading the device status information of the first virtual machine into the second virtual machine to complete virtual machine migration; the embodiment of the present application can reduce resource consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technologies, and in particular, to a virtual machine migration method, a virtual machine migration device, an electronic device, and a storage medium. Background Art

[0002] Live Migration, also known as dynamic migration or real-time migration, refers to virtual machine save / restore. Usually, the entire running state of the virtual machine is completely saved and can be quickly restored to the original hardware platform or even a different hardware platform. After restoration, the virtual machine still runs smoothly and users will not notice any differences. A virtual machine (VM) refers to a complete computer system with full hardware system functions simulated by software and running in a completely isolated environment.

[0003] Virtual machines usually configure some input / output devices (Input / Output, IO devices) for data processing. To ensure more efficient communication between the virtual machine and the IO device, the IO device usually adopts a direct connection method to connect to the virtual machine. However, for an IO device connected to a virtual machine in a direct connection manner, during the local migration of the virtual machine, the IO device cannot be reopened. Therefore, to enable the local migration of the virtual machine, usually two sets of IO devices need to be set locally to allocate idle IO devices to the newly created virtual machine during the virtual machine migration process to complete the virtual machine migration.

[0004] However, using the above migration method will cause a large amount of resource consumption. Summary of the Invention

[0005] An embodiment of this application provides a virtual machine migration method to reduce resource consumption.

[0006] Correspondingly, an embodiment of this application also provides a virtual machine migration device, an electronic device, and a storage medium to ensure the implementation and application of the above system.

[0007] To solve the above problems, an embodiment of the present application discloses a virtual machine migration method, and the method includes: in response to a local hot migration instruction for a first virtual machine, creating a second virtual machine in a host, where the first virtual machine is connected to at least one direct device; configuring memory for the second virtual machine, and copying memory data in the memory of the first virtual machine to the memory of the second virtual machine; upgrading the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the direct device, and after the direct device is disconnected from the first virtual machine, establishing a connection between the direct device and the second virtual machine; loading the device status information of the first virtual machine into the second virtual machine to complete virtual machine migration.

[0008] Optionally, upgrading the first virtual machine and the second virtual machine includes: upgrading the first virtual machine according to first upgrade information to disconnect the connection between the first virtual machine and the direct device; after the first virtual machine is upgraded, upgrading the second virtual machine according to second upgrade information before the first virtual machine is upgraded to establish a connection between the direct device and the second virtual machine.

[0009] Optionally, configuring memory for the second virtual machine includes: obtaining memory configuration information from the local hot migration instruction; configuring memory for the second virtual machine according to the memory configuration information.

[0010] Optionally, configuring memory for the second virtual machine according to the memory configuration information includes at least one of the following steps: configuring idle memory in the host for the second virtual machine according to the memory configuration information; configuring the memory of the host for the second virtual machine according to the memory configuration information; releasing the target memory of the first virtual machine and configuring it for the second virtual machine according to the memory configuration information.

[0011] Optionally, the method further includes: providing a memory configuration page, and obtaining memory allocation information based on the memory configuration page to form memory configuration information to form a local hot migration instruction.

[0012] Optionally, copying the memory data in the memory of the first virtual machine to the memory of the second virtual machine includes: establishing a migration channel, and copying the memory data in the memory of the first virtual machine to the memory of the second virtual machine through the migration channel; determining dirty data in the copied memory data of the first virtual machine, and copying the dirty data to the memory of the second virtual machine through the migration channel; when the dirty data is reduced to a target threshold, suspending data processing of the first virtual machine and copying the dirty data to the memory of the second virtual machine.

[0013] Optionally, loading the device status information of the first virtual machine into the second virtual machine includes: after copying the memory data of the first virtual machine to the memory of the second virtual machine, migrating the device status information of the first virtual machine to the memory of the host; after the second virtual machine establishes a connection with the direct device, loading the device status information in the memory of the host into the second virtual machine.

[0014] Optionally, the method further includes: locking the first external port of the first virtual machine, and configuring a second external port for the second virtual machine; updating the configuration information of the second external port to the configuration information of the first external port, and closing the first external port to perform data transmission through the second external port.

[0015] Optionally, the method further includes: obtaining hypervisor information through the second virtual machine, where the hypervisor information is used to establish interaction with the background hypervisor; disconnecting the first virtual machine from the background hypervisor and ending the process of the first virtual machine; establishing a connection between the second virtual machine and the background hypervisor based on the hypervisor information.

[0016] Optionally, the direct device includes at least one of the following devices: image processor, memory, disk.

[0017] To solve the above problems, an embodiment of the present application discloses a virtual machine migration method, and the method includes: providing a memory configuration page, and obtaining memory allocation information based on the memory configuration page to form memory variable allocation information to form a local hot migration instruction; in response to the local hot migration instruction for the first virtual machine, creating a second virtual machine in the host, where the first virtual machine is connected to at least one direct device; configuring memory for the second virtual machine according to the memory variable allocation information, and copying the memory data in the memory of the first virtual machine to the memory of the second virtual machine; upgrading the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the direct device, and after the direct device disconnects from the first virtual machine, establishing a connection between the direct device and the second virtual machine; loading the device status information of the first virtual machine into the second virtual machine to complete virtual machine migration.

[0018] To solve the above problems, an embodiment of the present application discloses a virtual machine migration device, which includes: a virtual machine creation module, configured to create a second virtual machine in a host in response to a local live migration instruction for a first virtual machine, where the first virtual machine is connected to at least one passthrough device; a memory data copy module, configured to configure memory for the second virtual machine and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine; a virtual machine upgrade module, configured to upgrade the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the passthrough device, and after the passthrough device is disconnected from the first virtual machine, establish a connection between the passthrough device and the second virtual machine; a device state loading module, configured to load the device state information of the first virtual machine into the second virtual machine to complete the virtual machine migration.

[0019] To solve the above problems, an embodiment of the present application discloses a virtual machine migration device, which includes: a configuration page display module, configured to provide a memory configuration page, obtain memory allocation information based on the memory configuration page, and form memory variable configuration information to form a local live migration instruction; a virtual machine creation module, configured to create a second virtual machine in a host in response to a local live migration instruction for a first virtual machine, where the first virtual machine is connected to at least one passthrough device; a memory data migration module, configured to configure memory for the second virtual machine according to the memory variable configuration information and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine; a passthrough device migration module, configured to upgrade the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the passthrough device, and after the passthrough device is disconnected from the first virtual machine, establish a connection between the passthrough device and the second virtual machine; a device state migration module, configured to load the device state information of the first virtual machine into the second virtual machine to complete the virtual machine migration.

[0020] To solve the above problems, an embodiment of the present application discloses an electronic device, including: a processor; and a memory storing executable code thereon, which when executed, causes the processor to execute the method according to any one of the above embodiments.

[0021] To solve the above problems, an embodiment of the present application discloses one or more machine-readable media storing executable code thereon, which when executed, causes a processor to execute the method according to any one of the above embodiments.

[0022] Compared with the prior art, the embodiments of the present application have the following advantages:

[0023] In the embodiments of the present application, the first virtual machine is connected to at least one peripheral device. The peripheral device includes at least one direct device connected to the virtual machine in a direct pass-through manner. The host can, according to the local live migration instruction for the first virtual machine, create a second virtual machine in the host and configure memory for the second virtual machine. After that, the memory data in the memory of the first virtual machine can be copied to the memory of the second virtual machine by means of memory data copying. After that, the first virtual machine can be upgraded to disconnect the connection between the first virtual machine and the direct device; and after the first virtual machine is upgraded, the second virtual machine can be upgraded to establish a connection between the direct device and the second virtual machine; then the second virtual machine loads the device status information of the first virtual machine to complete the migration of the virtual machine. The embodiments of the present application can migrate the direct device of the first virtual machine to the second virtual machine by upgrading the first virtual machine and the second virtual machine. Compared with the method of configuring two sets of direct devices, the embodiments of the present application can reduce the consumption of resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1A is a schematic flowchart of a virtual machine migration method according to an embodiment of the present application;

[0025] Figure 1B is a schematic flowchart of a virtual machine migration method according to another embodiment of the present application;

[0026] Figure 2 is a schematic flowchart of a virtual machine migration method according to still another embodiment of the present application;

[0027] Figure 3 is a schematic flowchart of a virtual machine migration method according to still another embodiment of the present application;

[0028] Figure 4 is a schematic flowchart of a virtual machine migration method according to still another embodiment of the present application;

[0029] Figure 5 is a schematic structural diagram of a virtual machine migration apparatus according to an embodiment of the present application;

[0030] Figure 6 is a schematic structural diagram of a virtual machine migration apparatus according to another embodiment of the present application;

[0031] Figure 7 is a schematic structural diagram of an exemplary apparatus provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0032] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0033] The embodiments of the present application can be applied in the field of virtual machine live migration. Live Migration, also known as dynamic migration or real-time migration, refers to the preservation / restore of a virtual machine. Usually, the running state of the entire virtual machine is completely preserved and can be quickly restored to the original hardware platform or even a different hardware platform. A virtual machine (Virtual Machine) refers to a complete computer system with the functions of a complete hardware system simulated by software and running in a completely isolated environment.

[0034] The embodiments of the present application can be applied in the scenario of local live migration and can be applied in a host machine. The host machine includes a first virtual machine, and the first virtual machine is connected to at least one direct device. This method can create a second virtual machine in the host machine and can migrate the information in the first virtual machine (such as memory data, device status information) and the direct device connected to the first virtual machine to the second virtual machine to complete the local live migration of the virtual machine.

[0035] As Figure 1A shown, during the process of local live migration of the virtual machine, the host machine can create a second virtual machine and allocate memory for the second virtual machine in step 102, and copy the memory data in the first virtual machine to the memory of the second virtual machine in step 104. Then, in step 106, the first virtual machine migrates the device status information to the host machine memory for temporary storage. The host machine performs a first upgrade on the first virtual machine in step 108 to disconnect the connection between the first virtual machine and the direct device by means of upgrading. After the connection between the first virtual machine and the direct device is disconnected, the host machine can perform a second upgrade on the second virtual machine in step 110 to establish a connection between the second virtual machine and the direct device by means of upgrading. Then, the host machine can load the device status information temporarily stored in the host machine memory into the second virtual machine in step 112 to complete the local migration of the first virtual machine and provide data processing services through the second virtual machine. It should be noted that the host machine can be understood as a device. For example, in an optional example, the device can include a processor, a memory, a storage, a graphics processor, etc. In addition, the host machine can also be understood as a device composed of multiple sub-devices, such as a device composed based on Non Uniform Memory Access (NUMA) technology. NUMA technology can make many servers operate like a single system while retaining the advantages of a small system for easy programming and management. For example, in an optional example, the host machine can include at least one of the following sub-devices: the device corresponding to the first virtual machine, the device corresponding to the second virtual machine, a hard disk device, a graphics processor, etc. The multiple sub-devices can be in the same area or in different areas, and can be specifically configured according to requirements.

[0036] Specifically, this method can perform migration in response to a local live migration instruction, which can be generated in different scenarios. For example, when it is necessary to resize the memory of a virtual machine (adjust the memory size), a local live migration instruction can be generated. According to the local live migration instruction, memory can be allocated to the second virtual machine to complete the resizing of the virtual machine's memory. Specifically, the host can provide a memory configuration page to the user. The user can operate on the memory configuration page, and the host can obtain memory allocation information based on the user's memory resizing operation, form memory resizing information, and then form a local live migration instruction. The memory resizing information is used to partition the memory for the second virtual machine. After the host obtains the local live migration instruction, it can create a second virtual machine and allocate memory to the second virtual machine according to the memory resizing information to complete the memory resizing. The memory resizing information is used to partition the memory for the second virtual machine.

[0037] As Figure 1B shown, after obtaining the local live migration instruction for the first virtual machine, the host can lock the first external interface to suspend data interaction with external objects (such as a database), and allocate memory to each node according to the memory resizing information. The node can be a node of the second virtual machine or a node of the host. After allocating memory to the node, a second virtual machine can be created based on the node. The newly created second virtual machine can be understood as a virtual operating system emulator (Quick EMUlator, QEMU) process without peripheral devices. Memory is one of the important components of a computer, also known as internal memory and main memory. It is used to temporarily store the operation data in the CPU and exchange data with external memories such as hard disks. The memory configured for the second virtual machine can be at least one of the free memory in the host, the memory of the host, and the target memory of the first virtual machine. The target memory of the first virtual machine can be understood as the unused memory in the first virtual machine.

[0038] After configuring the memory for the second virtual machine, the memory data stored in the memory of the first virtual machine can be copied to the second virtual machine through the migration channel (socket) between the first virtual machine and the second virtual machine. Among them, during the copying process of the memory data, the first virtual machine is still processing data. Therefore, among the copied memory data, some memory data has changed. Such data can be called dirty data. Therefore, the embodiments of the present application can adopt an iterative copying method to copy the changed dirty data in the first virtual machine to the memory of the second virtual machine until the data volume of the dirty data is reduced to the target threshold. When the data volume of the dirty data is reduced to the target threshold, the data processing of the first virtual machine can be paused, and the dirty data can be copied to the memory of the second virtual machine. At this time, the memory data in the memories of the first virtual machine and the second virtual machine is consistent, and the memory copying is completed.

[0039] After the memory data migration is completed, the device status information of the first virtual machine can be migrated to the host memory for temporary storage. The device status information can be understood as the status information of the peripheral devices connected to the first virtual machine (such as including the direct devices connected in a direct way and the devices connected in other ways). And after the second virtual machine establishes a connection with the peripheral devices, the device status information in the host memory can be loaded into the second virtual machine again to complete the migration of the devices.

[0040] Among them, the first virtual machine can disconnect from the peripheral devices by means of upgrading, and the second virtual machine can establish a connection with the peripheral devices by means of upgrading. Specifically, this solution can upgrade the first virtual machine through the first upgrade information to upgrade the first virtual machine to a virtual machine without peripheral devices to disconnect the first virtual machine from the peripheral devices such as direct devices. Among them, the upgrade information can also be called the kernel command line (cmdline), which usually contains the configuration information of the virtual machine, the information of the peripheral devices connected to the virtual machine, etc. And the first upgrade information in the embodiments of the present application is used to remove the connection between the first virtual machine and the peripheral devices. Therefore, the first upgrade information does not contain the information of the peripheral devices connected to the virtual machine to upgrade the first virtual machine to a virtual machine without peripheral devices; the second virtual machine can also be upgraded through the second upgrade information before the first virtual machine is upgraded to upgrade the second virtual machine to a virtual machine with peripheral devices to establish a connection between the second virtual machine and the peripheral devices such as direct devices. The second upgrade information contains the configuration information of the virtual machine, the information of the peripheral devices connected to the virtual machine, etc. After establishing the connection between the second virtual machine and the direct device, the device status information in the host memory can be loaded into the second virtual machine so that the second virtual machine can manage the peripheral devices according to the device status information.

[0041] In addition, after the memory data and the passthrough device of the first virtual machine are migrated to the second virtual machine, the second virtual machine can obtain the hypervisor information (monitor) of the first virtual machine. The hypervisor information is used to connect to the background hypervisor, such as connecting to the virtualization management software (Libvirt). Libvirt is an application programming interface (API) for managing the virtualization platform and is a background program and management tool. After the second virtual machine obtains the hypervisor information, the host shuts down the first virtual machine and the background hypervisor, and then shuts down the first virtual machine. Then, the host uses the second virtual machine to establish a connection with the background hypervisor based on the hypervisor information and controls the second virtual machine to start running.

[0042] To facilitate data interaction between the virtual machine after migration and other objects (such as databases), the embodiment of the present application can lock the first external port of the first virtual machine, configure a second external port for the second virtual machine, and after the second virtual machine starts running, update the configuration information of the second external port of the second virtual machine to the configuration information of the first external port. Then, the first external port is deleted, and data interaction is performed through the second external port. This embodiment can update the configuration information of the second external port to that of the first external port, so that external objects (such as databases) do not need to be changed, thus facilitating data interaction after migration. Among them, in an optional example, the external port can be understood as a virtual network console (VNC) port, which is a remote control tool software. After the migration is completed, the migration channel is removed, and data processing is performed through the second virtual machine.

[0043] The embodiment of the present application optimizes the migration process of local live migration. Therefore, the embodiment of the present application can be applied to various scenarios that require live migration. For example, the embodiment of the present application can be applied to a scenario where a virtual machine fails, and the relevant information of the first virtual machine is migrated to the second virtual machine by means of live migration, so that the second virtual machine can continue to provide data processing services. For another example, the embodiment of the present application can be applied to a scenario where the memory of the virtual machine is reconfigured. The embodiment of the present application can provide a memory configuration page, and the user can adjust the memory of the virtual machine on the memory configuration page to form memory reconfiguration information to form a local live migration instruction. Thus, by means of live migration of the virtual machine, the relevant information of the first virtual machine is migrated to the second virtual machine after the memory is reconfigured, thereby completing the memory reconfiguration.

[0044] For another example, the embodiments of the present application can also be applied to the scenario of reconfiguring the peripheral devices of a virtual machine. The embodiments of the present application can provide a device management page, where the user can adjust the peripheral devices of the virtual machine on the device management page, such as adding or removing peripheral devices, and adjusting the connection method between the peripheral devices and the virtual machine, to form device adjustment information. Thus, a local hot migration instruction can be formed based on the device adjustment information. In the way of hot migrating the virtual machine, after the peripheral devices are disconnected from the first virtual machine, the peripheral devices and the newly created second virtual machine can be connected according to the device adjustment information, so as to complete the adjustment, operation and maintenance, and management and control of the peripheral devices of the virtual machine.

[0045] In addition, from the perspective of the interaction between the cloud and the terminal, the embodiments of the present application can be applied to the cloud (which can be understood as a server) to provide cloud computing services to the terminal. For example, from different scenarios, the embodiments of the present application can provide data processing services for e-commerce related data in the e-commerce scenario, education related data in the education scenario, medical related data in the medical scenario, traffic related data in the traffic scenario, and financial related data in the financial scenario, such as providing services such as data storage, data analysis, and data calculation.

[0046] The embodiments of the present application provide a virtual machine migration method, which can be applied to a host computer and can perform local hot migration within the host computer, and can migrate the direct access devices of the first virtual machine to the second virtual machine, thereby reducing the resource consumption. Specifically, as Figure 2 shown, the method includes:

[0047] Step 202, in response to a local hot migration instruction for the first virtual machine, create a second virtual machine in the host computer, where the first virtual machine is connected to at least one direct access device. Step 204, configure memory for the second virtual machine and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine. The first virtual machine is connected to at least one peripheral device, and the peripheral device can be understood as an input / output device (Input / Output, IO device). The peripheral device includes at least one direct access device. The direct access device can be understood as a device connected to the first virtual machine in a direct access manner. The direct access (VFIO) method is a framework that can safely expose device input / output (Input / Output, I / O), interrupts, direct memory access (Direct Memory Access, DMA), etc. to the user space, so that the device driver can be completed in the user space. With direct device access in the user space, higher IO performance can be obtained for virtual machine device allocation. The direct access device can include one of devices such as a graphics processor, a memory, and a disk.

[0048] The local hot migration instruction may include memory reallocation information. According to the memory reallocation information, memory is configured for the second virtual machine. Specifically, as an optional embodiment, configuring memory for the second virtual machine includes: obtaining memory reallocation information from the local hot migration instruction; and configuring memory for the second virtual machine according to the memory reallocation information. The memory reallocation information may include information such as the size of the memory and memory partitioning data, so as to configure memory for the second virtual machine and partition the memory. Among them, in addition to configuring memory for the second virtual machine, the memory reallocation information may also include memory reallocation data of other nodes. For example, the memory reallocation information may also include memory reallocation data for the host machine memory, so as to perform processing such as allocation and adjustment of the host machine memory according to the memory reallocation information.

[0049] Among them, embodiments of the present application may generate corresponding memory reallocation information according to different application scenarios to form a local hot migration instruction. Specifically, as an optional embodiment, the method further includes at least one of the following steps: providing a memory configuration page, and obtaining memory allocation information based on the memory configuration page to form memory reallocation information to form a local hot migration instruction. In an optional example, this embodiment may be applied to a scenario where the virtual machine memory is adjusted according to the user's memory adjustment operation. This embodiment may provide a memory configuration page to the user. The user can operate on the memory configuration page. The host machine can obtain memory allocation information according to the user's memory reallocation operation to form memory reallocation information, and then form a local hot migration instruction. Among them, the memory reallocation information is used to partition the memory for the second virtual machine. After the host machine obtains the local hot migration instruction, it can create a second virtual machine and allocate memory to the second virtual machine according to the memory reallocation information to complete the memory reallocation.

[0050] When configuring memory, in embodiments of the present application, the idle memory in the host machine, a part of the host machine memory, and a part of the first virtual machine memory may be allocated to the second virtual machine. Specifically, as an optional embodiment, configuring memory for the second virtual machine according to the memory reallocation information includes at least one of the following steps: configuring the idle memory in the host machine for the second virtual machine according to the memory reallocation information; configuring the host machine memory for the second virtual machine according to the memory reallocation information; releasing the target memory of the first virtual machine according to the memory reallocation information and configuring it for the second virtual machine. When configuring memory for the second virtual machine, the idle memory (memory not allocated to nodes) in the host machine may not be enough to be allocated to the second virtual machine. Therefore, a part of the host machine memory and a part of the first virtual machine memory may be released to be allocated to the second virtual machine. For the host machine memory and the first virtual machine memory, in embodiments of the present application, the unused memory in the host machine memory and the first virtual machine memory may be determined and released, and then allocated to the second virtual machine.

[0051] During the process of copying memory data, the first virtual machine is still processing data. Therefore, in the copied memory data, there will be dirty data (data that has changed). Therefore, the embodiments of the present application can adopt an iterative copying method to copy the memory data. Specifically, as an optional embodiment, copying the memory data in the memory of the first virtual machine to the memory of the second virtual machine includes: establishing a migration channel and copying the memory data in the memory of the first virtual machine to the memory of the second virtual machine through the migration channel; determining the dirty data in the copied memory data of the first virtual machine and copying the dirty data to the memory of the second virtual machine through the migration channel; when the dirty data is reduced to a target threshold, suspending the data processing of the first virtual machine and copying the dirty data to the memory of the second virtual machine.

[0052] The first virtual machine can establish a migration exit, and the second virtual machine can establish a migration entry to form a migration channel for iterative copying of the memory data in the memory through the migration channel. In addition, when the amount of dirty data in the memory data is reduced to the target threshold, the dirty data can be copied at one time. Therefore, the embodiments of the present application can briefly suspend the data processing of the first virtual machine and copy the dirty data to the memory of the second virtual machine at one time. Among them, the target threshold can be determined according to the upper limit of the copy amount for a single copy.

[0053] After migrating the memory data of the first virtual machine to the memory of the second virtual machine, in step 206, the first virtual machine and the second virtual machine can be upgraded to disconnect the connection between the first virtual machine and the direct access device, and after disconnecting the direct access device from the first virtual machine, establish a connection between the direct access device and the second virtual machine. It should be noted that the process of upgrading the first virtual machine and the second virtual machine is after migrating the memory data of the first virtual machine to the memory of the second virtual machine. After migrating the memory data of the first virtual machine to the memory of the second virtual machine, the first virtual machine will suspend data processing (the second virtual machine has not started data processing yet). Therefore, in this solution, the process of upgrading the first virtual machine and the second virtual machine is completed during the suspension stage of the first virtual machine. This solution can first upgrade the first virtual machine and then upgrade the second virtual machine. Specifically, as an optional embodiment, upgrading the first virtual machine and the second virtual machine includes: upgrading the first virtual machine according to the first upgrade information to disconnect the connection between the first virtual machine and the direct access device; after upgrading the first virtual machine, upgrading the second virtual machine according to the second upgrade information before the first virtual machine was upgraded to establish a connection between the direct access device and the second virtual machine.

[0054] The first upgrade information can be understood as the information for upgrading the first virtual machine with peripheral devices to a virtual machine without peripheral devices; the second upgrade information is the upgrade information of the first virtual machine before the upgrade, and the second upgrade information is the information for upgrading the virtual machine without peripheral devices to a virtual machine with peripheral devices. In the embodiments of the present application, the first virtual machine can be upgraded using the first upgrade information to disconnect the direct device from the first virtual machine; the second virtual machine can be upgraded using the second upgrade information to establish a connection between the direct device and the second virtual machine.

[0055] After the direct device establishes a connection with the second virtual machine, the host can load the device status information of the first virtual machine into the second virtual machine in step 208 to complete the virtual machine migration. In the embodiments of the present application, the device status information of the first virtual machine can be temporarily stored in the memory of the host, and after the second virtual machine establishes a connection with the direct device, the device status information in the memory of the host is loaded into the second virtual machine. Specifically, as an optional embodiment, the loading the device status information of the first virtual machine into the second virtual machine includes: after copying the memory data of the first virtual machine to the memory of the second virtual machine, migrating the device status information of the first virtual machine to the memory of the host; after the second virtual machine establishes a connection with the direct device, loading the device status information in the memory of the host into the second virtual machine.

[0056] During the data processing process of the virtual machine, data interaction will be performed with external objects (such as databases) through external ports. Correspondingly, in order to reduce changes in external objects, in the embodiments of the present application, the configuration information of the second external port of the second virtual machine can be updated to the configuration information of the first external port of the first virtual machine, so that the second external port replaces the first external port to perform data interaction with external objects. Specifically, as an optional embodiment, the method further includes: locking the first external port of the first virtual machine and configuring a second external port for the second virtual machine; updating the configuration information of the second external port to the configuration information of the first external port and closing the first external port to perform data transmission through the second external port. In this embodiment, the external object can communicate using the previous port, thereby reducing the adjustment of the external object and improving the stability of the system.

[0057] In addition, the virtual machine is connected to multiple hypervisors, and the hypervisors can process data. Therefore, in order to establish a connection between the second virtual machine after migration and the hypervisor, the embodiments of the present application can obtain hypervisor information through the second virtual machine and establish a connection with the backend hypervisor through the hypervisor information. Specifically, as an optional embodiment, the method further includes: obtaining hypervisor information through the second virtual machine, where the hypervisor information is used to establish interaction with the backend hypervisor; disconnecting the connection between the first virtual machine and the backend hypervisor and ending the process of the first virtual machine; and establishing a connection between the second virtual machine and the backend hypervisor based on the hypervisor information. The backend hypervisor can be understood as a program for data processing. After completing the migration from the first virtual machine to the second virtual machine, data interaction can be performed through the second external port and data processing can be performed through the backend hypervisor.

[0058] In the embodiments of the present application, the first virtual machine is connected to at least one peripheral device, and the peripheral device includes at least one passthrough device connected to the virtual machine in a passthrough manner. The host can create a second virtual machine in the host according to the local live migration instruction for the first virtual machine and configure memory for the second virtual machine. Then, the memory data in the memory of the first virtual machine can be copied to the memory of the second virtual machine by means of memory data copying. After that, the first virtual machine can be upgraded to a virtual machine without peripheral devices to disconnect the connection between the first virtual machine and the passthrough device; and the second virtual machine can be upgraded to a virtual machine with peripheral devices to establish a connection between the passthrough device and the second virtual machine; then the second virtual machine loads the device status information of the first virtual machine to complete the migration of the virtual machine. The embodiments of the present application can migrate the passthrough device of the first virtual machine to the second virtual machine by upgrading the first virtual machine and the second virtual machine. Compared with the method of configuring two sets of passthrough devices, the embodiments of the present application can configure one set of passthrough devices, which can reduce resource consumption.

[0059] Based on the above embodiments, the embodiments of the present application further provide a virtual machine migration method, which can be applied in a host and can complete the local live migration of the virtual machine in the host. Specifically, as Figure 3 shown, the method includes:

[0060] Step 302, in response to a local live migration instruction for the first virtual machine, create a second virtual machine in the host, where the first virtual machine is connected to at least one passthrough device. As an optional embodiment, the method further includes: providing a memory configuration page and obtaining memory allocation information based on the memory configuration page to form memory reconfiguration information to form a local live migration instruction.

[0061] Step 304: Obtain the memory allocation information from the local hot migration instruction.

[0062] Step 306: Configure the memory for the second virtual machine according to the memory allocation information. As an optional embodiment, the configuring the memory for the second virtual machine according to the memory allocation information includes at least one of the following steps: configuring the idle memory in the host to the second virtual machine according to the memory allocation information; configuring the memory of the host to the second virtual machine according to the memory allocation information; releasing the target memory of the first virtual machine and configuring it to the second virtual machine according to the memory allocation information.

[0063] Step 308: Establish a migration channel and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine through the migration channel.

[0064] Step 310: Determine the dirty data in the copied memory data of the first virtual machine and copy the dirty data to the memory of the second virtual machine through the migration channel.

[0065] Step 312: When the dirty data is reduced to the target threshold, pause the data processing of the first virtual machine and copy the dirty data to the memory of the second virtual machine.

[0066] Step 314: Upgrade the first virtual machine according to the first upgrade information to disconnect the connection between the first virtual machine and the direct device.

[0067] Step 316: After the first virtual machine is upgraded, upgrade the second virtual machine according to the second upgrade information before the first virtual machine is upgraded to establish the connection between the direct device and the second virtual machine.

[0068] Step 318: After the memory data of the first virtual machine is copied to the memory of the second virtual machine, migrate the device status information of the first virtual machine to the memory of the host.

[0069] Step 320: After the second virtual machine is connected to the direct device, load the device status information in the memory of the host into the second virtual machine to complete the virtual machine migration.

[0070] In the embodiments of the present application, the first virtual machine is connected to at least one peripheral device. The peripheral device includes at least one direct device connected to the virtual machine in a direct pass-through manner. The host can, according to the local live migration instruction for the first virtual machine, create a second virtual machine in the host and configure the memory for the second virtual machine according to the memory configuration information in the local live migration instruction. Subsequently, the memory data in the memory of the first virtual machine can be copied to the memory of the second virtual machine by means of memory data copying. In the embodiments of the present application, the iterative copying method can be used to continuously reduce the dirty data in the memory data to complete the copying of the memory data. Subsequently, the first virtual machine can be upgraded to a virtual machine without peripheral devices to disconnect the connection between the first virtual machine and the direct device; and the second virtual machine can be upgraded to a virtual machine with peripheral devices to establish the connection between the direct device and the second virtual machine; then the second virtual machine loads the device status information of the first virtual machine to complete the migration of the virtual machine.

[0071] Based on the above embodiments, the embodiments of the present application further provide a virtual machine migration method, which can be applied to a host to form a local live migration instruction according to the user's memory configuration operation, so as to perform memory configuration of the host through live migration. Specifically, as Figure 4 shown, the method includes:

[0072] Step 402: Provide a memory configuration page, and obtain memory allocation information based on the memory configuration page to form memory configuration information, so as to form a local live migration instruction.

[0073] Step 402: In response to the local live migration instruction for the first virtual machine, create a second virtual machine in the host, where the first virtual machine is connected to at least one direct device.

[0074] Step 402: Configure the memory for the second virtual machine according to the memory configuration information, and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine.

[0075] Step 402: Upgrade the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the direct device, and after the connection between the direct device and the first virtual machine is disconnected, establish the connection between the direct device and the second virtual machine.

[0076] Step 402: Load the device status information of the first virtual machine into the second virtual machine to complete the virtual machine migration.

[0077] The implementation manner of this embodiment is similar to that of the above embodiment. The specific implementation manner can refer to the specific implementation manner of the above embodiment, which will not be elaborated here.

[0078] The embodiments of the present application can be applied to the scenario of dynamically allocating the memory of a virtual machine. The first virtual machine is connected to at least one peripheral device, and the peripheral device includes at least one direct device connected to the virtual machine in a direct pass-through manner. The present embodiment can provide a memory configuration page, where the user can perform memory adjustment operations in the memory configuration page, generate memory allocation information, and form memory dynamic allocation information, so as to generate a local live migration instruction based on the memory dynamic allocation information. The host can, according to the local live migration instruction for the first virtual machine, create a second virtual machine in the host and configure memory for the second virtual machine. After that, the memory data in the memory of the first virtual machine can be copied to the memory of the second virtual machine by means of memory data copying. After that, the first virtual machine can be upgraded to a virtual machine without peripheral devices to disconnect the connection between the first virtual machine and the direct device; and the second virtual machine can be upgraded to a virtual machine with peripheral devices to establish a connection between the direct device and the second virtual machine; then the second virtual machine loads the device status information of the first virtual machine to complete the migration of the virtual machine. The embodiments of the present application can complete the dynamic allocation of the memory of the virtual machine by migrating the virtual machine.

[0079] It should be noted that, for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present application.

[0080] Based on the above embodiments, the present embodiment further provides a virtual machine migration device. Referring to Figure 5 , it specifically may include the following modules:

[0081] The virtual machine creation module 502 is configured to create a second virtual machine in the host in response to a local live migration instruction for the first virtual machine, where the first virtual machine is connected to at least one direct device.

[0082] The memory data copy module 504 is configured to configure memory for the second virtual machine and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine.

[0083] The virtual machine upgrade module 506 is configured to upgrade the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the direct device, and after the connection between the direct device and the first virtual machine is disconnected, establish a connection between the direct device and the second virtual machine.

[0084] A device status loading module 508 is configured to load the device status information of the first virtual machine into the second virtual machine to complete virtual machine migration.

[0085] In summary, in the embodiment of the present application, the first virtual machine is connected to at least one peripheral device, and the peripheral device includes at least one passthrough device connected to the virtual machine in a passthrough manner. The host can, according to the local live migration instruction for the first virtual machine, create a second virtual machine in the host and configure memory for the second virtual machine. After that, the memory data in the memory of the first virtual machine can be copied to the memory of the second virtual machine by means of memory data copying. After that, the first virtual machine can be upgraded to disconnect the connection between the first virtual machine and the passthrough device; and after the first virtual machine is upgraded, the second virtual machine can be upgraded to establish a connection between the passthrough device and the second virtual machine; then the second virtual machine loads the device status information of the first virtual machine to complete the migration of the virtual machine. The embodiment of the present application can migrate the passthrough device of the first virtual machine to the second virtual machine by upgrading the first virtual machine and the second virtual machine. Compared with the method of configuring two sets of passthrough devices, the embodiment of the present application can reduce the consumption of resources.

[0086] Based on the above embodiment, the present embodiment further provides a virtual machine migration device, which may specifically include the following modules:

[0087] A live migration instruction acquisition and processing module is configured to, in response to a local live migration instruction for the first virtual machine, create a second virtual machine in the host, where the first virtual machine is connected to at least one passthrough device. As an optional embodiment, the device further includes the following module: a first instruction generation and processing module is configured to provide a memory configuration page, and obtain memory allocation information based on the memory configuration page to form memory reconfiguration information, so as to form a local live migration instruction.

[0088] A memory reconfiguration information acquisition and processing module is configured to acquire memory reconfiguration information from the local live migration instruction.

[0089] A virtual machine memory configuration processing module is configured to configure memory for the second virtual machine according to the memory reconfiguration information. As an optional embodiment, the virtual machine memory configuration processing module includes at least one of the following modules: a first memory configuration processing sub-module is configured to configure the idle memory in the host for the second virtual machine according to the memory reconfiguration information; a second memory configuration processing sub-module is configured to configure the memory of the host for the second virtual machine according to the memory reconfiguration information; a third memory configuration processing sub-module is configured to release the target memory of the first virtual machine and configure it for the second virtual machine according to the memory reconfiguration information.

[0090] A memory data migration processing module, which is used to establish a migration channel and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine through the migration channel.

[0091] A dirty data first migration processing module, which is used to determine the dirty data in the copied memory data of the first virtual machine and copy the dirty data to the memory of the second virtual machine through the migration channel.

[0092] A dirty data second migration processing module, which is used to pause the data processing of the first virtual machine when the dirty data is reduced to a target threshold and copy the dirty data to the memory of the second virtual machine.

[0093] A first virtual machine upgrade processing module, which is used to upgrade the first virtual machine according to the first upgrade information to disconnect the connection between the first virtual machine and the direct device.

[0094] A second virtual machine upgrade processing module, which is used to upgrade the second virtual machine according to the second upgrade information before the first virtual machine is upgraded after the first virtual machine is upgraded to establish the connection between the direct device and the second virtual machine.

[0095] A first device status migration processing module, which is used to migrate the device status information of the first virtual machine to the memory of the host after the memory data of the first virtual machine is copied to the memory of the second virtual machine.

[0096] A second device status migration processing module, which is used to load the device status information in the memory of the host into the second virtual machine after the second virtual machine is connected to the direct device to complete the virtual machine migration.

[0097] In the embodiment of the present application, the first virtual machine is connected to at least one peripheral device, and the peripheral device includes at least one direct device connected to the virtual machine in a direct connection manner. The host can create a second virtual machine in the host according to the local live migration instruction for the first virtual machine and configure the memory for the second virtual machine according to the memory configuration information in the local live migration instruction. Then, the memory data in the memory of the first virtual machine can be copied to the memory of the second virtual machine by means of memory data copying. The embodiment of the present application can continuously reduce the dirty data in the memory data by means of iterative copying to complete the copying of the memory data. Then, the first virtual machine can be upgraded to a virtual machine without peripheral devices to disconnect the connection between the first virtual machine and the direct device; and the second virtual machine can be upgraded to a virtual machine with peripheral devices to establish the connection between the direct device and the second virtual machine; then the second virtual machine loads the device status information of the first virtual machine to complete the migration of the virtual machine.

[0098] Based on the above embodiments, the present embodiment further provides a virtual machine migration device. Referring to Figure 6 , it may specifically include the following modules:

[0099] A configuration page display module 602, configured to provide a memory configuration page, obtain memory allocation information based on the memory configuration page, form memory variable configuration information, so as to form a local hot migration instruction.

[0100] A virtual machine creation module 604, configured to, in response to a local hot migration instruction for a first virtual machine, create a second virtual machine in a host, where the first virtual machine is connected to at least one passthrough device.

[0101] A memory data migration module 606, configured to configure memory for the second virtual machine according to the memory variable configuration information, and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine.

[0102] A passthrough device migration module 608, configured to upgrade the first virtual machine and the second virtual machine to disconnect the connection between the first virtual machine and the passthrough device, and after the connection between the passthrough device and the first virtual machine is disconnected, establish a connection between the passthrough device and the second virtual machine.

[0103] A device state migration module 610, configured to load the device state information of the first virtual machine into the second virtual machine to complete the virtual machine migration.

[0104] In summary, the embodiments of the present application can be applied to scenarios where the memory of a virtual machine is variably configured. The first virtual machine is connected to at least one peripheral device, and the peripheral device includes at least one passthrough device connected to the virtual machine in a passthrough manner. The present embodiment can provide a memory configuration page, and the user can perform memory adjustment operations in the memory configuration page to generate memory allocation information and form memory variable configuration information, so as to generate a local hot migration instruction according to the memory variable configuration information. The host can, according to the local hot migration instruction for the first virtual machine, create a second virtual machine in the host and configure memory for the second virtual machine. Then, the memory data in the memory of the first virtual machine can be copied to the memory of the second virtual machine by means of memory data copying. Then, the first virtual machine can be upgraded to a virtual machine without peripheral devices to disconnect the connection between the first virtual machine and the passthrough device; and the second virtual machine can be upgraded to a virtual machine with peripheral devices to establish a connection between the passthrough device and the second virtual machine; then the second virtual machine loads the device state information of the first virtual machine to complete the migration of the virtual machine. The embodiments of the present application can complete the variable configuration of the virtual machine memory by migrating the virtual machine.

[0105] Embodiments of the present application further provide a non-volatile readable storage medium, in which one or more modules (programs) are stored. When the one or more modules are applied to a device, the device can be caused to execute instructions for each method step in the embodiments of the present application.

[0106] Embodiments of the present application provide one or more machine-readable media, on which instructions are stored. When executed by one or more processors, the instructions cause an electronic device to execute one or more of the methods as described in the above embodiments. In the embodiments of the present application, the electronic device includes devices such as servers and terminal devices.

[0107] Embodiments of the present disclosure can be implemented as a device configured as desired using any suitable hardware, firmware, software, or any combination thereof. The device may include electronic devices such as servers (clusters) and terminals. Figure 7 Exemplary device 700 that can be used to implement the various embodiments described in the present application is schematically shown.

[0108] For one embodiment, Figure 7 Exemplary device 700 is shown, which has one or more processors 702, a control module (chipset) 704 coupled to at least one of the (one or more) processors 702, a memory 706 coupled to the control module 704, a non-volatile memory (NVM) / storage device 708 coupled to the control module 704, one or more input / output devices 710 coupled to the control module 704, and a network interface 712 coupled to the control module 704.

[0109] Processor 702 may include one or more single-core or multi-core processors. Processor 702 may include any combination of general-purpose processors or dedicated processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, device 700 can act as the server, terminal, etc. devices described in the embodiments of the present application.

[0110] In some embodiments, device 700 may include one or more computer-readable media (such as memory 706 or NVM / storage device 708) having instructions 714 and one or more processors 702 combined with the one or more computer-readable media and configured to execute instructions 714 to implement modules and thereby perform the actions described in the present disclosure.

[0111] For one embodiment, control module 704 may include any suitable interface controller to provide any suitable interface to at least one of the (one or more) processors 702 and / or any suitable device or component communicating with control module 704.

[0112] The control module 704 may include a memory controller module to provide an interface to the memory 706. The memory controller module may be a hardware module, a software module, and / or a firmware module.

[0113] The memory 706 may be used to load and store data and / or instructions 714 for the device 700, for example. For one embodiment, the memory 706 may include any suitable volatile memory, such as, for example, a suitable DRAM. In some embodiments, the memory 706 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).

[0114] For one embodiment, the control module 704 may include one or more input / output controllers to provide an interface to the NVM / storage device 708 and the (one or more) input / output devices 710.

[0115] For example, the NVM / storage device 708 may be used to store data and / or instructions 714. The NVM / storage device 708 may include any suitable non-volatile memory (such as, for example, flash memory) and / or may include any suitable (one or more) non-volatile storage devices (such as, for example, one or more hard disk drives (HDDs), one or more compact discs (CDs) drives, and / or one or more digital versatile discs (DVDs) drives).

[0116] The NVM / storage device 708 may include storage resources that are part of the device on which the device 700 is mounted, or it may be accessible by the device without necessarily being part of the device. For example, the NVM / storage device 708 may be accessed via the (one or more) input / output devices 710 over a network.

[0117] The (one or more) input / output devices 710 may provide an interface for the device 700 to communicate with any other suitable devices. The input / output devices 710 may include communication components, audio components, sensor components, etc. The network interface 712 may provide an interface for the device 700 to communicate over one or more networks. The device 700 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, such as accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.

[0118] For one embodiment, at least one of the (one or more) processors 702 may be logically encapsulated with one or more controllers of the control module 704 (e.g., a memory controller module). For one embodiment, at least one of the (one or more) processors 702 may be logically encapsulated with one or more controllers of the control module 704 to form a system-in-package (SiP). For one embodiment, at least one of the (one or more) processors 702 may be logically integrated with one or more controllers of the control module 704 on the same die. For one embodiment, at least one of the (one or more) processors 702 may be logically integrated with one or more controllers of the control module 704 on the same die to form a system-on-chip (SoC).

[0119] In various embodiments, the device 700 can be, but is not limited to, a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.), such as a terminal device. In various embodiments, the device 700 may have more or fewer components and / or a different architecture. For example, in some embodiments, the device 700 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application specific integrated circuit (ASIC), and a speaker.

[0120] Among them, a main control chip can be used as the processor or the control module in the detection device, sensor data, location information, etc. are stored in the memory or the NVM / storage device, the sensor group can be used as an input / output device, and the communication interface can include a network interface.

[0121] An embodiment of the present application also provides an electronic device, including: a processor; and a memory, on which executable code is stored, and when the executable code is executed, the processor is caused to execute one or more of the methods as in the embodiments of the present application.

[0122] An embodiment of the present application also provides one or more machine-readable media, on which executable code is stored, and when the executable code is executed, the processor is caused to execute one or more of the methods as in the embodiments of the present application.

[0123] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant parts, refer to the partial description of the method embodiment.

[0124] Each embodiment in this specification is described in a progressive manner. Each embodiment focuses on the differences from other embodiments, and for the same or similar parts among the embodiments, refer to each other.

[0125] Embodiments of the present application are described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.

[0126] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.

[0127] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.

[0128] Although the preferred embodiments of the embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0129] Finally, it should also be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or elements inherent to such process, method, article, or terminal device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article, or terminal device including the element.

[0130] The above has introduced in detail a virtual machine migration method, a virtual machine migration device, an electronic device, and a storage medium provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. At the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A virtual machine migration method, characterized in that, It can be applied to the host machine, and the method includes: In response to a local live migration instruction for a first virtual machine, a second virtual machine is newly created in the host machine, and at least one passthrough device is connected to the first virtual machine; Configure memory for the second virtual machine, and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine; Upgrade the first virtual machine according to the first upgrade information, and upgrade the first virtual machine to a virtual machine without peripheral devices to disconnect the connection between the first virtual machine and the passthrough device; After the first virtual machine is upgraded, upgrade the second virtual machine according to the second upgrade information before the first virtual machine is upgraded, and upgrade the second virtual machine to a virtual machine with peripheral devices to establish a connection between the passthrough device and the second virtual machine; Load the device status information of the first virtual machine into the second virtual machine to complete the virtual machine migration.

2. The method according to claim 1, wherein The configuring memory for the second virtual machine includes: Obtain memory reconfiguration information from the local live migration instruction; Configure memory for the second virtual machine according to the memory reconfiguration information.

3. The method according to claim 2, characterized in that, The configuring memory for the second virtual machine according to the memory reconfiguration information includes at least one of the following steps: Configure the idle memory in the host machine for the second virtual machine according to the memory reconfiguration information; Configure the memory of the host machine for the second virtual machine according to the memory reconfiguration information; Release the target memory of the first virtual machine according to the memory reconfiguration information and configure it for the second virtual machine.

4. The method according to claim 2, characterized in that, The method further includes: Provide a memory configuration page, and obtain memory allocation information based on the memory configuration page to form memory reconfiguration information, so as to form a local live migration instruction.

5. The method according to claim 1, wherein The method further includes: Lock the first external port of the first virtual machine and configure a second external port for the second virtual machine; Update the configuration information of the second external port to the configuration information of the first external port, and close the first external port to perform data transmission through the second external port.

6. The method according to claim 1, characterized in that, The method further includes: Obtain hypervisor information through the second virtual machine, and the hypervisor information is used to establish an interaction with the background hypervisor; Disconnect the first virtual machine from the background hypervisor and end the process of the first virtual machine; Establish a connection with the background hypervisor through the second virtual machine based on the hypervisor information.

7. A virtual machine migration method, characterized in that, The method includes: Provide a memory configuration page, and obtain memory allocation information based on the memory configuration page to form memory reconfiguration information, so as to form a local live migration instruction; In response to a local live migration instruction for a first virtual machine, a second virtual machine is newly created in the host machine, and at least one passthrough device is connected to the first virtual machine; Configure memory for the second virtual machine according to the memory reconfiguration information, and copy the memory data in the memory of the first virtual machine to the memory of the second virtual machine; Upgrade the first virtual machine according to the first upgrade information, and upgrade the first virtual machine to a virtual machine without peripheral devices to disconnect the connection between the first virtual machine and the passthrough device; After the upgrade of the first virtual machine, upgrade the second virtual machine according to the second upgrade information before the upgrade of the first virtual machine, and upgrade the second virtual machine to a virtual machine with peripheral devices to establish a connection between the direct device and the second virtual machine; Load the device status information of the first virtual machine into the second virtual machine to complete virtual machine migration.

8. An electronic device, characterized in that, Comprising: A processor; And A memory storing executable code which, when executed, causes the processor to perform the method according to any one of claims 1-7.

9. One or more machine-readable media storing executable code which, when executed, causes a processor to perform the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Online migration method of memory of virtual machine based on Virtio driver

    CN103677955A

  • Thermal migration method and device for virtual machine direct connection equipment

    CN108874506A