Virtual machine migration method and device, equipment and medium

By adjusting the storage status determination function during the virtual machine migration process, detecting and migrating page data of allocated physical memory or disk partitions, the problem of invalid allocation of physical memory in virtual machine migration is solved, and the memory allocation and migration efficiency of target hosts is optimized.

CN120448029APending Publication Date: 2025-08-08CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510469667.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-15
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The prior art causes invalid allocation of physical memory during virtual machine migration, resulting in an increase in the physical memory usage of the target host, which may cause system performance to decline or even crash, and the migration time and network bandwidth usage are too high.

Method used

By calling the system native function of the target virtual machine, adjusting the storage state determination function to detect the storage state of the page, migrating only the page data of the allocated physical memory or disk partitions, avoiding the invalid allocation of unallocated physical memory pages on the target host.

Benefits of technology

The physical memory allocation of the target host is optimized, the risk of system performance decline is reduced, the migration time and network bandwidth usage is reduced, and the efficiency and compatibility of virtual machine migration is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448029A_ABST
    Figure CN120448029A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a virtual machine migration method and device, equipment and a medium, and the method comprises the steps: responding to a migration triggering operation on a target virtual machine on a source host, calling a storage state determination function of a page in the target virtual machine, and obtaining a function calling result; wherein the storage state determination function is obtained by adjusting a system primitive function based on the target virtual machine; determining a storage state of the page according to the function calling result; if the storage state is a transfer state, reading page data of the page, and migrating the page to a target host based on the page data; wherein the unloading state comprises a physical memory state or a disk partition state. Therefore, the introduction of complex hardware or software dependence is avoided in a mode of adjusting the existing function, the physical memory allocation on the target host by the page which is not allocated with the physical memory on the source host is also avoided, the invalid allocation of the physical memory on the target host is avoided, and the physical memory allocation of the target host is more reasonable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of virtualization technology, and in particular to a virtual machine migration method, apparatus, device, and medium. Background Art

[0002] Live migration of virtual machines, also known as hot migration, refers to migrating a virtual machine from one physical host to another without stopping the virtual machine or minimizing the impact on the virtual machine's operation.

[0003] Related technologies require iteratively migrating the memory data of a virtual machine running on a source host to a target host. However, during this migration, unallocated physical memory pages are allocated to physical memory, increasing the physical memory occupied by the virtual machine and causing physical memory waste. Reducing this inefficient physical memory allocation within the native virtual machine system has become a pressing issue. Summary of the Invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a virtual machine migration method, apparatus, device and medium.

[0005] The present disclosure provides a virtual machine migration method, which includes:

[0006] In response to a migration trigger operation on a target virtual machine on a source host, calling a storage status determination function of a page in the target virtual machine to obtain a function call result; wherein the storage status determination function is adjusted based on a system native function of the target virtual machine;

[0007] Determining the storage state of the page according to the function call result;

[0008] If the storage state is a transfer state, the page data of the page is read, and the page is migrated to the target host based on the page data; wherein the transfer state includes a physical memory state or a disk partition state.

[0009] The present disclosure also provides a virtual machine migration device, which includes:

[0010] a calling module configured to, in response to a migration triggering operation on a target virtual machine on a source host, call a storage status determination function of a page in the target virtual machine to obtain a function call result; wherein the storage status determination function is adjusted based on a system native function of the target virtual machine;

[0011] A first determining module, configured to determine a storage state of the page according to the function call result;

[0012] A migration module is used to read the page data of the page if the storage state is a transfer state, and migrate the page to a target host based on the page data; wherein the transfer state includes a physical memory state or a disk partition state.

[0013] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing instructions executable by the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the virtual machine migration method provided in the embodiment of the present disclosure.

[0014] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the virtual machine migration method provided in the embodiment of the present disclosure.

