Method and device for migrating virtual machine data, storage medium and electronic device

By configuring extended memory for virtual machines and using memory information for data migration, the problem of low data migration efficiency between virtual machines is solved, achieving resource optimization and efficiency improvement.

CN120803617BActive Publication Date: 2025-12-16JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511272654.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-08
Publication Date
2025-12-16
Estimated Expiration
2045-09-08

AI Technical Summary

Technical Problem

In existing technologies, data migration between virtual machines is inefficient, leading to resource waste and redundant migrations.

Method used

By configuring reference extended memory for the reference virtual machine to store the data to be migrated, and using the reference memory information on the target virtual machine side to extract the data from the extended memory, resource waste and duplicate migration caused by direct data migration are avoided.

Benefits of technology

It optimizes the resource usage of virtual machines, improves the efficiency of data migration between virtual machines, and avoids redundant data migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803617B_ABST
    Figure CN120803617B_ABST
Patent Text Reader

Abstract

The application discloses a virtual machine data migration method and device, a storage medium and an electronic device, relates to the technical field of computers, and comprises the following steps: receiving a data access request; in response to the data access request, searching for target data in a target virtual machine; in the case that the target data is not stored in the target virtual machine, extracting the target data from a reference extended memory of a reference virtual machine according to reference memory information; and performing a target access operation on the target data in the target virtual machine. The application solves the technical problem of low data migration efficiency between virtual machines in the prior art, and achieves the technical effect of improving the data migration efficiency between virtual machines.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to methods and apparatuses for migrating virtual machine data, storage media and electronic devices. Background Technology

[0002] With the increasing maturity of cloud computing technology, cloud computing technology and its platforms have been widely implemented in various fields. Host virtualization is a key aspect of cloud computing technology. In host virtualization, virtual machines are typically built using the host system's memory resources to improve the host system's data processing capabilities. In some application scenarios, there is a need to migrate the runtime data of virtual machines on different hosts. Currently, the common approach is to migrate data between virtual machines, i.e., establishing a data transfer process between the source and destination virtual machines. The source virtual machine migrates the data to be transferred to the destination virtual machine through the data transfer process. However, due to the large amount of memory required and the continuous generation of dirty data during the operation of internal business processes within the virtual machines, the migration of virtual machines needs to be repeated in multiple rounds. In each migration round, the dirty data generated in the current round is repeatedly migrated. Such multiple migrations often consume high data transfer bandwidth, resulting in a waste of runtime resources. Summary of the Invention

[0003] This application provides a method and apparatus for migrating virtual machine data, a storage medium and an electronic device, to at least solve the problem of low data migration efficiency between virtual machines in related technologies.

[0004] This application provides a method for migrating virtual machine data, comprising: receiving a data access request, wherein the data access request is used to request the execution of a target access operation on target data of a reference virtual machine on a target virtual machine, the target virtual machine being a virtual machine used to receive data migrated from the reference virtual machine; responding to the data access request, searching for the target data in the target virtual machine; if the target data is not stored in the target virtual machine, retrieving the target data from the reference extended memory of the reference virtual machine according to reference memory information, wherein the reference extended memory is used to expand the data storage resources of the reference virtual machine, the reference memory information is used to indicate the data stored in the reference extended memory, the reference virtual machine being used to store the data to be migrated in the reference extended memory after receiving a migration request to migrate data to the target virtual machine; and performing the target access operation on the target data on the target virtual machine.

[0005] This application also provides a virtual machine data migration apparatus, comprising: a receiving module for receiving a data access request, wherein the data access request is for requesting a target access operation to be performed on target data of a reference virtual machine on a target virtual machine, the target virtual machine being a virtual machine for receiving data migrated from the reference virtual machine; a searching module for responding to the data access request and searching for the target data in the target virtual machine; an extraction module for extracting the target data from a reference extended memory of the reference virtual machine according to reference memory information when the target data is not stored in the target virtual machine, wherein the reference extended memory is used to expand the data storage resources of the reference virtual machine, the reference memory information is used to indicate the data stored in the reference extended memory, and the reference virtual machine is used to store the data to be migrated in the reference extended memory after receiving a migration request to migrate data to the target virtual machine; and an execution module for performing the target access operation on the target data on the target virtual machine.

[0006] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the virtual machine data migration methods described above when executing the computer program.

[0007] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described virtual machine data migration methods.

[0008] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described virtual machine data migration methods.

[0009] This application demonstrates that a reference virtual machine uses reference extended resources configured for it to perform data migration. During the data migration process, the reference virtual machine stores the data to be migrated in the reference extended memory. When the target virtual machine needs to perform a target access operation on the target data on the reference virtual machine, it retrieves the corresponding target data from the reference extended memory using the reference memory information. This avoids the waste of virtual machine runtime resources caused by directly migrating data through the virtual machine and also avoids duplicate data migration caused by data access during the data migration process. This optimizes the utilization of virtual machine runtime resources. Therefore, it can solve the technical problem of low data migration efficiency between virtual machines in related technologies and achieve the technical effect of improving the data migration efficiency between virtual machines. Attached Figure Description

[0010] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is a hardware structure block diagram of the virtual machine data migration method according to an embodiment of this application;

[0012] Figure 2 This is a flowchart of a virtual machine data migration method according to an embodiment of this application;

[0013] Figure 3 This is a schematic diagram of an optional destination memory access according to an embodiment of this application;

[0014] Figure 4 This is a structural block diagram of a virtual machine data migration device according to an embodiment of this application. Detailed Implementation

[0015] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0016] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0017] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0018] The specific application environment architecture or specific hardware architecture on which the virtual machine data migration method depends is described here.

[0019] The methods and embodiments provided in this application can be executed on a server device or a similar computing device. Taking running on a server device as an example, Figure 1This is a hardware structure block diagram of the virtual machine data migration method according to an embodiment of this application. Figure 1 As shown, the server device may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The server device may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the server equipment described above. For example, the server equipment may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0020] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the operating system startup method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thus implementing the aforementioned method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to server devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0021] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the server device. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0022] The embodiments of this application provide a method for migrating virtual machine data. The method is described in detail below in conjunction with the execution flow of the virtual machine data migration method.

[0023] The following explains the technical terms used in this application:

