Method for live migration between containers and virtual machines and electronic device

By using a hot migration method between containers and virtual machines to obtain process identifiers and relationship information, the challenge of migration between containers and virtual machines is solved, achieving efficient process migration and business continuity, and improving user experience.

CN114816660BActive Publication Date: 2025-12-19LENOVO (BEIJING) LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210329371.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2025-12-19
Estimated Expiration
2042-03-30

AI Technical Summary

Technical Problem

There is currently no hot migration solution between containers and virtual machines, which makes it difficult to perform operations such as load balancing or hardware replacement without interrupting business operations.

Method used

A hot migration method between containers and virtual machines is provided. By obtaining the process's identifier and relationship information, as well as its associated resource group, the process can be migrated from the source device to the target device. This includes obtaining the first request, process identifier, relationship information, and resource group, and then restoring the process on the target device.

Benefits of technology

It enables efficient hot migration between containers and virtual machines, reducing downtime during the migration process and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114816660B_ABST
    Figure CN114816660B_ABST
Patent Text Reader

Abstract

The application discloses a method for live migration between a container and a virtual machine and an electronic device. The method comprises the following steps: obtaining a first request, obtaining a first identifier of a first process based on the first request, obtaining first relationship information and a plurality of first resource groups associated with the first relationship information based on the first identifier, and sending the first relationship information and the plurality of first resource groups to a target device. The method not only provides a feasible implementation scheme for live migration between a container and a virtual machine, but also has high migration efficiency, is beneficial to shortening downtime in the live migration process, and improves user experience.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of virtualization, in particular to a hot migration method between a container and a virtual machine and an electronic device. BACKGROUND

[0002] When a virtual machine runs on a physical machine, the physical machine may have uneven resource allocation, causing heavy or light load. In addition, the physical machine has operations such as hardware replacement, software upgrade, network adjustment, fault handling, etc. It is very important to complete these operations without interrupting the business. Virtual machine hot migration technology can complete load balancing or the above operations under the premise of business continuity, improving user experience and work efficiency. Virtual machine hot migration usually saves the running state of the entire virtual machine completely, and can quickly recover to the original or different hardware platform. After the virtual machine is recovered, it can still run smoothly, and the user cannot perceive any difference.

[0003] Under the background of the increasingly wide application of virtualization technology, as a lightweight operating system virtualization form, containers are more and more widely used due to their lightweight, small system resource occupation, easy deployment, high flexibility and other advantages. The demand for hot migration of containers is also increasing. However, under normal circumstances, only virtual machines and virtual machines can be hot migrated, or containers and containers can be hot migrated. At present, there is no solution to realize the hot migration between containers and virtual machines. SUMMARY

[0004] The present application provides a hot migration method between a container and a virtual machine and an electronic device. The technical solutions adopted by the embodiments of the present application are as follows.

[0005] The first aspect of the present application provides a hot migration method between a container and a virtual machine, comprising:

[0006] obtaining a first request, wherein the first request includes a request to migrate a process in a source device to a target device; the source device is a container, and the target device is a virtual machine; or the source device is a virtual machine, and the target device is a container;

[0007] obtaining a first identifier of a first process based on the first request;

[0008] obtaining first relationship information and a plurality of first resource groups associated with the first relationship information based on the first identifier; wherein the first relationship information is used to identify the mapping relationship between the logical address space and the physical address space of the first process, and the first resource group is stored in the physical address space of the first process;

[0009] send the first relationship information and the first resource groups to the target device.

[0010] In some embodiments, the sending the first relationship information and the first resource groups to the target device comprises:

[0011] obtain first hotness information of each of the first resource groups, wherein the first hotness information represents an access frequency of the first resource group;

[0012] determine a target resource group in the first resource groups, whose access frequency is greater than a first threshold value;

[0013] send the first relationship information and the target resource group to the target device.

[0014] In some embodiments, the sending the first relationship information and the first resource groups to the target device further comprises:

[0015] obtain device information of the target device, wherein the device information is used to identify a data processing capability of the target device;

[0016] determine the first threshold value based on the device information.

[0017] In some embodiments, the obtaining the first relationship information and the first resource groups associated with the first relationship information based on the first identifier comprises:

[0018] obtain the first relationship information based on the first identifier, wherein the first relationship information is used to identify a one-to-one mapping relationship between a first logical unit and a first physical unit, the logical address space of the first process comprises a plurality of first logical units, the physical address space of the first process comprises a plurality of first physical units, and the first physical unit is used to store the first resource group;

[0019] obtain the first resource group stored in each of the first physical units based on the first relationship information.

[0020] In some embodiments, the obtaining the first relationship information and the first resource groups associated with the first relationship information based on the first identifier further comprises:

[0021] obtain second relationship information based on the first identifier, wherein the logical address space of the first process comprises a plurality of second logical units, the physical address space of the first process comprises a plurality of second physical units, the second relationship information is used to identify a one-to-one mapping relationship between the second logical unit and the second physical unit, and the second physical unit is used to store a second resource group of the first process;

[0022] obtaining the second resource group stored in each of the second physical units based on the second relationship information;

[0023] obtaining first capacity information used for identifying a capacity of a target physical unit; wherein the target physical unit is a basic component unit of a physical address space of the target device;

[0024] determining the first logical unit, the first physical unit, the first resource group and the first relationship information based on the first capacity information;

[0025] wherein the first logical unit is formed by splitting the second logical unit or by combining a plurality of the second logical units, the first physical unit is formed by splitting the second physical unit or by combining a plurality of the second physical units, and the first resource group is formed by splitting the second resource group or by combining a plurality of the second resource groups.

[0026] In some embodiments, the determining the first logical unit, the first physical unit, the first resource group and the first relationship information based on the first capacity information comprises:

[0027] obtaining second hotness information of the second resource group; wherein the second hotness information represents an access frequency of the second resource group;

[0028] based on the first capacity information and the second hotness information, merging a plurality of the second resource groups with an access frequency difference less than a second threshold value into the first resource group, merging a plurality of the second logical units corresponding to the plurality of the second resource groups into the first logical unit, merging a plurality of the second physical units corresponding to the plurality of the second resource groups into the first physical unit, and generating the first relationship information.

[0029] In some embodiments, the method further comprises:

[0030] obtaining state information of the source device; wherein the state information is used for representing a current running state of the source device;

[0031] sending the state information to the target device before sending the first relationship information and the plurality of the first resource groups to the target device.

[0032] The second aspect of the present application provides a live migration method between a container and a virtual machine, comprising:

[0033] obtaining first relationship information and a plurality of first resource groups; wherein the first relationship information is used for identifying a mapping relationship between a logical address space and a physical address space of a first process in a source device;

[0034] obtain third relationship information based on the first relationship information, wherein the third relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process in the target device; the source device is a container and the target device is a virtual machine; or the source device is a virtual machine and the target device is a container;