[0015] The technical solution provided by the embodiments of the present disclosure has the following advantages over the existing technology: the virtual machine migration solution provided in the embodiments of the present disclosure, the method includes: in response to the migration trigger operation of the target virtual machine on the source host, calling the storage status determination function of the page in the target virtual machine to obtain the function call result; wherein, the storage status determination function is adjusted based on the system native function of the target virtual machine; determining the storage status of the page according to the function call result; if the storage status is a transfer status, reading the page data of the page, and migrating the page to the target host based on the page data; wherein the transfer status includes the physical memory status or the disk partition status. By adopting the above technical solution, in the process of migrating the target virtual machine from the source host to the target host, the storage status determination function obtained by adjusting the system native function is called to determine the storage status of the page in the target virtual machine, and when the storage status indicates that the page in the source host has physical memory allocated at the current moment or the historical moment, the page is migrated from the source host to the target host according to the page data. By adjusting the existing function, the introduction of complex hardware or software dependencies is avoided, and the allocation of physical memory on the target host for pages that have not been allocated physical memory on the source host is avoided, and the invalid allocation of physical memory on the target host is avoided, so that the physical memory allocation of the target host is more reasonable, and the possibility of system performance degradation or even crash due to insufficient memory is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0017] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0018] Figure 1 A flowchart of a virtual machine migration method provided in an embodiment of the present disclosure;

[0019] Figure 2 A schematic diagram of the structure of a virtual machine migration device provided in an embodiment of the present disclosure;

[0020] Figure 3 A schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0021] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.

[0022] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0023] Live migration of virtual machines (VMs) enables them to continue executing their workloads during the migration process, thus achieving nearly seamless service continuity. Live migration is a key feature in virtualization technology and is widely used in data centers, cloud computing environments, and other scenarios.

[0024] In related technologies, the virtual machine migration process can be divided into two phases: the first phase is the memory migration phase, and the second phase is the state migration phase. In the memory migration phase, all the memory of the virtual machine running on the source end is iteratively migrated to the target host in multiple rounds of migration. Specifically, after the first round of migration is completed, if the migrated page is modified and becomes a dirty page, the iterative migration continues until the remaining dirty page memory can be migrated within a short time window (downtime). In the state migration phase, the remaining small amount of dirty pages and device status information are migrated to the target host.

[0025] In the related art, when allocating memory through the Memory File Descriptor (MEMFD) method in the Linux system, a read operation on a page that is not allocated with physical memory will trigger the actual allocation of physical memory. Since the related art requires a read operation on the data of each page during the virtual machine migration process, pages that were originally not allocated with physical memory in the source host will be allocated with physical memory in the target host. Therefore, after the virtual machine migration, the physical memory usage of the virtual machine on the target host may increase significantly compared to the physical memory usage of the virtual machine on the source host. Especially in the scenario of memory overcommit, the physical memory of the target host may be insufficient, causing the system performance of the target host to degrade or even crash.

[0026] Furthermore, in related technologies, VM migration duration is closely related to memory size, memory degradation rate, and network bandwidth. For VMs with larger memory sizes, migration time increases significantly. Furthermore, the migration process consumes a significant amount of network bandwidth, potentially impacting the performance of other network services.

[0027] The virtual machine migration method provided by the embodiment of the present disclosure solves the problem of increased physical memory usage of a virtual machine allocated memory in a MEMFD manner after migration, while also reducing migration time and network bandwidth usage.

[0028] In order to solve the above problems, the embodiments of the present disclosure provide a virtual machine migration method, which is described below in conjunction with specific embodiments.

[0029] Figure 1 This is a flow chart of a virtual machine migration method provided by an embodiment of the present disclosure. The virtual machine migration method can be applied to a virtual machine migration device or a virtualization platform. The virtualization platform can be constructed using Quick Emulator (QEMU) technology and Kernel-based Virtual Machine (KVM) technology. The virtual machine migration device can be implemented using software and / or hardware, and the virtual machine migration device can generally be integrated into an electronic device. Figure 1 As shown, the virtual machine migration method includes:

[0030] Step 101, in response to a migration trigger operation on a target virtual machine on a source host, a storage status determination function of a page in the target virtual machine is called to obtain a function call result; wherein the storage status determination function is adjusted based on a system native function of the target virtual machine.

[0031] Among them, the target virtual machine can be a virtual machine to be migrated online, and the memory in the target virtual machine can be allocated based on the MEMFD method. The memory used by the target virtual machine can be allocated by the virtualization platform from the physical host. This embodiment does not limit the way in which the virtualization platform allocates memory. For example, it can include the MEMFD method, and can also include anonymous memory and / or file mapping. Among them, anonymous memory is to allocate a section of virtual machine memory from the host through memory mapping (Memory Mapping, MMAP) through a fast simulator. File mapping is to use a file descriptor (File Descriptor, FD) as a memory mapping parameter by opening a file, wherein the file can be a normal file or a huge page (Hugepage) file. In the MEMFD method, a file descriptor is obtained by opening an anonymous memory file and used as a memory mapping parameter. At this time, only virtual memory is allocated, and physical memory is not allocated, and the corresponding physical memory will be allocated when performing a read operation. This method has higher security and interaction speed.