[0024] VM (Virtual Machine);

[0025] KVM (Kernel-based Virtual Machine, open source virtual machine).

[0026] This embodiment provides a method for migrating virtual machine data. Figure 2 This is a flowchart of a virtual machine data migration method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0027] Step S202: Receive a data access request, wherein the data access request is used to request to perform a target access operation on the target data of the reference virtual machine on the target virtual machine, and the target virtual machine is a virtual machine used to receive the data migrated from the reference virtual machine.

[0028] Step S204: In response to the data access request, locate the target data in the target virtual machine;

[0029] Step S206: If the target data is not stored in the target virtual machine, the target data is extracted from the reference extended memory of the reference virtual machine according to the reference memory information. The reference extended memory is used to extend the data storage resources of the reference virtual machine, and the reference memory information is used to indicate the data stored in the reference extended memory. The reference virtual machine is used to store the data to be migrated in the reference extended memory after receiving a migration request to migrate data to the target virtual machine.

[0030] Step S208: Perform the target access operation on the target data on the target virtual machine.

[0031] Through the above steps, the reference virtual machine uses the reference extended resources configured for it to perform data migration. During the data migration process, the reference virtual machine stores the data to be migrated in the reference extended memory. When the target virtual machine needs to perform a target access operation on the target data on the reference virtual machine, it uses the reference memory information to retrieve the corresponding target data from the reference extended memory. This avoids the waste of virtual machine runtime resources caused by directly migrating data through the virtual machine, and also avoids duplicate data migration caused by data access during the data migration process of the reference virtual machine. This optimizes the occupation of virtual machine runtime resources. Therefore, it can solve the technical problem of low data migration efficiency between virtual machines in related technologies, and achieve the technical effect of improving the data migration efficiency between virtual machines.

[0032] In the embodiment provided in step S202, the target virtual machine is the recipient of the data stored on the reference virtual machine, and the reference virtual machine needs to migrate the data it stores to the target virtual machine.

[0033] Optionally, in the embodiments of this application, the target virtual machine and the reference virtual machine are virtual machines running on the host system. The target virtual machine is deployed on the target host included in the host system (the target host is used to provide a running environment for the target virtual machine), and the reference virtual machine is deployed on the reference host included in the host system (the reference host is used to provide a running environment for the reference virtual machine). The host system includes the target host and the reference host.

[0034] In the embodiment provided in step S204, the data of the reference virtual machine has two storage locations: one is the virtual machine memory of the reference virtual machine, and the other is the reference extended memory allocated to the reference virtual machine in the shared resource pool of the host system (this shared resource pool is used to extend data storage resources for virtual machines running on the host system). Therefore, the reference virtual machine can migrate data to the target virtual machine in two ways: a first data migration method and a second data migration method. The first data migration method migrates data directly from the virtual machine memory of the reference virtual machine to the target virtual machine through a data migration link built between virtual machines. This method can directly write the data to be migrated into the target virtual machine memory of the target virtual machine, and when data is accessed later, data access operations can be performed directly on the data already stored in the target virtual machine memory. The second data migration method performs data migration through the reference extended memory. The reference virtual machine stores the data to be migrated in the reference extended memory and sends the reference memory information to the target virtual machine. Then, the target virtual machine can access the data to be migrated by accessing the reference extended memory. This method does not require the use of migration resources between virtual machines, and the virtual machine does not need to immediately access the data to be migrated. The data is written into the target virtual machine. Only when the target virtual machine needs to perform a data access operation on the data stored in the reference extended memory does it access the target data in the reference extended memory through the reference memory information and write the target data into the virtual machine memory of the reference virtual machine, thereby executing the corresponding target access operation. This method does not require the data to be migrated to the target virtual machine immediately; instead, the data to be migrated can be temporarily stored in the reference extended memory. This avoids multiple rounds of repeated data migration caused by dirty data generated during data modification during the data migration process. In other words, the reference virtual machine can access the data in the reference extended memory at any time before sending the reference memory information to the target virtual machine. In the embodiments of this application, a data migration method combining the first and second data migration methods can be used, as well as data migration using only the second data migration method.When performing data migration using a combination of the first and second data migration methods, the reference virtual machine can, upon receiving a data migration request, detect reference data access information for the stored data within a reference time period prior to the current moment. This reference data access information indicates the access status of the corresponding data by the reference virtual machine within the reference time period. Based on this reference data access information, the reference virtual machine can detect target data access information within a target time period. This target data access information indicates the probability of data access operations being performed on the reference virtual machine within the target time period, where the target time period is the data migration time period from the reference virtual machine to the target virtual machine. Using the target data access information, the reference virtual machine filters out third data from its data, identifying data with a probability of data access operations being performed within the target time period that is greater than or equal to a target probability value. This third data is stored in the reference extended memory, and the fourth data (excluding the third data) is stored in the virtual machine's virtual machine memory. By filtering the data, data that may be modified during the data migration process, resulting in dirty data, is stored in the reference extended memory, while data that is not easily accessed is stored in the virtual machine's virtual machine memory, thus avoiding the occupation of data migration resources by dirty data.

[0035] In the embodiment provided in step S206, the reference memory information is used to indicate the data storage location where the data in the reference extended memory is stored, which may include the data representation of the data and the offset of the data corresponding to the data identifier in the reference extended memory.

[0036] Optionally, in this embodiment, the reference extended memory is a memory resource that can be accessed by both the target virtual machine and the reference virtual machine. The reference extended memory may be, but is not limited to, memory resources located in the shared resource pool of the host system, which is used to provide extended resources for the running virtual machine.

[0037] Optionally, in this embodiment, the reference memory information is sent by the reference virtual machine to the target virtual machine after the data migration operation is completed. When the target virtual machine receives the reference memory information, it can determine that the reference virtual machine has been offline in the host system, and subsequent access requests to the reference virtual machine need to be executed by the target virtual machine.

[0038] Optionally, in this embodiment, the reference extended memory is memory configured in the host system for the reference virtual machine to expand the data storage resources of the reference virtual machine. Its original function is to expand the running resources of the virtual machine. This application improves the data migration efficiency without adding extra resources by modifying the function of the reference extended memory.