[0035] resume running the first process in the target device based on the third relationship information and the plurality of first resource groups.

[0036] The third aspect of the present application provides an electronic device, comprising:

[0037] a first obtaining module configured to obtain a first request, wherein the first request comprises a request for migrating a process in a source device to a target device; the source device is a container and the target device is a virtual machine; or the source device is a virtual machine and the target device is a container;

[0038] a second obtaining module configured to obtain a first identifier of a first process based on the first request;

[0039] a third obtaining module configured to obtain first relationship information and a plurality of first resource groups associated with the first relationship information based on the first identifier, wherein the first relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process, and the first resource groups are stored in the physical address space of the first process;

[0040] a sending module configured to send the first relationship information and the plurality of first resource groups to the target device.

[0041] The fourth aspect of the present application provides an electronic device, comprising:

[0042] a fourth obtaining module configured to obtain first relationship information and a plurality of first resource groups, wherein the first relationship information is used to identify a mapping relationship between a logical address space and a physical address space of a first process in a source device;

[0043] a fifth obtaining module configured to obtain third relationship information based on the first relationship information, wherein the third relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process in a target device; the source device is a container and the target device is a virtual machine; or the source device is a virtual machine and the target device is a container;

[0044] a resuming module configured to resume running the first process in the target device based on the third relationship information and the plurality of first resource groups.

[0045] The hot migration method between the container and the virtual machine of the embodiment of the present application is used for migrating the container to the virtual machine or migrating the virtual machine to the container. The method comprises the following steps: obtaining a first request, the first request comprising a request of migrating a process in a source device to a target device; obtaining a first identifier of the first process based on the first request; obtaining first relationship information based on the first identifier, the first relationship information being used for identifying a mapping relationship between a logical address space and a physical address space of the first process, each first resource group of the first process being stored in the physical address space thereof, and the first relationship information being capable of being used for obtaining a plurality of first resource groups; and sending the first relationship information and the plurality of first resource groups to the target device, so that the target device is capable of restoring the first process on the target device based on the first relationship information and the plurality of first resource groups. The hot migration method between the container and the virtual machine not only provides a feasible implementation scheme, but also has high migration efficiency and is beneficial to shortening the downtime in the hot migration process, so as to improve the user experience. BRIEF DESCRIPTION OF DRAWINGS

[0046] Figure 1 The flowchart of the hot migration method between the container and the virtual machine of the first embodiment of the present application is shown in the figure.

[0047] Figure 2 The flowchart of one embodiment of step S130 is shown in the figure.

[0048] Figure 3 The flowchart of another embodiment of step S130 is shown in the figure.

[0049] Figure 4 The flowchart of one embodiment of step S140 is shown in the figure.

[0050] Figure 5 The flowchart of another embodiment of step S140 is shown in the figure.

[0051] Figure 6 The flowchart of the hot migration method between the container and the virtual machine of the second embodiment of the present application is shown in the figure.

[0052] Figure 7 The flowchart of the hot migration method between the container and the virtual machine of the third embodiment of the present application is shown in the figure.

[0053] Figure 8 The scenario diagram of the hot migration method between the container and the virtual machine of the third embodiment of the present application is shown in the figure.

[0054] Figure 9 The structural block diagram of the electronic device of the fourth embodiment of the present application is shown in the figure.

[0055] Figure 10 The structural block diagram of the electronic device of the fifth embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0056] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0057] It is to be understood that various modifications can be made to the embodiments described herein. Thus, the description is not to be considered as limiting, but merely as a description of exemplary embodiments. Other modifications of the application will occur to those skilled in the art upon reading the present application.

[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the present application and, together with the general description of the application given above, and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0059] These and other characteristics of the present application will become apparent upon consideration of the following detailed description of preferred forms of the application, given by way of non-limiting example, with reference to the accompanying drawings.

[0060] It is also to be understood that even though a number of forms of the application have been described herein, it is within the scope of the appended claims to make and use many other forms of the application which will become apparent to those skilled in the art.

[0061] The above and other aspects, features, and advantages of the present application will become apparent upon consideration of the following detailed description of preferred forms of the present application, given by way of non-limiting example, with reference to the accompanying drawings.

[0062] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it will be understood that the application is not limited to the embodiments specifically disclosed, and that the application can be practiced in a variety of ways. Well-known and / or repetitive functions and structures are not described in detail to avoid obscuring the application unnecessarily. Therefore, specific structural and functional details disclosed herein are not to be interpreted in a limiting manner, but merely as a basis for the claims and as a representative basis for teaching one skilled in the art to employ the present application in virtually any appropriate detailed structure.

[0063] The specification can use phrases such as "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," which can refer to one or more embodiments of the application under the same or different embodiments.

[0064] The embodiments of the present application provide a method for live migration between a container and a virtual machine, comprising:

[0065] A first request is obtained, wherein the first request comprises a request for migrating a process in a source device to a target device; the source device is a container, and the target device is a virtual machine, or the source device is a virtual machine, and the target device is a container;

[0066] obtain a first identifier of the first process based on the first request;

[0067] obtain first relationship information and a plurality of first resource groups associated with the first relationship information based on the first identifier, wherein the first relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process, and the first resource groups are stored in the physical address space of the first process;

[0068] send the first relationship information and the plurality of first resource groups to the target device.

[0069] The container and virtual machine hot migration method provided by the embodiments of the present application is used to migrate a container to a virtual machine or migrate a virtual machine to a container. By obtaining a first request, the first request includes a request to migrate a process in a source device to a target device, obtaining a first identifier of the first process based on the first request, obtaining first relationship information based on the first identifier, the first relationship information being used to identify a mapping relationship between a logical address space and a physical address space of the first process, a plurality of first resource groups of the first process being stored in the physical address space of the first process, a plurality of first resource groups being able to be obtained based on the first relationship information, and sending the first relationship information and the plurality of first resource groups to the target device, so that the target device is able to restore the first process on the target device based on the first relationship information and the plurality of first resource groups. The container and virtual machine hot migration method not only provides a feasible implementation scheme for hot migration between a container and a virtual machine, but also has high migration efficiency and is beneficial to shorten the downtime in the hot migration process, thereby improving user experience.

[0070] The steps and principles of the container and virtual machine hot migration method of the embodiments of the present application will be described in detail below in combination with the accompanying drawings and specific embodiments.

[0071] The first embodiment of the present application provides a container and virtual machine hot migration method, which is applied to a source device. Referring to Figure 1 The container and virtual machine hot migration method of the first embodiment of the present application can specifically include the following steps.

[0072] S110, obtaining a first request, wherein the first request includes a request to migrate a process in a source device to a target device.

[0073] Optionally, the source device can be a container, and the target device can be a virtual machine. Alternatively, the source device can be a virtual machine, and the target device can be a container. That is, the method can be used to migrate a process in a container to a virtual machine, or to migrate a process in a virtual machine to a container. Optionally, the source device can run on a first physical machine, and the target device can run on a second physical machine. The first physical machine and the second physical machine can be a single server, a distributed cluster system composed of multiple servers, or other types of electronic devices.