[0032] The source host may be a device that hosts the target virtual machine before the target virtual machine is migrated. The device may be a physical host or server, etc. The source host is also referred to as the source end. The migration trigger operation may be an operation that triggers the migration of the target virtual machine. This embodiment does not limit the migration trigger operation. For example, the migration trigger operation may be a trigger operation for the migration control of the target virtual machine displayed on the page. The page may be the basic unit of memory management, also known as a memory page. The storage status determination function may be a function for determining the storage status of the page. The system native function may be a native function of the operating system of the target virtual machine. The system native function may be understood as a system call. In an optional implementation, the system native function may be a mincore function. The function call result may be the data result after the storage status determination function is executed.

[0033] In embodiments of the present disclosure, this virtual machine migration method can be applied in scenarios such as data centers or cloud computing environments that require efficient online migration. Based on their migration needs, users can trigger a migration of a target virtual machine from among multiple virtual machines provided by a source host. In response to this migration trigger, the virtual machine migration device invokes a storage state determination function and obtains function call results corresponding to multiple pages within the target virtual machine.

[0034] In some embodiments of the present disclosure, a native parameter in a system native function has a physical memory bit, and the physical memory bit is used to indicate whether a page resides in physical memory.

[0035] The physical memory bit can be a bit in a parameter. For example, if the system native function is a mincore function, the native parameter can be vec, which can be an unsigned char array. The physical memory bit can be the lowest bit (Bit 0) of vec. If the value of the physical memory bit is 1, it indicates that the page resides in physical memory. If the value of the physical memory bit is 0, it indicates that the page does not reside in physical memory.

[0036] In native system functions, the physical memory bit can only determine whether a page is in physical memory. It cannot distinguish whether the page is still in virtual memory and has not been transferred to physical memory, or whether it has been transferred from physical memory to a disk partition. In other words, for a page that has been swapped to a disk partition, the physical memory bit for that page is also 0, making it impossible to accurately determine whether the page has been allocated physical memory. The disk partition, also known as the swap partition, is used to store data released from physical memory.

[0037] In some embodiments of the present disclosure, the adjustment parameters in the storage status determination function have physical memory bits and disk partition bits. The disk partition bits are used to represent whether the page is moved from physical memory to the disk partition. Accordingly, the function call result includes the adjustment parameter value.

[0038] If a parameter includes a physical memory bit and a disk partition bit, the disk partition bit and the physical memory bit can be different bits in the parameter. For example, if the storage status determination function is a function obtained by adjusting the mincore function, the adjustment parameter can be vec', vec' can be an unsigned char array, and the physical memory bit can be the lowest bit of vec'. If the value of the physical memory bit is 1, it indicates that the page resides in physical memory; if the value of the physical memory bit is 0, it indicates that the page does not reside in physical memory. The disk partition bit can be the second lowest bit (Bit 1) in vec'. If the value of the disk partition bit is 1, it indicates that the page has been moved from physical memory to the disk partition; if the value of the disk partition bit is 0, it indicates that the page has not been moved from physical memory to the disk partition. During the execution of the storage status determination function, the storage status determination function can detect whether the page has been moved to the disk partition and set the value of the disk partition bit based on the detection result.

[0039] In the tuning parameters, if the value of the physical memory bit is 0, it means that the page is not mapped to physical memory. If the value of the disk partition bit is 1, it means that the page has been swapped from physical memory to the disk partition and physical memory has been allocated to the page. If the value of the physical memory bit is 1, it means that the page is mapped to physical memory and the page data in the page is also stored in physical memory, and physical memory has been allocated to the page. Other values of the physical memory bit and the disk partition bit may indicate that the page has not been allocated to physical memory.

[0040] In the above solution, the system native function is modified and its functionality is expanded to detect whether the page has been allocated physical memory, creating a foundation for subsequent virtual machine migration.

[0041] Step 102: Determine the storage status of the page according to the function call result.