[0039] In the embodiment provided in step S208, the virtual machine data migration method of this embodiment can be applied to the target virtual machine or the target host running the target virtual machine, and this solution does not limit it.

[0040] As an optional implementation, extracting the target data from the reference extended memory of the reference virtual machine based on the reference memory information includes:

[0041] Determine the reference page identifier of the target data, wherein the reference page identifier is used to indicate the storage page allocated to the target data under the virtual machine system of the target virtual machine, wherein the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages;

[0042] The reference storage location of the reference storage page corresponding to the reference page identifier in the reference extended memory is determined based on the reference memory information, wherein the reference storage page is a storage page in the reference extended memory used to store the target data;

[0043] The target data is obtained by retrieving the reference storage page stored at the reference storage location.

[0044] Optionally, in the embodiments of this application, the reference page identifier may be, but is not limited to, the virtual machine address (i.e., GAP, Guest Physical Address) of the data storage page allocated on the target virtual machine for storing target data. The virtual machine address is "the physical address of the data storage page allocated for storing target data from the perspective of the target virtual machine", that is, the reference page identifier is used to indicate the storage address of the allocated data storage page for storing target data in the virtual machine system of the target virtual machine.

[0045] Optionally, in this embodiment of the application, the memory resources of the virtual machine can be divided according to memory pages, thereby realizing data migration in units of data storage pages.

[0046] By obtaining the reference page identifier of the target data and then using the reference memory information to find the reference storage page in the reference extended memory that corresponds to the reference page identifier, data migration can be achieved in units of data storage pages. This ensures that on the target virtual machine, the required data pages are loaded into memory only when accessed, thus improving data migration efficiency.

[0047] As an optional implementation, the reference virtual machine is deployed on a reference host in the host system, and the target virtual machine is deployed on a target host in the host system. The step of determining the reference storage location of the reference storage page corresponding to the reference page identifier in the reference extended memory based on the reference memory information includes:

[0048] The reference extended memory configured for the reference virtual machine is selected from the shared resource pool included in the host system, wherein the shared resource pool is used to extend storage resources for virtual machines running on the host in the host system;

[0049] Determine the target page identifier corresponding to the reference page identifier, wherein the target page identifier is used to indicate the storage page allocated to the target data under the virtual machine system of the target virtual machine;

[0050] The reference storage location of the reference storage page corresponding to the target page identifier in the reference extended memory is determined based on the reference memory information.

[0051] Optionally, in the embodiments of this application, the target page identifier may be, but is not limited to, the virtual machine address (i.e., GAP, Guest Physical Address) of the data storage page allocated on the reference virtual machine for storing the target data. The virtual machine address is "the physical address of the data storage page allocated for storing the target data from the perspective of the reference virtual machine", that is, the target page identifier is used to indicate the storage address of the allocated data storage page for storing the target data in the virtual machine system of the reference virtual machine.

[0052] Based on the above, the resources in the shared resource pool are extended resources that can be accessed by any virtual machine running on the host system. This application achieves the remapping of the memory resources of the reference extended memory by storing the data to be migrated in the reference extended memory of the reference virtual machine and sending the reference memory information of the reference extended memory to the target virtual machine. This maps the reference extended memory to the target virtual machine, thereby avoiding the large consumption of virtual machine running resources caused by data migration between virtual machines and improving data migration efficiency.

[0053] As an optional implementation, determining the reference storage location of the reference storage page corresponding to the target page identifier in the reference extended memory based on the reference memory information includes:

[0054] The reference offset information corresponding to the target page identifier is determined from the corresponding page identifier and offset information, wherein the reference offset information is used to indicate the offset between the reference storage page and the reference point in the reference extended memory, the reference memory information includes the corresponding page identifier and offset information, and the reference storage location includes the storage location in the reference extended memory indicated by the reference offset information.

[0055] Optionally, in the embodiments of this application, the reference point is a reference point in the reference extended memory used to determine the offset position. The reference point may be, but is not limited to, the memory start position or the memory end position of the reference extended memory.

[0056] As an optional implementation, the step of searching for the target data in the target virtual machine includes:

[0057] Locate the reference page identifier of the target data under the virtual machine system of the target virtual machine, wherein the reference page identifier is used to indicate the page address of the storage page allocated to the target data under the virtual machine system of the target virtual machine, wherein the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages;

[0058] Based on the reference page identifier, locate the target host storage page indicated by the reference page identifier on the target host running the target virtual machine;

[0059] If the target host storage page does not contain stored data, it is determined that the target data is not stored on the target virtual machine.

[0060] Optionally, in this embodiment of the application, by using a reference page identifier to find whether the target host storage page allocated for the target virtual machine stores the target data, the storage status of the target data on the target virtual machine can be accurately and efficiently determined, that is, whether the target data is in a page fault state on the target virtual machine, thereby improving the management efficiency of the target virtual machine for the data it receives.

[0061] As an optional implementation, the step of locating the target host storage page indicated by the reference page identifier on the target host running the target virtual machine according to the reference page identifier includes:

[0062] The target host virtual address corresponding to the reference page identifier is determined from the corresponding page identifier and the host virtual address of the target host;

[0063] The target host physical address corresponding to the target host virtual address is determined from the host virtual address and host physical address of the target host that have a corresponding relationship;

[0064] The storage page indicated by the physical address of the target host among the multiple host storage pages included in the target host is determined as the target host storage page, wherein the host storage page is used to store the data required by the virtual machine running on the host.

[0065] Optionally, in this embodiment, the host virtual address is the location of the data page storing the target data as determined from the perspective of the host running the target virtual machine. The host virtual address may be, but is not limited to, the host's HVA (Host Virtual Address).

[0066] Optionally, in this embodiment of the application, the host physical address is used to indicate the location of the data page of the target data allocated on the host in the host storage space. The host physical address may be, but is not limited to, the host's HPA (Host Physical Address).

[0067] Based on the above, by using corresponding page identifiers and host virtual addresses, as well as corresponding host virtual addresses and host physical addresses for address translation, the actual data storage location allocated on the host running the target virtual machine can be accurately located.

[0068] As an optional implementation, after performing the target access operation on the target data on the target virtual machine, the method further includes:

[0069] Receive a target migration request, wherein the target migration request is used to request the migration of data stored in a target virtual machine to a candidate virtual machine, the target virtual machine running on a target host in a host system, and the candidate virtual machine running on a candidate host in the host system;