[0074] Optionally, the source device can obtain the first request from a terminal used by an administrator. For example, during the management of the distributed cluster system, if the administrator determines that the first physical machine needs to be replaced, upgraded, debugged, or handled, the administrator can send a first request to the source device through the terminal to request migration of the process on the source device to the target device.

[0075] Optionally, the source device can also obtain the first request from, for example, a control device. For example, the distributed cluster system or the cloud service platform can have a control device. When the workload of one physical machine is large, or in consideration of reducing the overall power consumption of the distributed cluster system, the control device can automatically send a first request to one physical machine in the system based on a load balancing rule or a power consumption control rule to request migration of the source device on the physical machine to another physical machine.

[0076] Optionally, the first request can include a request to migrate the process in the source device to the target device, and can also include other information, for example, the first request can also include address information of a second physical machine on which the target device runs, and / or an instruction to establish a communication connection between the source device and the target device, and the like.

[0077] S120, based on the first request, obtaining a first identifier of the first process.

[0078] Optionally, the first process is a process running on the source device. It can be understood that the process running on the source device can include a process in a running state, a process in a ready state, and a process in a blocked state.

[0079] Optionally, upon obtaining the first request, the source device can determine the first process running on the source device based on the first request, and obtain a first identifier of the first process. The first identifier can include information capable of uniquely identifying the first process, for example, the first identifier can include a process number (PID).

[0080] Taking the source device as a virtual machine as an example, the virtual machine itself has an operating system, and the operating system usually has a task manager or a process manager. In the case of obtaining the first request, the process manager can be called based on the first request, the first process running on the virtual machine is determined through the process manager, and the PIDs of the first processes are obtained.

[0081] Taking the source device as a container as an example, the processes, child processes and threads of the container and the workloads belonging to the container can be recursively collected under the / proc / $pid / task directory of the source device to determine the first process running on the source device and obtain the first identifier of the first process.

[0082] Optionally, based on obtaining the first identifier of the first process, the first process on the source device can also be frozen. Taking the source device as a container as an example, based on recursively collecting the container and the first processes in the container from the / proc / $pid / task directory of the source device, the first processes can also be frozen by calling the ptrace() function and assigning the ptrace_interrupt instruction. Taking the source device as a container as an example, a group of first processes can also be frozen in batches through the freezer subsystem of the Cgroup in the kernel of the first physical machine. Taking the source device as a virtual machine as an example, the first processes can also be frozen through the task manager or the process manager.

[0083] S130, based on the first identifier, obtaining first relationship information and a plurality of first resource groups associated with the first relationship information. The first relationship information is used to identify the mapping relationship between the logical address space and the physical address space of the first process, and the first resource groups are stored in the physical address space of the first process.

[0084] Optionally, the first physical machine can allocate address spaces for the first processes in the source device based on corresponding logical units and physical units. The logical unit is a basic component unit of the logical address space, and the physical unit is a basic component unit of the physical address space. When the first process needs memory space, the first physical machine can allocate a logical unit and a corresponding physical unit to the first process. The capacity of the logical unit and the physical unit is the same, and the logical unit is mapped to the physical unit. The mapping relationship between the logical unit and the physical unit can be recorded through, for example, the first relationship information. The physical unit is used to actually store the resources of the first process, and the resources in each physical unit form a first resource group. When a logical unit and a physical unit are used up, the first physical machine can allocate another logical unit and another physical unit to the first process.

[0085] For example, the first physical machine can allocate address spaces for processes in the source device based on a paging storage management manner, the first physical machine can take a page as a basic unit of a logical address space and a block as a basic unit of a physical address space, the first physical machine can allocate a logical address space for the first process in units of pages and allocate a physical address space for the first process in units of blocks, and a mapping relationship between the logical address space and the physical address space can be recorded by a page table, and resources stored in each block can constitute a first resource group. Similarly, the second physical machine can also allocate address spaces for processes in the target device based on the paging storage management manner.

[0086] Optionally, in a case where the first identifier is acquired, first relationship information of the first process can be acquired based on the first identifier, and the first relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process. Optionally, the first relationship information can be used to identify a mapping relationship between each logical unit and each physical unit, and a physical address range of each physical unit of the first process can be determined. In a case where the source device is a container, the container does not have an operating system itself, and the container directly runs on an operating system of a physical machine, and the physical address range of the physical unit is a physical address range of the first physical machine. In a case where the source device is a virtual machine, the virtual machine has an operating system itself, and the virtual machine runs on a virtual machine manager of a physical machine, and the physical address range is not an address range constituted by a physical address of the physical machine, but an address range constituted by a virtual machine physical address. A virtual machine physical address (GPA) needs to be converted into a physical machine virtual machine address (HVA) and then into a physical machine physical address (HPA) by the virtual machine manager.

[0087] Optionally, in a case where a physical address range of a physical address space of the first process is determined, the first resource group stored in the physical address space can be acquired based on the physical address range. For example, in a case where a physical address range of each physical unit of the first process is determined, the first resource group can be acquired from each physical unit based on the physical address range.

[0088] S140, the first relationship information and the plurality of first resource groups are sent to the target device.

[0089] Optionally, a communication path can be constructed between the source device and the target device, the first relationship information and the plurality of first resource groups are sent to the target device based on the communication path between the source device and the target device, and each first process is restored on the target device based on the first relationship information and the plurality of first resource groups, so as to achieve the purpose of migrating processes in the source device to the target device.

[0090] Optionally, a communication path can be established between the first physical machine and the second physical machine, and the first relationship information and the plurality of first resource groups can be sent to the target device based on the communication path between the first physical machine and the second physical machine.

[0091] In a specific implementation, a communication path can be established between the source device and the target device, and another communication path can be established between the first physical machine and the second physical machine, and different data can be transmitted through the two communication paths respectively.

[0092] The hot migration method between the container and the virtual machine in the embodiment of the application is used for migrating the container to the virtual machine or migrating the virtual machine to the container. The method comprises the following steps: obtaining a first request, the first request comprising a request for migrating a process in a source device to a target device; obtaining a first identifier of the first process based on the first request; obtaining first relationship information based on the first identifier, the first relationship information being used for identifying a mapping relationship between a logical address space of the first process and a physical address space of the first process; obtaining a plurality of first resource groups in which the first process is stored in the physical address space of the first process based on the first relationship information; and sending the first relationship information and the plurality of first resource groups to the target device, so that the target device can restore the first process on the target device based on the first relationship information and the plurality of first resource groups. The method not only provides a feasible implementation scheme for the hot migration between the container and the virtual machine, but also has high migration efficiency and is beneficial to shortening the downtime in the hot migration process and improving user experience.