[0042] The storage state may be used to represent the storage status of the page in the target virtual machine at the current moment, and the storage state may correspond to the page in the target virtual machine.

[0043] In this embodiment, the virtual machine migration apparatus may analyze the storage status of each page in the target virtual machine according to the function call result to obtain the storage status of each page.

[0044] In some embodiments of the present disclosure, determining the storage state of a page based on a function call result includes: if the physical memory bit of the adjustment parameter value indicates that the page resides in physical memory, then determining the storage state to be a physical memory state. The physical memory state may indicate that the page has currently been transferred from virtual memory to physical memory.

[0045] In this embodiment, the function call result can be a queue of adjustment parameter values, which includes adjustment parameter values corresponding to pages of the target virtual machine. For each page, the virtual machine migration device can determine whether the value of the corresponding adjustment parameter value in the physical memory bit is 1. If so, the storage state of the page is determined to be the physical memory state.

[0046] In some embodiments of the present disclosure, determining the storage state of a page based on a function call result includes: if the physical memory bit of the adjustment parameter value indicates that the page does not reside in physical memory, and the disk partition bit of the adjustment parameter value indicates that the page has been moved from physical memory to a disk partition, then determining the storage state to be a disk partition state. The disk partition state may indicate that the page has currently been moved from physical memory to a disk partition, i.e., the page was resident in physical memory at a historical moment.

[0047] In this embodiment, for each page, the virtual machine transfer device can determine whether the value of the corresponding adjustment parameter value on the physical memory bit is 1. If not, it means that the page is not currently resident in the physical memory. It then further determines whether the value of the corresponding adjustment parameter value on the disk partition bit is 1. If so, it means that the page is currently being moved from the physical memory to the disk partition, that is, the page once resided in the physical memory, and the storage state of the page is determined to be the disk partition state.

[0048] In the above scheme, after determining that the page does not reside in the physical memory through the physical memory bit, the disk partition bit further determines that the page has been moved from the physical memory to the disk partition, thereby achieving accurate determination of the current resident location of the page.

[0049] In some embodiments of the present disclosure, the virtual machine migration method further includes: if the physical memory bit representing the page of the adjustment parameter value does not reside in the physical memory, and the disk partition bit representing the page of the adjustment parameter value has not been moved from the physical memory to the disk partition, then determining that the storage state is a virtual memory state. The virtual memory state may represent that the page has not been allocated physical memory at the current moment, that is, the page has always resided in the virtual memory.

[0050] In this embodiment, for each page, the virtual machine transfer device can determine whether the value of the corresponding adjustment parameter value on the physical memory bit is 1. If not, it means that the page is not currently resident in the physical memory. It then further determines whether the value of the corresponding adjustment parameter value on the disk partition bit is 1. If not, it means that the page is not currently allocated physical memory, that is, the page resides in the virtual memory at both the historical moment and the current moment, and the storage state is determined to be the virtual memory state.

[0051] In the above solution, when the physical memory bit determines that the page is not resident in the physical memory, the disk partition bit further determines that the page has not been allocated to the physical memory, thereby achieving accurate determination of the residency of the page.

[0052] Step 103: If the storage state is a transfer state, the page data of the page is read, and the page is migrated to the target host based on the page data; wherein the transfer state includes a physical memory state or a disk partition state.

[0053] The transfer status may indicate that the page has been transferred from a virtual page to another location, for example, from a virtual location to physical memory, or from a virtual page to a disk partition via physical memory. The page data may be the data recorded on the page. The target host may be the device that hosts the target virtual machine after the target virtual machine migration is complete, also known as the target end.

[0054] In this embodiment, for each page in the target virtual machine, if the page's storage state is determined to be physical memory or disk partition, this indicates that the page currently resides in physical memory; or, alternatively, it indicates that the page previously resided in physical memory and currently resides in a disk partition. In other words, the page currently resides in physical memory or historically. Furthermore, the virtual machine migration apparatus reads the page data in the page and migrates the page to the target host based on the page data.

[0055] In some embodiments of the present disclosure, migrating a page to a target host based on page data includes: if the page data is all zero, transmitting a zero flag to the target host; if the page data includes non-zero data, transmitting the page data to the target host. The zero flag (Iszero) is used to indicate that the page data is all zero. The non-zero data may be data with a value other than zero.