[0070] In response to the target migration request, the target memory information of the target virtual machine is obtained, wherein the target memory information is used to indicate the data stored in the target extended memory of the target virtual machine, the target extended memory is the extended memory allocated for the target virtual machine in the shared resource pool of the host system, the shared resource pool is used to extend the storage resources of the virtual machine running on the host in the host system, and the target extended memory is used to extend the data storage resources of the target virtual machine;

[0071] The target memory information is sent to the candidate virtual machine, wherein the candidate virtual machine is used to migrate the first data to the candidate virtual machine through the target memory information and perform the data access operation on the first data when it is first necessary to perform a data access operation on the first data stored in the target extended memory.

[0072] Optionally, in this embodiment, after receiving a target migration request, the target virtual machine can obtain first data access information of the stored data within a first time period prior to the current time. This first data access information indicates the access status of the target virtual machine to the corresponding data within the first time period. Based on the first data access information, the target virtual machine can detect second data access information within a second time period. This second data access information indicates the execution probability of data access operations being performed on the target virtual machine within the second time period, where the second time period is the data migration time period for migrating data from the target virtual machine to a candidate virtual machine. Using the second data access information, a fifth data point is selected from the target virtual machine's data, with the execution probability of data access operations being performed within the second time period greater than or equal to a target probability value. This fifth data point is stored in the target extended memory, and a sixth data point (excluding the fifth data point) is stored in the target virtual machine's virtual machine memory. By filtering the data, data that may be modified during the data migration process, resulting in dirty data, is stored in the target extended memory, while data that is not easily accessed is stored in the virtual machine's virtual machine memory, thus avoiding the occupation of data migration resources by dirty data.

[0073] Based on the above, during the data migration process, the functionality of the extended memory configured for the virtual machine is modified so that the data to be migrated is stored in the extended memory. The migration of data is achieved through the extended memory by remapping the extended memory, which avoids consuming virtual machine running resources during the data migration process and improves the efficiency of virtual machine data migration.

[0074] As an optional implementation, obtaining the target memory information of the target virtual machine includes:

[0075] Obtain the storage flag information for each piece of data stored in the target virtual machine, wherein the storage flag information is used to indicate the storage location of the corresponding data;

[0076] The data stored in the target virtual machine is determined to contain the first data whose storage flag information is the target flag information, wherein the target flag information is used to indicate that the first data is stored in the target extended memory;

[0077] Obtain the target storage location of the first data in the target extended memory, wherein the target memory information includes the target storage location.

[0078] The above describes how data migration can be achieved by remapping the data stored in extended memory. This process does not require virtual machine data migration resources, thus reducing the resource consumption of virtual machines during data migration.

[0079] As an optional implementation, after receiving the target migration request, the method further includes:

[0080] Obtain the second data stored in the memory of the target virtual machine;

[0081] The second data is migrated to the candidate virtual machine memory of the candidate virtual machine through a data transfer thread between the target virtual machine and the candidate virtual machine.

[0082] Optionally, in this embodiment, the target virtual machine memory is the memory resource allocated to the target virtual machine on the host on which it is running.

[0083] Optionally, in this embodiment, the data transmission thread can be, but is not limited to, a multifd multithread built between the target virtual machine and the candidate virtual machine. The target virtual machine performs data compression through the multifd multithread, thereby quickly sending the data to be migrated to the candidate virtual machine.

[0084] As an optional implementation, obtaining the second data stored in the target virtual machine's memory includes:

[0085] Obtain the storage flag information for each piece of data stored in the target virtual machine, wherein the storage flag information is used to indicate the storage location of the corresponding data;

[0086] The second data is determined to be candidate flag information among the data stored in the target virtual machine, wherein the candidate flag information is used to indicate that the second data is stored in the memory of the target virtual machine.

[0087] Optionally, in this embodiment, the storage flag information is used to indicate the storage resources where the data is stored in the virtual machine, including the virtual machine's own virtual machine memory and the extended memory configured for the virtual machine.

[0088] As an optional implementation, performing the target access operation on the target data on the target virtual machine includes:

[0089] Copy the target data to the target storage page allocated for the target data in the target virtual machine;

[0090] The target access operation is performed on the target virtual machine stored on the target storage page through the target virtual machine.

[0091] As an optional implementation, copying the target data to the target storage page allocated for the target data in the virtual machine system of the target virtual machine includes:

[0092] Locate the reference page identifier of the target data under the virtual machine system of the target virtual machine, wherein the reference page identifier is used to indicate the page address of the storage page allocated to the target data under the virtual machine system of the target virtual machine, wherein the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages;

[0093] Based on the reference page identifier, locate the target host storage page indicated by the reference page identifier on the target host running the target virtual machine, wherein the target storage page includes the target host storage page;

[0094] Copy the target data to the target host storage page.

[0095] This application proposes a method for virtual machine memory remapping based on user faults to enable memory super-segmentation in existing virtualization products. In existing solutions, due to the increasing memory specifications of user virtual machines and the growing volume of services within them, a large amount of dirty data accumulates in the virtual machine's memory during migration, making rapid migration difficult and consuming significant network bandwidth, thus impacting the normal operation of other user services. This method configures memory super-segmentation for the virtual machine, storing a large amount of memory data in a swap file. During migration, the virtual machine's memory pages are marked and differentiated, migrating only the data already in memory. Pages swapped out to swap are not transferred; instead, the corresponding GPA (virtual machine physical address) and its offset in swap are sent and stored in the destination QEMU process. Only when the virtual machine actually accesses this memory is a page fault handled by user faults, loading the data from the swap file into memory. Through memory remapping, the amount of memory that needs to be transferred is reduced, enabling rapid virtual machine memory migration.

[0096] The specific implementation process of a method for enabling virtual machine memory remapping with memory over-division based on userfault is as follows:

[0097] I. Source Virtual Machine Memory Migration Phase:

[0098] 1. Configure the virtual machine to overspend memory, storing a large amount of memory data in the swap file.

[0099] 2. During the memory migration traversal phase, before migrating memory, each memory page is searched, and the present (whether it is in memory) and swap (whether it is in swap) flags are set; at the same time, the GPA address corresponding to the memory page and its offset in the swap file are saved.