[0093] Cooperation Figure 2 In some embodiments, as shown in FIG. 1, step S130 of obtaining the first relationship information and the plurality of first resource groups associated with the first relationship information based on the first identifier can comprise the following steps.

[0094] S131, obtaining the first relationship information based on the first identifier.

[0095] Optionally, the first logical unit can be used as a basic component unit of the source device for allocating the logical address space of the first process, the first physical unit can be used as a basic component unit of the source device for allocating the physical address space of the first process, the first logical unit and the first physical unit have the same capacity, and the first logical unit and the first physical unit can each have a continuous address range. The logical address space of the first process can be composed of a plurality of first logical units, the physical address space of the first process can be composed of a plurality of first physical units, and the first relationship information can be used for identifying a one-to-one mapping relationship between the first logical unit and the first physical unit. The first relationship information can be used as a component part of the process information of the first process. In the case where the first identifier identifying the first process is obtained, the first relationship information can be obtained based on the first identifier.

[0096] Optionally, the first physical machine can allocate an address space for the first process in the source device based on a paging management mode. In this way, the logical address space of the first process can include a plurality of huge pages, and the physical address space of the first process can include a plurality of blocks or page frames corresponding to the huge pages. The one-to-one mapping relationship between the huge pages and the page frames can be recorded through a page table. On this basis, the page table of the first process can be obtained based on the PID of the first process.

[0097] S132, based on the first relationship information, obtaining the first resource group stored in each of the first physical units.

[0098] Optionally, the first resource group stored in each block can be obtained based on the physical address range of each block recorded in the page table. In the case of allocating a logical address space and a physical address space for the first process based on logical units and physical units, various resources and data required by the first process are stored in each physical unit, and the various resources and data of the first process are stored in a more orderly and standardized manner. When the first process needs to be migrated, the physical address range of each first physical unit can be determined based on the first relationship information, and the first resource group can be obtained from the first physical unit based on the physical address range of the first physical unit, so that the various resources and data required by the first process can be obtained.

[0099] In this way, the process tree of the first process does not need to be retrieved through, for example, a parasite, and the efficiency of obtaining the various resources and data required by the first process can be significantly improved, thereby significantly shortening the downtime of hot migration and improving user experience.

[0100] Cooperation Figure 3 As shown, in some embodiments, step S130, based on the first identifier, obtaining the first relationship information and a plurality of first resource groups associated with the first relationship information, can further include the following steps.

[0101] S133, based on the first identifier, obtaining second relationship information, wherein the logical address space of the first process includes a plurality of second logical units, the physical address space of the first process includes a plurality of second physical units, the second relationship information contains a one-to-one mapping relationship between the second logical units and the second physical units, and the second physical units are used to store the second resource group of the first process.

[0102] S134, based on the second relationship information, obtaining the second resource group stored in each of the second physical units.

[0103] S135, obtaining first capacity information used to identify the capacity of a target physical unit; wherein the target physical unit is a basic component unit of the physical address space of the target device;

[0104] S136, determine the first logical unit, the first physical unit, the first resource group and the first relationship information based on the first capacity information; wherein the first logical unit is formed by splitting the second logical unit or by combining a plurality of the second logical units, the first physical unit is formed by splitting the second physical unit or by combining a plurality of the second physical units, and the first resource group is formed by splitting the second resource group or by combining a plurality of the second resource groups.

[0105] Optionally, in response to the first request, a first communication path can be established between the source device and the target device, and the source device can acquire the first capacity information of the target device based on the first communication path, the first capacity information being used to identify the capacity of a target physical unit of the target device, the target physical unit being a basic component unit of a physical address space of the target device.

[0106] In the initial state, the source device can allocate a logical address space and a physical address space for the first process based on the second logical unit and the second physical unit. That is, in the initial state, the logical address space of the first process can take the second logical unit as a basic component unit, and the physical address space of the first process can take the second physical unit as a basic component unit. Therefore, based on the first identification, the second relationship information capable of representing the one-to-one mapping relationship between the second logical unit and the second physical unit can be acquired. Based on the second relationship information, each second resource group in the second physical unit can be determined.

[0107] Optionally, in the case where the capacity of the second physical unit is less than the capacity of the target physical unit, a plurality of second logical units can be combined into a first logical unit, a plurality of second physical units can be combined into a first physical unit, and a plurality of second resource groups can be combined into a first resource group. Then, based on the second relationship table, the combination relationship of the plurality of second logical address units, the combination relationship of the plurality of second physical units, the first relationship information is generated.

[0108] In the case where the capacity of the second physical unit is greater than the capacity of the target physical unit, the second logical unit can be split into a plurality of first physical units, the second physical unit can be split into a plurality of first physical units, and the second resource group can be split into a plurality of first resource groups. Based on the second relationship information, the splitting manner of the second logical unit and the splitting manner of the second physical unit, the second relationship information is generated.

[0109] The capacity of the first logical unit and the first physical unit can be the same as the capacity of the target physical unit. In this way, the first resource groups and the first relationship information are sent to the target device, and the target device can directly store each first resource group in each target storage unit and directly map each first logical unit to a target storage unit without modifying the structure of the logical address space or even the offset relationship of the logical address space, which is beneficial to shorten the recovery time of the first process on the target device and further beneficial to shorten the downtime of the hot migration.

[0110] In some embodiments, the step S136 of determining the first logical unit, the first physical unit, the first resource group and the first relationship information based on the first capacity information can include the following steps.

[0111] Obtaining second hotness information of the second resource groups; wherein the second hotness information represents the access frequency of the second resource groups.

[0112] Based on the first capacity information and the second hotness information, merging a plurality of second resource groups with an access frequency difference less than a second threshold into the first resource group, merging a plurality of second logical units corresponding to the second resource groups into the first logical unit, merging a plurality of second physical units corresponding to the second resource groups into the first physical unit, and generating the first relationship information.

[0113] That is, when merging the second resource groups into the first resource groups, the second resource groups with close access frequencies can be merged into one first resource group. For example, a plurality of second resource groups with high access frequencies are merged into a first resource group, and a plurality of second resource groups with low access frequencies are merged into a first resource group. Correspondingly, a plurality of second physical units storing the second resource groups are merged into the first physical unit, a plurality of second logical units corresponding to the second physical units are merged into the first logical unit, and the first relationship information is generated based on the merging relationship. The first resource groups with high access frequencies can be sent to the target device first, and then the first resource groups with low access frequencies can be sent to the target device, or the first resource groups with low access frequencies can be sent to the target device as hard disk data. In this way, on the basis of ensuring that the first process can normally run, the data migration amount in the initial stage of the hot migration can be reduced, which is beneficial to reduce the downtime.

[0114] Cooperation Figure 4 In some embodiments, the step S140 of sending the first relationship information and the plurality of first resource groups to the target device can include the following steps.

[0115] S141, obtaining first hotness information of each first resource group; wherein the first hotness information represents the access frequency of the first resource group.