[0056] In this embodiment, for a page that has been allocated physical memory, it is further detected whether the page data in the page is all zero, and the page is transferred according to the detection result.

[0057] Specifically, if the page data is all zero, a zero flag is transmitted to the target host. After receiving the zero flag, the target host stores the page in the corresponding virtual memory and does not allocate physical memory to the page. After the migration of the target virtual machine is completed, if the page is accessed, physical memory is automatically allocated to the page. If the page data includes non-zero data, the page data is transmitted to the target host. After receiving the page data, the target host allocates the corresponding physical memory to the page and stores the page data in the physical memory.

[0058] In the above solution, by transmitting the zeroing flag, the target host does not allocate physical memory when restoring the target virtual machine's memory upon receiving the zeroing flag. This prevents the target host from allocating physical memory to pages with all zero data, avoids invalid memory allocation, conserves physical memory, optimizes the target virtual machine's memory migration process, and reduces memory migration time and network bandwidth usage.

[0059] The virtual machine migration method provided by the embodiment of the present disclosure includes: in response to a migration trigger operation on a target virtual machine on a source host, calling a storage status determination function of a page in the target virtual machine to obtain a function call result; wherein the storage status determination function is adjusted based on a system native function of the target virtual machine; determining the storage status of the page according to the function call result; if the storage status is a transfer status, reading the page data of the page, and migrating the page to the target host based on the page data; wherein the transfer status includes a physical memory status or a disk partition status. By adopting the above technical solution, in the process of migrating the target virtual machine from the source host to the target host, the storage status determination function obtained by adjusting the system native function is called to determine the storage status of the page in the target virtual machine, and when the storage status indicates that the page in the source host has physical memory allocated at the current moment or the historical moment, the page is migrated from the source host to the target host according to the page data. By adjusting the existing function, the introduction of complex hardware or software dependencies is avoided, and the allocation of physical memory on the target host for pages that have not been allocated physical memory on the source host is avoided, and the invalid allocation of physical memory on the target host is avoided, so that the physical memory allocation of the target host is more reasonable, and the possibility of system performance degradation or even crash due to insufficient memory is reduced.

[0060] In addition, for target virtual machines with larger memory specifications, the migration time of the target virtual machine is reduced by avoiding invalid allocation of physical memory. By reducing the migration time, the network bandwidth occupancy time of the migrating virtual machine is reduced, and the impact of migrating the virtual machine on the performance of other network services is reduced.

[0061] In some embodiments of the present disclosure, the virtual machine migration method further includes: if the storage state is a virtual memory state, transmitting an unallocated flag to the target host. The unallocated flag can be used to indicate that the page is not allocated to physical memory, that is, the page is not allocated to physical memory at both the current time and the physical time.

[0062] In this embodiment, if the storage state is virtual memory, it indicates that the page resides in virtual memory and no physical memory is allocated. The virtual machine migration device can then transmit an unallocated flag to the target host. After receiving the unallocated flag, the target host will store the page in the corresponding virtual memory, without allocating physical memory to the page or restoring the page data. Subsequently, when the page is accessed, physical memory is dynamically allocated to the page.

[0063] In this solution, before virtual machine migration, the system checks whether pages have been allocated physical memory. Based on this check, the migration process is optimized. Pages with unallocated physical memory are specially handled on both the source and destination hosts, preventing invalid allocation of physical memory. Furthermore, the unallocated flag optimizes the memory migration process, reducing migration time and network bandwidth usage.

[0064] In an optional implementation, the source host may also transmit page information to the target host. This page information may be used to configure the page in the target host, and is also referred to as page control information. This embodiment does not limit the page information; for example, the page information may include a memory region name, a memory virtual address, and the like.

[0065] Next, the virtual machine migration method in the embodiment of the present disclosure is further illustrated by using a specific example.

[0066] For the source host, the virtual machine migration device can detect whether each page of the target virtual machine on the source host has been allocated physical memory. Specifically, the developer pre-adjusts the system native function to generate a storage state determination function. The native parameters in the system native function and the adjustment parameters in the state determination function both have a physical memory bit. A value of 1 in this physical memory bit indicates that the page is resident in physical memory, and a value of 0 indicates that the page is not resident in physical memory.

[0067] The adjustment parameter in the state determination function also has a disk partition bit. The value of the disk partition bit is 1, indicating that the page is moved from the physical memory to the disk partition, and the value of 0 indicates that the page is not moved from the physical memory to the disk partition.