[0100] 3. The destination creates a virtual machine qemu process, registers the virtual machine's memory range to the kernel space through userfault (that is, registers the virtual machine's memory to the kernel space), and then the source starts migrating data.

[0101] 4. When migrating memory data, distinguish the memory based on the saved present and swap flags:

[0102] a. For memory pages where both the present and swap flags are 0 (i.e., zero pages), a zero page flag is sent directly to the destination without loading the page into memory to check if the data in the memory page is all zeros, thus saving page fault handling time.

[0103] b. For memory pages with present value of 1 and swap value of 0, i.e. memory pages that have not been swapped out, data compression is performed using multifd multithreading (i.e., data transfer thread) to quickly send them to the destination.

[0104] c. For memory pages with the swap flag set to 1, i.e. those memory pages that have been swapped out to swap, no transfer is performed. After the virtual machine memory transfer is completed, the source virtual machine pauses its operation. When transferring vmstate, the saved GPA->SWAP information (i.e., memory information, such as the reference memory information mentioned above) is sent and saved in the destination qemu process.

[0105] 5. The migration ends, the destination virtual machine starts running, and the swap controller thread (i.e., the control process) starts running to poll the registered file descriptors and handle page faults.

[0106] Figure 3 This is a schematic diagram of an optional destination memory access according to an embodiment of this application, such as... Figure 3 As shown, it includes at least the following steps:

[0107] S301, when the guest virtual machine accesses memory, a page fault occurs because the memory has not been loaded, and it exits from the guest to the kvm.

[0108] S302.kvm captures a VM exit, determines the exit reason to be a page fault, translates the GPA (Virtual Machine Address) to the HVA (Host Virtual Address) on the host, and invokes the page fault handling process.

[0109] S303. The kernel determines the page fault address. If the accessed HVA (Host Virtual Address) is located in the memory range registered to userfaultfd, the kernel triggers a userfault.

[0110] S304. The kernel notifies the swap-controller thread (i.e., the control thread) in QEMU through the file descriptor registered by usefaultfd, thus generating a page fault.

[0111] S305 and swap-controller (i.e., control thread) convert HVA into GPA based on the received page fault information, and then query the GPA->SWP mapping (i.e., memory information, such as the reference memory information mentioned above) in memory to find the offset of GPA in the swap file (i.e., the swap file, such as the extended memory mentioned above).

[0112] S306. Based on the found swap offset, copy the page in the swap to the page fault address; subsequent page faults at the same address are handled in kernel mode, and userfault is only responsible for handling the first page fault.

[0113] S307: The swap-controller completes the page fault handling, continues polling, waits for the next page fault handling, and converts the HPA of the page fault address to be written to the target data (i.e., page) into the corresponding HVA.

[0114] S308. Use HVA to convert the corresponding GPA.

[0115] S309. Output the data after the data access operation has been completed to the requester of the data access request.

[0116] The optimization of this application lies in configuring a swap file for each virtual machine in QEMU. This allows the virtual machine to store a large amount of memory data in the swap file. During virtual machine memory migration, memory pages are differentiated, and only memory data that has not been swapped out to the swap file is transferred. For memory pages swapped out to the swap file, their corresponding GPA and offset in the swap file are recorded. After the virtual machine memory migration is completed, the corresponding GPA and swap offset are sent and stored in the destination virtual machine's memory. By reducing the number of memory pages that need to be migrated, fast virtual machine migration is achieved. Furthermore, based on the principle of locality of memory access, only when the destination virtual machine accesses the memory data stored in the swap file is the page fault handling process moved from kernel mode to user mode via user fault, loading the data into memory. This achieves memory remapping without affecting the normal operation of virtual machine services.

[0117] Through the above embodiments, QEMU configures a swap file for each virtual machine, allowing the virtual machine to store a large amount of memory data in the swap file. During virtual machine memory migration, the memory pages of the virtual machine are distinguished, and only the memory data that has not been swapped out to the swap file is transferred. For memory pages swapped out to the swap file, their corresponding GPA and offset in the swap file are recorded. After the virtual machine memory migration is completed, the corresponding GPA and swap offset are sent and stored in the destination virtual machine's memory. By reducing the number of memory pages that need to be migrated and reducing the invalid and repeated transmission of hot memory data, fast virtual machine migration is achieved. At the same time, according to the principle of locality of memory access, only when the destination virtual machine accesses the memory data stored in the swap file, the data is loaded into memory through user fault, moving the page fault handling from kernel mode to user mode, realizing memory remapping without affecting the normal operation of virtual machine services.

[0118] The main steps of the above embodiments are as follows:

[0119] 1. Source virtual machine memory migration stage:

[0120] a. Enable memory over-split in virtual machines, configure a swap file for each virtual machine, and store a large amount of memory data in the swap file.

[0121] b. Obtain the memory page index of the virtual machine, mark and distinguish the memory pages of the virtual machine, and only migrate the data in memory. Determine whether a page is swapped out to swap using the following formula:

[0122] swap_tag = (GPA & (1 << 31)) ? 1: 0.

[0123] c. For memory pages swapped out to swap, no data is transferred; only the corresponding GPA and its offset in swap are sent and stored in the destination QEMU process. These memory pages are only loaded from the swap file into memory when the virtual machine actually accesses them.

[0124] 2. After the migration is complete, the destination virtual machine's memory access phase:

[0125] a. The guest virtual machine accesses the GPA address located in swap, and a page fault occurs because the memory has not been loaded, so it exits from the guest to the kvm.

[0126] b.kvm captures a VM exit, determines the exit reason as a page fault, converts the GPA to an HVA on the host, and invokes the page fault handling process.

[0127] c. The accessed HVA address is located in the memory region registered to userfaultfd, and the kernel triggers a userfault.

[0128] d. The kernel notifies the swap-controller thread in QEMU of the file descriptor registered by usefaultfd, thus generating a page fault.

[0129] Based on the received page fault information, e.swap-controller converts HVA into GPA, then queries the GPA->SWP map in memory to find the offset of GPA in the swap file.

[0130] f. Copy the page from swap to the address where the page fault occurred.

[0131] g. Wake up the PageFault thread, which then returns the data.