[0116] S142, determining a target resource group with an access frequency greater than a first threshold value from the plurality of first resource groups.

[0117] S143, sending the first relationship information and the target resource group to the target device.

[0118] Optionally, taking an example of a first physical machine allocating an address space for a first process in a source device based on a paging storage management mode, the access frequencies of each page and block can be recorded in a page table, and the access frequencies of each page or block can be obtained as the access frequencies of the first resource group stored in the block.

[0119] Optionally, the first threshold value can be set in advance. When the access frequency of the first resource group is greater than the first threshold value, it indicates that the first process will frequently access the resources contained in the first resource group during the running process. If the first resource group is not migrated to the target device in the early stage of live migration, it is easy to cause the first process to run errors, which will significantly affect the user experience. Therefore, the first resource with the access frequency greater than the first threshold value can be taken as the target resource group. When the access frequency of the first resource group is less than the first threshold value, it indicates that the first process does not frequently access the resources contained in the first resource group during the running process. If the first resource group is not migrated to the target device in the early stage of live migration, it is not easy to cause the first process to fail.

[0120] Optionally, a second communication path can be constructed between the first physical machine and the second physical machine. The second communication path can be used as a high-speed path and can have a higher data transmission rate. The target resource group can be sent to the second physical machine through the second communication path, and mapped to the target device through the second physical machine, so that the target device can restore the first process based on the first relationship information and the target resource group. The timeliness requirement of the first resource group with the access frequency less than the first threshold value is lower, and this part of the first resource group can be sent to the target device as hard disk data to reduce the data migration amount in the early stage of live migration and improve the live migration efficiency.

[0121] Cooperation Figure 5 As shown in some embodiments, step S140 of sending the first relationship information and the plurality of first resource groups to the target device can further include the following steps.

[0122] S144, obtaining device information of the target device; wherein the device information is used to identify the data processing capability of the target device.

[0123] S145, determining the first threshold value based on the device information.

[0124] Optionally, the data processing capability of the target device can be identified by, for example, the occupancy rate of the processor of the target device, the frequency of the processor, the occupancy rate of the memory, the total capacity of the memory space, and the like. That is, the device information can include, for example, the occupancy rate of the processor, the frequency of the processor, the occupancy rate of the memory, the total capacity of the memory space, and the like.

[0125] Optionally, in response to the first request, a first communication path can be constructed between the source device and the target device, which can be a lightweight communication path for transmitting data with a relatively small amount of data. The source device can obtain the device information of the target device based on the first communication path. Based on the obtained device information of the target device, the first threshold can be determined based on the device information.

[0126] For example, in the case where the source device is a container and the target device is a virtual machine, the processing capability of the virtual machine is usually strong, and the memory space capacity is usually sufficient. At this time, the first threshold can be set to be small, so that as many resources as possible can be sent to the target device in the early stage of live migration, and the failure of the first process in the running process of the target device can be avoided. In the case where the source device is a virtual machine and the target device is a container, the processing capability of the container is usually relatively weak, and the memory space capacity is usually relatively small. At this time, the first threshold can be set to be large, so that the congestion of the container caused by a large amount of data migration can be avoided, and the smoothness of the running of the container can be ensured on the basis of meeting the normal running of the first process.

[0127] In some embodiments, the method can further include the following steps:

[0128] obtaining state information of the source device; wherein the state information is used to represent the current running state of the source device;

[0129] Before sending the first relationship information and the plurality of first resource groups to the target device, the state information is sent to the target device.

[0130] Optionally, the state information of the source device can be used to represent the current running state of the processor of the source device, the current running state of the memory, and / or the current running state of other hardware, such as the current occupancy rate of the processor of the source device, the current occupancy rate of the memory, the usage of the network card, and the like.

[0131] Optionally, the plurality of first relationship information and the plurality of first resource groups can be migrated to the target device first, and when the migration of the first resource groups is completed or substantially completed, the running of the source device is paused, and the state information is sent to the target device, so that the target device starts running based on the state information.

[0132] Optionally, the state information can be sent to the target device before the first relationship information and the plurality of first resource groups are sent to the target device. The target device can configure its running state such as CPU state, memory state and the like based on the state information, and then start running. Then, the first relationship information and the plurality of first resource groups are quickly migrated to the target device, which is beneficial to shorten the hot migration time and improve the hot migration efficiency.

[0133] Referring to Figure 6 As shown in the figure, the second embodiment of the present application provides a hot migration method between a container and a virtual machine, applied to a target device. The hot migration method between the container and the virtual machine of the second embodiment of the present application can specifically include the following steps.

[0134] In S210, first relationship information and a plurality of first resource groups are acquired. The first relationship information includes the mapping relationship between the logical address space and the physical address space of a first process in a source device.

[0135] Optionally, the source device can be a container, and the target device can be a virtual machine correspondingly. Alternatively, the source device can be a virtual machine, and the target device can be a container correspondingly. That is, the method can be used to migrate a process in the container to the virtual machine, or can be used to migrate a process in the virtual machine to the container. Optionally, the source device can run on a first physical machine, and the target device can run on a second physical machine. The first physical machine and the second physical machine can be a single server, a distributed cluster system composed of a plurality of servers or other types of electronic devices.

[0136] Optionally, the target device can acquire the first relationship information and the plurality of first resource groups based on a first communication channel between the target device and the source device, or can acquire the first relationship information based on the first communication channel and acquire the plurality of first resource groups based on a second communication channel between the first physical machine and the second physical machine.

[0137] For example, the target device can acquire the first relationship information from the source device through the first communication channel, determine a first target physical space based on the first relationship information, and then determine whether the first target physical space is occupied. In the case that the first target physical space is not occupied, the target device can acquire the plurality of first resource groups through the second communication channel and store the plurality of first resource groups in the first target physical space. In the case that the first target physical space is occupied, a second target physical space that is not occupied can be determined, for example, by avoiding the occupied physical space through the way of increasing the offset, acquiring the plurality of first resource groups through the second communication channel and storing the plurality of first resource groups in the second target physical space.

[0138] Optionally, the second physical machine can allocate logical address space and physical address space for the target device based on logical units and physical units, the logical units being basic constituent units of the logical address space, and the physical units being basic constituent units of the physical address space. The capacity of the physical units of the target device can be greater than, equal to, or less than the capacity of the physical units of the source device. Accordingly, after obtaining the plurality of first resource groups, the plurality of first resource groups can be stored one by one in the respective physical units of the target device, or the plurality of first resource groups can be stored in one physical unit of the target device, or one first resource group can be stored in a plurality of physical units of the target device.

[0139] Optionally, the second physical machine can allocate logical address space and physical address space for the target device based on third logical units and third physical units, the third logical units being basic constituent units of the logical address space, and the third physical units being basic constituent units of the physical address space. The capacity of the third logical units and the third physical units can be the same as the capacity of the first physical address units. After the target device obtains the plurality of first resource groups, the plurality of first resource groups can be stored one by one in the plurality of third physical units without splitting or recombining the first resource groups, which is conducive to quickly resuming the running of the first process.