[0068] When the value of the physical memory bit is 0 and the value of the disk partition bit is 1, or the value of the physical memory bit is 1, it means that physical memory has been allocated for the page.

[0069] For such pages that have been allocated physical memory, the page data in the page is read and the page data is checked to see if it is all zero. If the page data is all zero, the page information and a zero flag are transmitted to the target host. If not all zero, the page information and page data are transmitted to the target host. For pages that have not been allocated physical memory, the page information and an unallocated flag are transmitted.

[0070] For the target host, when the target host recovers the memory of the target virtual machine, it detects whether there is an identifier for the page. If the page has an unallocated identifier, there is no need to recover the page data, and the page information is set. When the virtual machine accesses the page later, physical memory is automatically and dynamically allocated to the page. If the page has a zeroed identifier, there is no need to allocate physical memory, and the page information is set. When the page is accessed later, physical memory is automatically and dynamically allocated to the page. For other cases, the corresponding physical memory is configured for the page in the target host, and the page data in the page is recovered.

[0071] In the virtual machine migration method provided by the embodiment of the present disclosure, by extending the use of bits in native parameters, it is characterized whether the page has been allocated physical memory, which has strong compatibility. By detecting pages that have not been allocated physical memory, it avoids invalid allocation of physical memory on the target host, solves the problem of memory expansion after migration in the MEMFD mode, and reduces physical memory usage. In addition, the amount of data migrated is reduced, the migration time is shortened, the network bandwidth usage is reduced, and the virtual machine migration performance is optimized. This method is based on the improvement of the system native function and is therefore applicable to a variety of virtualization platforms and cloud computing environments. It does not require significant modifications to the virtual machine operating system and has strong compatibility. In addition, there is no need to introduce complex hardware or software dependencies.

[0072] Figure 2 This is a structural diagram of a virtual machine migration device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware, and the device can also be integrated into an electronic device.

[0073] like Figure 2 As shown, the virtual machine migration device includes:

[0074] A calling module 201 is configured to, in response to a migration trigger operation on a target virtual machine on a source host, call a storage status determination function of a page in the target virtual machine to obtain a function call result; wherein the storage status determination function is adjusted based on a system native function of the target virtual machine;

[0075] A first determining module 202, configured to determine the storage state of the page according to the function call result;

[0076] The migration module 203 is configured to read the page data of the page if the storage state is a transfer state, and migrate the page to a target host based on the page data; wherein the transfer state includes a physical memory state or a disk partition state.

[0077] Optionally, the native parameter in the system native function has a physical memory bit, and the physical memory bit is used to indicate whether the page resides in the physical memory;

[0078] The adjustment parameter in the storage status determination function includes the physical memory bit and the disk partition bit. The disk partition bit is used to indicate whether the page is moved from the physical memory to the disk partition. Accordingly, the function call result includes the adjustment parameter value.

[0079] Optionally, the first determining module 202 is configured to:

[0080] If the physical memory bit of the adjustment parameter value indicates that the page resides in the physical memory, the storage state is determined to be a physical memory state.

[0081] Optionally, the first determining module 202 is configured to:

[0082] If the physical memory bit of the adjustment parameter value indicates that the page does not reside in the physical memory, and the disk partition bit of the adjustment parameter value indicates that the page is moved from the physical memory to a disk partition, then the storage state is determined to be a disk partition state.

[0083] Optionally, the virtual machine migration device further includes:

[0084] The second determining module is used to determine that the storage state is a virtual memory state if the physical memory bit of the adjustment parameter value indicates that the page does not reside in the physical memory, and the disk partition bit of the adjustment parameter value indicates that the page has not been moved from the physical memory to the disk partition.

[0085] Optionally, the virtual machine migration device further includes:

[0086] A transmission model is used to transmit the unallocated identifier to the target host if the storage state is the virtual memory state.

[0087] Optionally, migrating the page to a target host based on the page data includes:

[0088] If the page data is all zero, transmitting a zero flag to the target host;

[0089] If the page data includes non-zero data, the page data is transmitted to the target host.

[0090] It should be noted that Figure 2 The virtual machine migration apparatus shown can execute each step in the above virtual machine migration method embodiment and realize each process and effect in the above virtual machine migration method embodiment, which will not be described in detail here.