[0132] This application relates to the field of data migration technology in cloud computing environments, and particularly to a method for virtual machine memory remapping based on userfault in a QEMU-KVM virtualization environment. Virtual machines with large memory configurations often experience significant delays or failures to complete during memory migration due to the large memory size and the continuous generation of dirty data from internal business operations. This consumes substantial network bandwidth and impacts other business operations. Based on the principle of locality of memory, programs tend to access a small, contiguous memory region during execution. By marking memory and dividing memory pages in the memory and swap file, only unswapped memory pages are transferred, greatly reducing the amount of memory that needs to be transferred and enabling rapid iteration of virtual machine memory migration. For memory pages swapped out to the swap file, they are only loaded into memory via userfaultfd during access, allowing for rapid page fault handling in user space. Through memory remapping, rapid virtual machine migration and business switching are achieved.

[0133] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.

[0134] Embodiments of this application also provide a virtual machine data migration apparatus. Figure 4 This is a structural block diagram of a virtual machine data migration apparatus according to an embodiment of this application, such as... Figure 4 As shown, the device includes:

[0135] A receiving module is used to receive a data access request, wherein the data access request is used to request the execution of a target access operation on target data of a reference virtual machine on a target virtual machine, and the target virtual machine is a virtual machine used to receive data migrated from the reference virtual machine.

[0136] A search module is used to respond to the data access request and search for the target data in the target virtual machine.

[0137] An extraction module is used to extract the target data from the reference extended memory of the reference virtual machine according to reference memory information when the target data is not stored in the target virtual machine. The reference extended memory is used to extend the data storage resources of the reference virtual machine, and the reference memory information is used to indicate the data stored in the reference extended memory. The reference virtual machine is used to store the data to be migrated in the reference extended memory after receiving a migration request to migrate data to the target virtual machine.

[0138] An execution module is used to perform the target access operation on the target data on the target virtual machine.

[0139] Using the above apparatus, the reference virtual machine uses the reference extended resources configured for it to perform data migration. During the data migration process, the reference virtual machine stores the data to be migrated in the reference extended memory. When the target virtual machine needs to perform a target access operation on the target data on the reference virtual machine, it uses the reference memory information to retrieve the corresponding target data from the reference extended memory. This avoids the waste of virtual machine runtime resources caused by directly migrating data through the virtual machine, and also avoids repeated data migration caused by data access during the data migration process of the reference virtual machine. This optimizes the occupation of virtual machine runtime resources. Therefore, it can solve the technical problem of low data migration efficiency between virtual machines in related technologies, and achieve the technical effect of improving the data migration efficiency between virtual machines.

[0140] Optionally, the extraction module includes:

[0141] The first determining unit is used to determine the reference page identifier of the target data, wherein the reference page identifier is used to indicate the storage page allocated to the target data under the virtual machine system of the target virtual machine, wherein the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages;

[0142] The second determining unit is configured to determine, based on the reference memory information, the reference storage location of the reference storage page corresponding to the reference page identifier in the reference extended memory, wherein the reference storage page is a storage page in the reference extended memory used to store the target data;

[0143] The extraction unit is used to extract the reference storage page stored at the reference storage location to obtain the target data.

[0144] Optionally, the reference virtual machine is deployed on a reference host in the host system, and the target virtual machine is deployed on a target host in the host system.

[0145] The second determining unit is used for:

[0146] The reference extended memory configured for the reference virtual machine is selected from the shared resource pool included in the host system, wherein the shared resource pool is used to extend storage resources for virtual machines running on the host in the host system;

[0147] Determine the target page identifier corresponding to the reference page identifier, wherein the target page identifier is used to indicate the storage page allocated to the target data under the virtual machine system of the target virtual machine;

[0148] The reference storage location of the reference storage page corresponding to the target page identifier in the reference extended memory is determined based on the reference memory information.

[0149] Optionally, the second determining unit is used for:

[0150] The reference offset information corresponding to the target page identifier is determined from the corresponding page identifier and offset information, wherein the reference offset information is used to indicate the offset between the reference storage page and the reference point in the reference extended memory, the reference memory information includes the corresponding page identifier and offset information, and the reference storage location includes the storage location in the reference extended memory indicated by the reference offset information.

[0151] Optionally, the search module includes:

[0152] The first lookup unit is used to look up the reference page identifier of the target data under the virtual machine system of the target virtual machine. The reference page identifier is used to indicate the page address of the storage page allocated to the target data under the virtual machine system of the target virtual machine. The virtual machine system divides the data storage resources of the target virtual machine into multiple data storage pages, and different data is stored on different data storage pages.

[0153] The second lookup unit is used to look up the target host storage page indicated by the reference page identifier on the target host running the target virtual machine according to the reference page identifier;

[0154] The third determining unit is used to determine that the target data is not stored on the target virtual machine if the target host storage page contains no stored data.

[0155] Optionally, the second lookup unit is used for:

[0156] The target host virtual address corresponding to the reference page identifier is determined from the corresponding page identifier and the host virtual address of the target host;

[0157] The target host physical address corresponding to the target host virtual address is determined from the host virtual address and host physical address of the target host that have a corresponding relationship;

[0158] The storage page indicated by the physical address of the target host among the multiple host storage pages included in the target host is determined as the target host storage page, wherein the host storage page is used to store the data required by the virtual machine running on the host.

[0159] Optionally, the device further includes:

[0160] A receiving module is configured to receive a target migration request after the target access operation is performed on the target data on the target virtual machine, wherein the target migration request is used to request the migration of data stored in the target virtual machine to a candidate virtual machine, the target virtual machine running on a target host in the host system, and the candidate virtual machine running on a candidate host in the host system;

[0161] The first acquisition module is used to respond to the target migration request and acquire the target memory information of the target virtual machine. The target memory information is used to indicate the data stored in the target extended memory of the target virtual machine. The target extended memory is the extended memory allocated to the target virtual machine in the shared resource pool of the host system. The shared resource pool is used to extend the storage resources of the virtual machine running on the host in the host system. The target extended memory is used to extend the data storage resources of the target virtual machine.

[0162] A sending module is used to send the target memory information to the candidate virtual machine, wherein the candidate virtual machine is used to migrate the first data to the candidate virtual machine through the target memory information and perform the data access operation on the first data when it is first necessary to perform a data access operation on the first data stored in the target extended memory.