[0140] S220, obtaining third relationship information based on the first relationship information, wherein the third relationship information is used to represent the mapping relationship between the logical address space and the physical address space of the first process in the target device.

[0141] Optionally, when storing the respective first resource groups in the physical address space of the target device, the physical address of the physical machine can be recorded to replace the physical address range in each first resource group in the first relationship information. In the case where the target device is a virtual machine, the physical machine address (HPA) needs to be converted into a physical machine virtual address (HVA) by a virtual machine manager, and then the physical machine virtual address (HVA) needs to be converted into a virtual machine physical address (GPA), and the virtual machine physical address (GPA) needs to be converted into a virtual machine virtual address (GVA) that can be recognized by the virtual machine by the virtual machine, to form the third relationship information. The third relationship information records the mapping relationship between the logical address space and the physical address space of the first process in the virtual machine. In the case where the target device is a container, since the container directly runs on the second physical machine, it is only necessary to convert the physical address into a virtual address to map each first resource group to the container, and the container can access each first resource group based on the virtual machine address.

[0142] S230, resuming the running of the first process in the target device based on the third relationship information and the plurality of first resource groups.

[0143] Optionally, the target device has actually determined the storage locations of various resources required by the first process and the calling relationship of the first process after obtaining the third relationship information and the plurality of first resource groups. On this basis, the running of the first process in the target device can be restored based on the third relationship information and the plurality of first resource groups. Taking the target device as a virtual machine as an example, the process tree of the first process can be reconstructed by calling the fork() function, and the first process can be allocated to the original PID by using the namespace of clone3() or / proc / sys / kernel / ns_last_pid, and then the running of the first process in the target device is restored.

[0144] The container and virtual machine hot migration method of the embodiments of the present application is used to migrate a container to a virtual machine or migrate a virtual machine to a container, obtain first relationship information and a plurality of first resource groups, the first relationship information includes the mapping relationship between the logical address space and the physical address space of the first process in the source device, obtain third relationship information based on the first relationship information, the third relationship information can represent the mapping relationship between the logical address space and the physical address space of the first process in the target device, and the first process can be restored to run in the target device based on the third relationship and the plurality of first resource groups. Not only does this provide a feasible implementation scheme for hot migration between containers and virtual machines, but also has high migration efficiency and is beneficial to shorten the downtime during hot migration to improve user experience.

[0145] The third embodiment of the present application provides a container and virtual machine hot migration method, which is applied to a system including a first physical machine and a second physical machine, for example, the method is applied to a distributed cluster system, and the first physical machine and the second physical machine can serve as a physical machine in the distributed cluster system. The source device runs on the first physical machine, and the target device runs on the second physical machine.

[0146] Referring to Figure 7 and Figure 8 The container and virtual machine hot migration method of the third embodiment of the present application can specifically include the following steps.

[0147] S301, obtaining a first request, wherein the first request includes a request for migrating a process in a source device to a target device.

[0148] Optionally, the source device can be a container, and the target device can be a virtual machine; or the source device can be a virtual machine, and the target device can be a container. Taking the source device as a container and the target device as a virtual machine as an example, a migration control unit can be arranged in the container, and the container can receive the first request through the migration control unit, such as receiving the first request from a control device in the system.

[0149] S302, acquire a first identifier of a first process based on the first request.

[0150] Optionally, the source device, upon acquiring the first request, can determine the first process running on the single-sign source device based on the first request, and acquire the first identifier of the first process. For example, the process number (PID) of the first process can be acquired.

[0151] Taking the source device as a virtual machine as an example, the virtual machine itself has an operating system, and the operating system usually has a task manager or a process manager. Upon acquiring the first request, the process manager can be called based on the first request, the first process running on the virtual machine is determined through the process manager, and the PIDs of the first processes are acquired.

[0152] Taking the source device as a container as an example, the processes, child processes and threads of the container and the workloads belonging to the container can be recursively collected under the / proc / $pid / task directory of the source device to determine the first process running on the source device, and the first identifier of the first process is acquired.

[0153] S303, acquire first relationship information and a plurality of first resource groups associated with the first relationship information based on the first identifier. The first relationship information is used to identify the mapping relationship between the logical address space and the physical address space of the first process in the source device, and the first resource groups are stored in the physical address space of the first process.

[0154] Optionally, the first physical machine can allocate address spaces for the processes in the source device based on a paging management mode. The first physical machine can take the first large page as the basic unit of the logical address space and take the first physical block as the basic unit of the physical space. The logical address space of the first process on the source device includes a plurality of first large pages, and the physical address space of the first process on the source device can include a plurality of first physical blocks. Each first physical block can store a second resource group, and the one-to-one mapping relationship between the first large page and the first physical block can be recorded through the first page table. That is, the second relationship information can be recorded in the page table. Upon acquiring the first identifier, the source device can find the first page table of the first process based on the first identifier. For example, the first page table of the first process can be found based on the PID.

[0155] Optionally, a first communication path can be established between the migration control unit of the source device and the migration control unit of the target device, and the source device can obtain device information from the target device based on the first communication path, wherein the device information can include first capacity information, and the first capacity information is used to identify the capacity of the basic component unit of the physical space of the target device. For example, the second physical machine can take the second large page as the basic component unit of the logical address space and take the second physical block as the basic component unit of the physical space. The first capacity information can be used to identify the capacity of the second large page and the capacity of the second physical block.

[0156] Optionally, after the migration control unit in the source device obtains the first capacity information, the migration control unit can send the first capacity information to the memory management unit at the bottom layer of the first physical machine. If it is determined that the capacities of the first large page and the second large page are different, the memory management unit can perform splitting or merging operations on the first large page based on the first capacity information to form a third large page with the same capacity as the second large page.

[0157] Taking the source device as a container and the target device as a virtual machine as an example, compared with the container, the system resources of the virtual machine are usually more abundant, and the capacities of the second large page and the second physical block can be greater than the capacities of the first large page and the first physical block. On this basis, the memory management unit can perform merging operations on the first large page, the first physical block, and the second resource group to merge multiple first large pages into one third large page, multiple first physical blocks into one third physical block, and multiple second resource groups into one first resource group, and generate first relationship information based on the second interest information. The third large page has the same capacity as the second large page, the third physical block has the same capacity as the second physical block, and the first relationship information can record the one-to-one mapping relationship between the third large page and the third physical block.

[0158] S304, sending the first relationship information and the plurality of first resource groups to the target device.