[0091] Figure 3 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 3 As shown, the electronic device 300 includes one or more processors 301 and a memory 302 .

[0092] The processor 301 may be a central processing unit (CPU) or other forms of processing units having virtual machine migration capabilities and / or instruction execution capabilities, and may control other components in the electronic device 300 to perform desired functions.

[0093] The memory 302 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 301 may execute the program instructions to implement the virtual machine migration method of the embodiment of the present disclosure described above and / or other desired functions. Various contents such as input signals, signal components, noise components, etc. may also be stored in the computer-readable storage medium.

[0094] In one example, the electronic device 300 may further include an input device 303 and an output device 304 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).

[0095] In addition, the input device 303 may also include, for example, a keyboard, a mouse, and the like.

[0096] The output device 304 can output various information to the outside, including determined distance information, direction information, etc. The output device 304 can include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.

[0097] Of course, to simplify, Figure 3 Only some of the components related to the present disclosure in the electronic device 300 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, the electronic device 300 may further include any other appropriate components according to specific application scenarios.

[0098] In addition to the above-mentioned method and device, the embodiment of the present disclosure may also be a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the processor executes the virtual machine migration method provided by the embodiment of the present disclosure.

[0099] The computer program product may be written in any combination of one or more programming languages to implement the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, and conventional procedural programming languages such as C or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0100] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon. When the computer program instructions are executed by a processor, the processor executes the virtual machine migration method provided by the embodiment of the present disclosure.

[0101] The computer-readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, include but is not limited to a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0102] It should be noted that, in this document, relational terms such as "first" and "second" are used only 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 terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0103] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.

Claims

1. A virtual machine migration method, characterized in that: The method comprises: In response to a migration trigger operation on a target virtual machine on a source host, calling a storage state determination function of a page in the target virtual machine to obtain a function call result; wherein the storage state determination function is adjusted based on a system native function of the target virtual machine; Determining the storage state of the page according to the function call result; If the storage state is a transfer state, the page data of the page is read, and the page is migrated to the target host based on the page data; wherein the transfer state includes a physical memory state or a disk partition state.

2. The method according to claim 1, characterized in that The native parameter in the system native function has a physical memory bit, and the physical memory bit is used to indicate whether the page resides in the physical memory; The adjustment parameter in the storage status determination function includes the physical memory bit and the disk partition bit. The disk partition bit is used to indicate whether the page is moved from the physical memory to the disk partition. Accordingly, the function call result includes the adjustment parameter value.

3. The method according to claim 2, characterized in that Determining the storage state of the page according to the function call result includes: If the physical memory bit of the adjustment parameter value indicates that the page resides in the physical memory, the storage state is determined to be a physical memory state.

4. The method according to claim 2, characterized in that Determining the storage state of the page according to the function call result includes: If the physical memory bit of the adjustment parameter value indicates that the page does not reside in the physical memory, and the disk partition bit of the adjustment parameter value indicates that the page is moved from the physical memory to a disk partition, then the storage state is determined to be a disk partition state.

5. The method according to claim 2, characterized in that The method further comprises: If the physical memory bit of the adjustment parameter value indicates that the page does not reside in the physical memory, and the disk partition bit of the adjustment parameter value indicates that the page has not been moved from the physical memory to the disk partition, then the storage state is determined to be a virtual memory state.

6. The method according to claim 5, characterized in that The method further comprises: If the storage state is the virtual memory state, an unallocated flag is transmitted to the target host.

7. The method according to claim 1, characterized in that Migrating the page to the target host based on the page data includes: If the page data is all zero, transmitting a zero flag to the target host; If the page data includes non-zero data, the page data is transmitted to the target host.

8. A virtual machine migration device, characterized in that: include: a calling module configured to, in response to a migration triggering operation on a target virtual machine on a source host, call a storage status determination function of a page in the target virtual machine to obtain a function call result; wherein the storage status determination function is adjusted based on a system native function of the target virtual machine; A first determining module, configured to determine a storage state of the page according to the function call result; A migration module is used to read the page data of the page if the storage state is a transfer state, and migrate the page to a target host based on the page data; wherein the transfer state includes a physical memory state or a disk partition state.

9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the virtual machine migration method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The storage medium stores a computer program, and the computer program is used to execute the virtual machine migration method according to any one of claims 1 to 7.