[0163] Optionally, the first acquisition module includes:

[0164] The first acquisition unit is used to acquire storage flag information for each piece of data stored in the target virtual machine, wherein the storage flag information is used to indicate the storage location of the corresponding data;

[0165] The fourth determining unit is used to determine the first data in the data stored by the target virtual machine whose storage flag information is the target flag information, wherein the target flag information is used to indicate that the first data is stored in the target extended memory;

[0166] The second acquisition unit is used to acquire the target storage location of the first data in the target extended memory, wherein the target memory information includes the target storage location.

[0167] Optionally, the device further includes:

[0168] The second acquisition module is used to acquire second data stored in the target virtual machine memory of the target virtual machine after receiving the target migration request;

[0169] The migration module is used to migrate the second data to the candidate virtual machine memory of the candidate virtual machine through a data transfer thread between the target virtual machine and the candidate virtual machine.

[0170] Optionally, the second acquisition module includes:

[0171] The third acquisition unit is used to acquire storage flag information for each piece of data stored in the target virtual machine, wherein the storage flag information is used to indicate the storage location of the corresponding data;

[0172] The fifth determining unit is used to determine the second data in the data stored in the target virtual machine where the storage flag information is candidate flag information, wherein the candidate flag information is used to indicate that the second data is stored in the memory of the target virtual machine.

[0173] Optionally, the execution module includes:

[0174] A copying unit is used to copy the target data to the target storage page allocated for the target data in the target virtual machine.

[0175] A storage unit is used to perform the target access operation on the target virtual machine stored on the target storage page through the target virtual machine.

[0176] Optionally, the copying unit is used for:

[0177] Locate the reference page identifier of the target data under the virtual machine system of the target virtual machine, wherein the reference page identifier is used to indicate the page address of the storage page allocated to the target data under the virtual machine system of the target virtual machine, wherein the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages;

[0178] Based on the reference page identifier, locate the target host storage page indicated by the reference page identifier on the target host running the target virtual machine, wherein the target storage page includes the target host storage page;

[0179] Copy the target data to the target host storage page.

[0180] For a description of the features in the embodiment corresponding to the virtual machine data migration device, please refer to the relevant description in the embodiment corresponding to the virtual machine data migration method, which will not be repeated here.

[0181] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above embodiments of the virtual machine data migration method.

[0182] Embodiments of this application also provide a computer-readable storage medium storing a computer program configured to execute the steps in any of the above-described embodiments of the virtual machine data migration method.

[0183] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0184] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described embodiments of the virtual machine data migration method.

[0185] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described virtual machine data migration method embodiments.

[0186] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0187] The present application provides a detailed description of a virtual machine data migration method, apparatus, storage medium, and electronic device. Specific examples have been used to illustrate the principles and implementation methods of the present application. The descriptions of these embodiments are merely illustrative of the method and its core concepts. It should be noted that those skilled in the art can make various improvements and modifications to the present application without departing from its principles, and these improvements and modifications also fall within the scope of protection of the claims.

Claims

1. A method for migrating virtual machine data, characterized in that, include: Receive a data access request, wherein the data access request is used to request to perform a target access operation on target data of a reference virtual machine on a target virtual machine, and the target virtual machine is a virtual machine used to receive data migrated from the reference virtual machine; In response to the data access request, locate the target data in the target virtual machine; If the target data is not stored in the target virtual machine, the target data is extracted from the reference extended memory of the reference virtual machine according to the reference memory information. The reference extended memory is used to extend the running resources of the reference virtual machine, and the reference memory information is used to indicate the data stored in the reference extended memory. The reference virtual machine is used to store the data to be migrated in the reference extended memory after receiving a migration request to migrate data to the target virtual machine. Perform the target access operation on the target data on the target virtual machine; The reference virtual machine, upon receiving a data migration request, detects reference data access information for the stored data within a reference time period prior to the current time. This reference data access information indicates the access status of the corresponding data by the reference virtual machine during the reference time period. Based on this reference data access information, the reference virtual machine detects target data access information within a target time period. This target data access information indicates the probability of data access operations being performed on the reference virtual machine during the target time period, where the target time period is the data migration time period for migrating data from the reference virtual machine to the target virtual machine. Using the target data access information, the reference virtual machine filters out third data from its data, identifying data access operations with a probability greater than or equal to a target probability value during the target time period. This third data is stored in reference extended memory, and a fourth data (excluding the third data) is stored in the virtual machine memory of the reference virtual machine. The reference virtual machine then migrates this fourth data to the target virtual machine via a data migration link with the target virtual machine.

2. The method according to claim 1, characterized in that, The step of extracting the target data from the reference extended memory of the reference virtual machine based on the reference memory information includes: The reference page identifier of the target data is determined, wherein the reference page identifier is used to indicate the storage page allocated to the target data under the virtual machine system of the target virtual machine, and the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages; The reference storage location of the reference storage page corresponding to the reference page identifier in the reference extended memory is determined based on the reference memory information, wherein the reference storage page is a storage page in the reference extended memory used to store the target data; The target data is obtained by retrieving the reference storage page stored at the reference storage location.

3. The method according to claim 2, characterized in that, The reference virtual machine is deployed on a reference host in the host system, and the target virtual machine is deployed on a target host in the host system. Determining the reference storage location of the reference storage page corresponding to the reference page identifier in the reference extended memory based on the reference memory information includes: The reference extended memory configured for the reference virtual machine is selected from the shared resource pool included in the host system, wherein the shared resource pool is used to extend storage resources for virtual machines running on the host in the host system; Determine the target page identifier corresponding to the reference page identifier, wherein the target page identifier is used to indicate the storage page allocated to the target data under the virtual machine system of the reference virtual machine; The reference storage location of the reference storage page corresponding to the target page identifier in the reference extended memory is determined based on the reference memory information.

4. The method according to claim 3, characterized in that, Determining the reference storage location of the reference storage page corresponding to the target page identifier in the reference extended memory based on the reference memory information includes: The reference offset information corresponding to the target page identifier is determined from the corresponding page identifier and offset information, wherein the reference offset information is used to indicate the offset between the reference storage page and the reference point in the reference extended memory, the reference memory information includes the corresponding page identifier and offset information, and the reference storage location includes the storage location in the reference extended memory indicated by the reference offset information.