[0159] Optionally, a second communication path can be established between the memory management unit of the source device and the memory management unit of the target device, and the second communication path can be used as a high-speed communication path for transmitting memory data. The memory management unit of the source device can send the first relationship information and the plurality of first resource groups to the target device based on the second communication path. Correspondingly, the memory management unit of the target device side receives the first relationship information and the plurality of first resource groups. Since the capacities of the second physical block and the third physical block are the same, each second physical block can store exactly one unit of the first resource group. The memory management unit of the target device can store the plurality of first resource groups in the plurality of second physical blocks one by one after obtaining the plurality of first resource groups.

[0160] S305, acquire third relationship information based on the first relationship information, wherein the third relationship information is used to represent the mapping relationship between the logical address space and the physical address space of the first process in the target device.

[0161] Optionally, taking the target device as a virtual machine as an example, each first resource group is stored in each second physical block of the target device in a one-to-one correspondence, and the physical machine physical address of each second physical block can be recorded to replace the physical address range in each first resource group in the first relationship information. Since the capacity of the third large page is the same as that of the second large page, and the corresponding relationship between each first resource group and the third large page is not changed when each first resource group is stored, the logical address space can actually not be modified, but the third large page can be directly selected as the second large page.

[0162] Since the virtual machine itself has an operating system, has a virtual machine virtual address and a virtual machine physical address. Therefore, the physical machine physical address (HPA) needs to be converted into a physical machine virtual address (HVA) through a virtual machine manager, and then the physical machine virtual address (HVA) is converted into a virtual machine physical address (GPA), and the virtual machine physical address (GPA) is converted into a virtual machine virtual address (GVA) that can be recognized by the virtual machine through the virtual machine, to form the third relationship information. The mapping relationship between the logical address space and the physical address space of the first process in the virtual machine is recorded through the third relationship information.

[0163] S306, based on the third relationship information and the plurality of first resource groups, the first process is resumed in the target device.

[0164] Optionally, the target device has actually determined the storage locations of various resources required by the first process and the calling relationship of the first process after acquiring the third relationship information and the plurality of first resource groups. On this basis, the running of the first process can be resumed in the target device based on the third relationship information and the plurality of first resource groups. Taking the target device as a virtual machine as an example, the process tree of the first process can be reconstructed by calling the fork() function, and the first process can be allocated to the original PID by using the namespace of clone3() or / proc / sys / kernel / ns_last_pid, and then the running of the first process is resumed in the target device.

[0165] The hot migration method between the container and the virtual machine in the embodiment of the application can migrate the container to the virtual machine or migrate the virtual machine to the container, and provides a feasible implementation scheme for hot migration between the container and the virtual machine, has high migration efficiency, is beneficial to shorten the downtime in the hot migration process, and improves user experience.

[0166] Referring to Figure 9As shown, the fourth embodiment of the present application provides an electronic device, comprising:

[0167] The first obtaining module 401 is configured to obtain a first request, wherein the first request comprises a request for migrating a process in a source device to a target device; the source device is a container, and the target device is a virtual machine, or the source device is a virtual machine, and the target device is a container;

[0168] The second obtaining module 402 is configured to obtain a first identifier of a first process based on the first request.

[0169] The third obtaining module 403 is configured to obtain first relationship information and a plurality of first resource groups associated with the first relationship information based on the first identifier, wherein the first relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process, and the first resource groups are stored in the physical address space of the first process.

[0170] The sending module 404 is configured to send the first relationship information and the plurality of first resource groups to the target device.

[0171] In some embodiments, the sending module 404 is specifically configured to:

[0172] Obtain first hotness information of each of the first resource groups, wherein the first hotness information represents an access frequency of the first resource group.

[0173] Determine a target resource group with an access frequency greater than a first threshold value from the plurality of first resource groups.

[0174] Send the first relationship information and the target resource group to the target device.

[0175] In some embodiments, the sending module 404 is further configured to:

[0176] Obtain device information of the target device, wherein the device information is used to identify a data processing capability of the target device.

[0177] Determine the first threshold value based on the device information.

[0178] In some embodiments, the third obtaining module 403 is specifically configured to:

[0179] Obtain the first relationship information based on the first identifier, wherein the first relationship information is used to identify a one-to-one mapping relationship between a first logical unit and a first physical unit, the logical address space of the first process comprises a plurality of first logical units, the physical address space of the first process comprises a plurality of first physical units, and the first physical unit is used to store a first resource group.

[0180] based on the first relationship information, obtaining the first resource group stored in each of the first physical units.

[0181] In some embodiments, the third obtaining module 403 is specifically configured to:

[0182] based on the first identifier, obtaining second relationship information, wherein the logical address space of the first process comprises a plurality of second logical units, the physical address space of the first process comprises a plurality of second physical units, the second relationship information is used to identify a one-to-one mapping relationship between the second logical units and the second physical units, and the second physical units are used to store a second resource group of the first process;

[0183] based on the second relationship information, obtaining the second resource group stored in each of the second physical units;

[0184] obtaining first capacity information used to identify the capacity of a target physical unit; wherein the target physical unit is a basic constituent unit of the physical address space of the target device;

[0185] based on the first capacity information, determining the first logical unit, the first physical unit, the first resource group and the first relationship information;

[0186] wherein the first logical unit is formed by splitting the second logical unit or by combining a plurality of the second logical units, the second logical unit is formed by splitting the second physical unit or by combining a plurality of the second physical units, and the first resource group is formed by splitting the second resource group or by combining a plurality of the second resource groups.

[0187] In some embodiments, the third obtaining module 403 is further configured to:

[0188] obtaining second hotness information of the second resource group; wherein the second hotness information represents the access frequency of the second resource group;

[0189] based on the first capacity information and the second hotness information, merging a plurality of the second resource groups with an access frequency difference less than a second threshold value into the first resource group, merging a plurality of the second logical units corresponding to the second resource groups into the first logical unit, merging a plurality of the second physical units corresponding to the second resource groups into the first physical unit, and generating the first relationship information.

[0190] In some embodiments, the sending module 404 is further configured to:

[0191] obtaining state information of the source device; wherein the state information is used to represent the current running state of the source device;

[0192] Before sending the first relationship information and the plurality of first resource groups to the target device, the state information is sent to the target device.

[0193] Referring to Figure 10 The fifth embodiment of the present application further provides an electronic device, which comprises:

[0194] The fourth obtaining module 501 is configured to obtain first relationship information and a plurality of first resource groups; wherein the first relationship information comprises a mapping relationship between a logical address space and a physical address space of a first process in a source device.

[0195] The fifth obtaining module 502 is configured to obtain third relationship information based on the first relationship information; wherein the third relationship information comprises a mapping relationship between a logical address space and a physical address space of the first process in a target device; the source device is a container, and the target device is a virtual machine, or the source device is a virtual machine, and the target device is a container.

[0196] The restoring module 503 is configured to restore the first process to run in the target device based on the third relationship information and the plurality of first resource groups.

[0197] The above embodiments are only exemplary embodiments of the present application, and are not used to limit the present application, and the protection scope of the present application is defined by the claims. Those skilled in the art can make various modifications or equivalent replacements to the present application within the spirit and protection scope of the present application, and such modifications or equivalent replacements should also be considered to fall within the protection scope of the present application.