5. The method according to claim 1, characterized in that, The step of searching for the target data in the target virtual machine includes: Locate the reference page identifier of the target data under the virtual machine system of the target virtual machine, wherein the reference page identifier is used to indicate the page address of the storage page allocated to the target data under the virtual machine system of the target virtual machine, wherein the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages; Based on the reference page identifier, locate the target host storage page indicated by the reference page identifier on the target host running the target virtual machine; If the target host storage page does not contain stored data, it is determined that the target data is not stored on the target virtual machine.

6. The method according to claim 5, characterized in that, The step of locating the target host storage page indicated by the reference page identifier on the target host running the target virtual machine according to the reference page identifier includes: The target host virtual address corresponding to the reference page identifier is determined from the corresponding page identifier and the host virtual address of the target host; The target host physical address corresponding to the target host virtual address is determined from the host virtual address and host physical address of the target host that have a corresponding relationship; The storage page indicated by the physical address of the target host among the multiple host storage pages included in the target host is determined as the target host storage page, wherein the host storage page is used to store the data required by the virtual machine running on the host.

7. The method according to claim 1, characterized in that, After performing the target access operation on the target data on the target virtual machine, the method further includes: Receive a target migration request, wherein the target migration request is used to request the migration of data stored in a target virtual machine to a candidate virtual machine, the target virtual machine running on a target host in a host system, and the candidate virtual machine running on a candidate host in the host system; In response to the target migration request, the target memory information of the target virtual machine is obtained, wherein the target memory information is used to indicate the data stored in the target extended memory of the target virtual machine, the target extended memory is the extended memory allocated for the target virtual machine in the shared resource pool of the host system, the shared resource pool is used to extend the storage resources of the virtual machine running on the host in the host system, and the target extended memory is used to extend the data storage resources of the target virtual machine; The target memory information is sent to the candidate virtual machine, wherein the candidate virtual machine is used to migrate the first data to the candidate virtual machine through the target memory information and perform the data access operation on the first data when it is first necessary to perform a data access operation on the first data stored in the target extended memory.

8. The method according to claim 7, characterized in that, The step of obtaining the target memory information of the target virtual machine includes: Obtain the storage flag information for each piece of data stored in the target virtual machine, wherein the storage flag information is used to indicate the storage location of the corresponding data; The data stored in the target virtual machine is determined to contain the first data whose storage flag information is the target flag information, wherein the target flag information is used to indicate that the first data is stored in the target extended memory; Obtain the target storage location of the first data in the target extended memory, wherein the target memory information includes the target storage location.

9. The method according to claim 7, characterized in that, After receiving the target migration request, the method further includes: Obtain the second data stored in the memory of the target virtual machine; The second data is migrated to the candidate virtual machine memory of the candidate virtual machine through a data transfer thread between the target virtual machine and the candidate virtual machine.

10. The method according to claim 9, characterized in that, The step of obtaining the second data stored in the memory of the target virtual machine includes: Obtain the storage flag information for each piece of data stored in the target virtual machine, wherein the storage flag information is used to indicate the storage location of the corresponding data; The second data is determined to be candidate flag information among the data stored in the target virtual machine, wherein the candidate flag information is used to indicate that the second data is stored in the memory of the target virtual machine.

11. The method according to claim 1, characterized in that, The step of performing the target access operation on the target data on the target virtual machine includes: Copy the target data to the target storage page allocated for the target data in the target virtual machine; The target access operation is performed on the target virtual machine stored on the target storage page through the target virtual machine.

12. The method according to claim 11, characterized in that, The step of copying the target data to the target storage page allocated for the target data in the virtual machine system of the target virtual machine includes: Locate the reference page identifier of the target data under the virtual machine system of the target virtual machine, wherein the reference page identifier is used to indicate the page address of the storage page allocated to the target data under the virtual machine system of the target virtual machine, wherein the data storage resources of the target virtual machine are divided into multiple data storage pages under the virtual machine system, and different data is stored on different data storage pages; Based on the reference page identifier, locate the target host storage page indicated by the reference page identifier on the target host running the target virtual machine, wherein the target storage page includes the target host storage page; Copy the target data to the target host storage page.

13. A virtual machine data migration device, characterized in that, include: A receiving module is used to receive a data access request, wherein the data access request is used to request the execution of a target access operation on target data of a reference virtual machine on a target virtual machine, and the target virtual machine is a virtual machine used to receive data migrated from the reference virtual machine. A search module is used to respond to the data access request and search for the target data in the target virtual machine. An extraction module is used to extract the target data from the reference extended memory of the reference virtual machine according to reference memory information when the target data is not stored in the target virtual machine. The reference extended memory is used to extend the running resources of the reference virtual machine, and the reference memory information is used to indicate the data stored in the reference extended memory. The reference virtual machine is used to store the data to be migrated in the reference extended memory after receiving a migration request to migrate data to the target virtual machine. An execution module is configured to perform the target access operation on the target data on the target virtual machine; The reference virtual machine, upon receiving a data migration request, detects reference data access information for the stored data within a reference time period prior to the current time. This reference data access information indicates the access status of the corresponding data by the reference virtual machine during the reference time period. Based on this reference data access information, the reference virtual machine detects target data access information within a target time period. This target data access information indicates the probability of data access operations being performed on the reference virtual machine during the target time period, where the target time period is the data migration time period for migrating data from the reference virtual machine to the target virtual machine. Using the target data access information, the reference virtual machine filters out third data from its data, identifying data access operations with a probability greater than or equal to a target probability value during the target time period. This third data is stored in reference extended memory, and a fourth data (excluding the third data) is stored in the virtual machine memory of the reference virtual machine. The reference virtual machine then migrates this fourth data to the target virtual machine via a data migration link with the target virtual machine.

14. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the virtual machine data migration method as described in any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the virtual machine data migration method as described in any one of claims 1 to 12.

Citation Information

Patent Citations

  • Virtual machine migration method, device and system, electronic equipment and readable storage medium

    CN117909026A

  • Virtual machine migration method and system, computer equipment and storage medium

    CN119806731A