Claims

1. A method for live migration between a container and a virtual machine, comprising: obtaining a first request, wherein the first request comprises a request for migrating a process in a source device to a target device; the source device is a container and the target device is a virtual machine, or the source device is a virtual machine and the target device is a container; the source device runs on a first physical machine and the target device runs on a second physical machine; the first physical machine is configured to allocate a logical address space and a physical address space for a first process in a paging storage management manner when the first process needs memory space; obtaining a first identifier of the first process based on the first request; obtaining first relationship information based on the first identifier, and obtaining a plurality of first resource groups associated with the first relationship information based on the first relationship information; wherein the first relationship information is used to identify a mapping relationship between the logical address space and the physical address space of the first process, the first resource groups are stored in the physical address space of the first process; the logical address space of the first process comprises a plurality of large pages, and the physical address space of the first process comprises a plurality of blocks or page frames corresponding to the large pages; sending the first relationship information and the plurality of first resource groups to the target device.

2. The method of claim 1, wherein, The sending of the first relationship information and the plurality of first resource groups to the target device comprises: obtaining first heat information of each of the first resource groups; wherein the first heat information represents an access frequency of the first resource group; determining a target resource group with an access frequency greater than a first threshold value in the plurality of first resource groups; sending the first relationship information and the target resource group to the target device.

3. The method of claim 2, wherein, The sending of the first relationship information and the plurality of first resource groups to the target device further comprises: obtaining device information of the target device; wherein the device information is used to identify a data processing capability of the target device; determining the first threshold value based on the device information.

4. The method of claim 1, wherein, The obtaining of the first relationship information based on the first identifier, and the obtaining of the plurality of first resource groups associated with the first relationship information based on the first relationship information comprises: obtaining the first relationship information based on the first identifier; wherein the first relationship information is used to identify a one-to-one mapping relationship between a first logical unit and a first physical unit, the logical address space of the first process comprises a plurality of first logical units, the physical address space of the first process comprises a plurality of first physical units, and the first physical unit is used to store a first resource group; obtaining the first resource group stored in each of the first physical units based on the first relationship information.

5. The method of claim 4, wherein, The obtaining of the first relationship information based on the first identifier, and the obtaining of the plurality of first resource groups associated with the first relationship information based on the first relationship information further comprises: obtaining second relationship information based on the first identifier, wherein the logical address space of the first process comprises a plurality of second logical units, the physical address space of the first process comprises a plurality of second physical units, the second relationship information is used to identify a one-to-one mapping relationship between the second logical units and the second physical units, and the second physical units are used to store a second resource group of the first process; obtaining the second resource group stored in each of the second physical units based on the second relationship information; obtaining first capacity information used to identify the capacity of a target physical unit, wherein the target physical unit is a basic component unit of the physical address space of the target device; determining the first logical unit, the first physical unit, the first resource group and the first relationship information based on the first capacity information; wherein the first logical unit is formed by splitting the second logical unit or by combining a plurality of the second logical units, the first physical unit is formed by splitting the second physical unit or by combining a plurality of the second physical units, and the first resource group is formed by splitting the second resource group or by combining a plurality of the second resource groups.

6. The method of claim 5, wherein, The determining of the first logical unit, the first physical unit, the first resource group and the first relationship information based on the first capacity information comprises: obtaining second heat information of the second resource group, wherein the second heat information represents the access frequency of the second resource group; based on the first capacity information and the second heat information, merging a plurality of the second resource groups with an access frequency difference less than a second threshold value into the first resource group, merging a plurality of corresponding second logical units into the first logical unit, merging a plurality of corresponding second physical units into the first physical unit, and generating the first relationship information.

7. The method of claim 1, wherein, The method further comprises: obtaining state information of the source device, wherein the state information is used to represent the current running state of the source device; sending the state information to the target device before sending the first relationship information and the plurality of first resource groups to the target device.

8. A live migration method between a container and a virtual machine, comprising: obtaining first relationship information and a plurality of first resource groups, wherein the first relationship information is used to identify the mapping relationship between the logical address space and the physical address space of a first process in a source device, the logical address space of the first process in the source device comprises a plurality of large pages, and the physical address space of the first process in the source device comprises a plurality of blocks or page frames corresponding to the large pages; obtain third relationship information based on the first relationship information, wherein the third relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process in the target device; the source device is a container and the target device is a virtual machine, or the source device is a virtual machine and the target device is a container; the source device runs on a first physical machine and the target device runs on a second physical machine; the first physical machine is configured to allocate logical address space and physical address space to the first process in a paging storage management manner when the first process needs memory space; resume running the first process in the target device based on the third relationship information and the plurality of first resource groups. 9.An electronic device, comprising: a first obtaining module configured to obtain a first request, wherein the first request comprises a request to migrate a process in a source device to a target device; the source device is a container and the target device is a virtual machine, or the source device is a virtual machine and the target device is a container; the source device runs on a first physical machine and the target device runs on a second physical machine; the first physical machine is configured to allocate logical address space and physical address space to the first process in a paging storage management manner when the first process needs memory space; a second obtaining module configured to obtain a first identifier of a first process based on the first request; a third obtaining module configured to obtain first relationship information based on the first identifier, and obtain a plurality of first resource groups associated with the first relationship information based on the first relationship information; wherein the first relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process, and the first resource groups are stored in the physical address space of the first process; the logical address space of the first process comprises a plurality of large pages, and the physical address space of the first process comprises a plurality of blocks or page frames corresponding to the large pages; a sending module configured to send the first relationship information and the plurality of first resource groups to the target device. 10.An electronic device, comprising: a fourth obtaining module configured to obtain first relationship information and a plurality of first resource groups; wherein the first relationship information is used to identify a mapping relationship between a logical address space and a physical address space of a first process in a source device; the logical address space of the first process in the source device comprises a plurality of large pages, and the physical address space of the first process in the source device comprises a plurality of blocks or page frames corresponding to the large pages; a fifth obtaining module, configured to obtain third relationship information based on the first relationship information, wherein the third relationship information is used to identify a mapping relationship between a logical address space and a physical address space of the first process in the target device; the source device is a container, and the target device is a virtual machine; or the source device is a virtual machine, and the target device is a container; the source device runs on a first physical machine, and the target device runs on a second physical machine; the first physical machine is configured to allocate the logical address space and the physical address space to the first process in a paging storage management manner when the first process needs memory space; a restoring module, configured to restore the first process to run in the target device based on the third relationship information and the plurality of first resource groups.

Citation Information

Patent Citations

  • Virtual machine total-system online migration method, device and system

    CN103631633A

  • Data merging method and device, electronic device and storage medium

    CN110674086A

  • Systems and methods for live update of operating systems and hypervisors within virtualization systems

    US20210318900A1