Method and computing device for recovering application of virtual machine

By starting a new virtual machine without freezing the application when upgrading the virtual machine kernel, the problem of long service interruption during the upgrade process is solved, and more efficient virtual machine kernel upgrades and lower business impacts are achieved.

CN116860389BActive Publication Date: 2025-04-01XFUSION DIGITAL TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310787145.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2025-04-01
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

When upgrading the virtual machine kernel, the running services inside the virtual machine will be frozen and restored for a longer time, resulting in a longer service interruption.

Method used

During the process of starting a new virtual machine, there is no freezing application, so there is no need to care about the overhead of starting a new virtual machine. Service interruption starts with the frozen application after starting a new virtual machine. Resuming the frozen application through the new virtual machine to reduce the duration of service interruption.

Benefits of technology

By reducing service interruption time, the efficiency and reliability of virtual machine kernel upgrades are improved, and the impact on business continuity is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116860389B_ABST
    Figure CN116860389B_ABST
Patent Text Reader

Abstract

The present application provides a method and computing device for application recovery of a virtual machine. In an embodiment, the method is applied to a computing device, and the method includes: starting a second virtual machine; the second virtual machine includes a second kernel and a second memory space after the first kernel of the first virtual machine is upgraded; the first virtual machine and the second virtual machine have the same configuration; freezing the first application running in the first virtual machine; determining a first memory page from the first memory space of the first virtual machine; the first memory page is used to store the status information of the first application; based on the first memory page, determining a second memory page in the second memory space; the second memory page is used to store the status information of the first application; based on the status information of the first application stored in the second memory page, resuming the operation of the frozen first application in the first virtual machine through the second kernel of the second virtual machine. The service interruption starts from the frozen application after the new virtual machine is started, which can reduce the duration of the service interruption to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and computing device for recovering an application of a virtual machine. Background Art

[0002] In the kernel-based virtual machine (KVM) technology, a virtual machine (VM) that can independently run an operating system can be simulated through a virtualization simulator such as Quick Emulator (QEMU). Specifically, on a physical host, a virtual machine has an operating system and multiple applications. The core of the operating system is the kernel.

[0003] For virtual machines that are already running online, in order to enhance security, fix vulnerabilities, optimize source code-level performance, etc., it is inevitable to upgrade the kernel of the virtual machine partially or as a whole. That is, the virtual machine running based on the old version of the kernel needs to be upgraded to a virtual machine running based on the new version of the kernel.

[0004] In the related art, in the process of upgrading the kernel of a virtual machine, the services running inside the virtual machine are first frozen, then a checkpoint is made for the services running inside the virtual machine, and then the upgraded kernel is started. The upgraded kernel restores the services running inside the virtual machine based on the checkpoint.

[0005] However, in the above solution, the time from the freezing moment to the recovery moment of the service running inside the virtual machine may be long, resulting in a long service interruption time.

[0006] The information disclosed in this background technology section is only intended to increase the understanding of the overall background of the application and should not be regarded as an admission or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the invention

[0007] The embodiments of the present application provide a method, device and system for recovering an application of a virtual machine. In the process of starting a new virtual machine, the application is not frozen, so there is no need to worry about the overhead of starting the new virtual machine. The service interruption starts from the freezing of the application after the new virtual machine is started. Since the service interruption time does not include the time of starting the new virtual machine, the duration of the service interruption can be reduced to a certain extent.

[0008] In a first aspect, an embodiment of the present application provides a method for recovering an application of a virtual machine, which is applied to a computing device, wherein the computing device runs a first virtual machine; the first virtual machine includes a first kernel and a first memory space; wherein the first virtual machine runs a first application through the first kernel;

[0009] The method includes: starting a second virtual machine; wherein the second virtual machine includes a second kernel and a second memory space; the second kernel is a kernel after the first kernel is upgraded; the first virtual machine and the second virtual machine have the same configuration; freezing a first application running in the first virtual machine; determining a first memory page from the first memory space; wherein the first memory page is used to store status information of the first application; based on the first memory page, determining a second memory page in the second memory space; wherein the second memory page is used to store status information of the first application; based on the status information of the first application stored in the second memory page, resuming the operation of the frozen first application in the first virtual machine through the second kernel of the second virtual machine.

[0010] In this solution, the application is not frozen during the process of starting a new virtual machine, so there is no need to worry about the overhead of starting a new virtual machine. The service interruption starts from the freezing of the application after starting the new virtual machine. Since the service interruption time does not include the time of starting the new virtual machine, the duration of the service interruption can be reduced to a certain extent.

[0011] In a possible implementation, the first memory space includes N first memory slices, and the second memory space includes N second memory slices; wherein the N first memory slices correspond to the N second memory slices one by one;

[0012] Based on the first memory page, determine the second memory page in the second memory space, including: determine a first target memory slice from N first memory slices; wherein the first target memory slice is the first target memory slice of the first memory page; based on the first target memory slice, determine the second memory page in the second memory space.

[0013] In one example of the implementation, the first target memory slice has a mapped first file;

[0014] Based on the first target memory slice, determine the second memory page in the second memory space, including: determine whether the second target memory slice has a mapped second file; wherein the second target memory slice is a memory slice corresponding to the first target memory slice in N second memory slices; when the second target memory slice does not have a mapped second file, use the first file as the mapping file of the second target memory slice; determine the first memory page as the second memory page.

[0015] In one case of this example, the method also includes: when the second target memory slice has a mapped second file, determining whether the name of the first file and the name of the second file are the same; when the name of the first file and the name of the second file are the same, determining the first memory page as the second memory page.

[0016] In another case of this example, the method also includes: when the name of the first file and the name of the second file are different, determining a third target memory slice among the N second memory slices; wherein the third target memory slice includes a third memory page, and the third memory page is a blank page in the third target memory slice; exchanging the first memory page and the third memory page so that the status information of the first application stored in the first memory page can be accessed through the third memory page; and determining the third memory page to be the second memory page.

[0017] Exemplarily, when there are blank pages in the second target memory slice, the third target memory slice is the second target memory slice.

[0018] Exemplarily, when there is no blank page in the second target memory slice, the third target memory slice is a second memory slice different from the second target memory slice.

[0019] In a possible implementation, before freezing the first application running in the first virtual machine, the method further includes: writing the non-persistent data stored in the first memory space into the file system of the first virtual machine.

[0020] In this solution, before freezing the application running on the first virtual machine, the non-persistent data stored in the first memory space is written to the disk partition of the first virtual machine for persistence; in this way, after the application is subsequently frozen, there is no need to repair the file system (that is, restore the state of the file system to the latest state) or the amount of data that needs to be repaired (that is, the data generated between the completion of persistence and the freezing of the application) is relatively small.

[0021] In one example of the implementation, after determining the second memory page from the second memory space based on the first memory page, the method further includes: unmounting the file system of the first virtual machine;

[0022] Before resuming the operation of the frozen first application in the first virtual machine through the second kernel of the second virtual machine, the method further includes: mounting the file system to the second virtual machine.

[0023] In this solution, before the running application of the original virtual machine is frozen, the non-persistent data in the memory is written to the disk for persistence, so that the status of the file system is the latest (that is, the data is the latest); subsequently, the new virtual machine can directly mount the file system without the need to repair the file system (that is, if the data is not the latest, update the data to the latest status) or the amount of data that needs to be repaired (that is, the data generated between the completion of persistence and the freezing of the application) is small, thereby speeding up the mounting of the file system of the new virtual machine.

[0024] In one example of this example, before unmounting the file system of the first virtual machine, the method further includes: terminating a task that is accessing the file system.

[0025] In this solution, the successful unmounting of the file system is ensured by terminating the task that is accessing the file system.

[0026] In the second aspect, the embodiment of the present application provides a device for recovering an application of a virtual machine, and the device for recovering an application of a virtual machine includes several modules, each of which is used to execute each step in the method for recovering an application of a virtual machine provided in the first aspect of the embodiment of the present application, and the division of the modules is not limited here. For the specific functions executed by each module of the device for recovering an application of a virtual machine and the beneficial effects achieved, please refer to the functions of each step of the method for recovering an application of a virtual machine provided in the first aspect of the embodiment of the present application, and no further description will be given here.

[0027] For example, the apparatus for recovering an application of a virtual machine includes:

[0028] A startup module, used for starting a second virtual machine; wherein the second virtual machine includes a second kernel and a second memory space; the second kernel is a kernel upgraded from the first kernel; the first virtual machine and the second virtual machine have the same configuration;

[0029] A freezing module, used to freeze the first application running in the first virtual machine;

[0030] A marking module, used to determine a first memory page from a first memory space; wherein the first memory page is used to store state information of a first application;

[0031] A mapping module, configured to determine a second memory page in the second memory space based on the first memory page; wherein the second memory page is used to store the state information of the first application;

[0032] The recovery module is used to recover the frozen first application in the first virtual machine through the second kernel of the second virtual machine based on the state information of the first application stored in the second memory page.

[0033] In a possible implementation, the first memory space includes N first memory slices, and the second memory space includes N second memory slices; wherein the N first memory slices correspond to the N second memory slices one by one;

[0034] A mapping module is used to determine a first target memory slice from N first memory slices; wherein the first target memory slice is a first memory page first target memory slice; based on the first target memory slice, determine a second memory page in a second memory space.

[0035] In one example of the implementation, the first target memory slice has a mapped first file;

[0036] A mapping module is used to determine whether a second target memory slice has a mapped second file; wherein the second target memory slice is a memory slice corresponding to the first target memory slice in N second memory slices; when the second target memory slice does not have a mapped second file, the first file is used as the mapping file of the second target memory slice; and the first memory page is determined as the second memory page.

[0037] In one case of this example, the mapping module is also used to determine whether the name of the first file and the name of the second file are the same when the second target memory slice has a mapped second file; and to determine the first memory page as the second memory page when the name of the first file and the name of the second file are the same.

[0038] In another case of this example, the mapping module is also used to determine a third target memory slice among the N second memory slices when the name of the first file is different from the name of the second file; wherein the third target memory slice includes a third memory page, which is a blank page in the third target memory slice; exchange the first memory page and the third memory page so that the status information of the first application stored in the first memory page can be accessed through the third memory page; and determine the third memory page to be the second memory page.

[0039] Exemplarily, when there are blank pages in the second target memory slice, the third target memory slice is the second target memory slice.

[0040] Exemplarily, when there is no blank page in the second target memory slice, the third target memory slice is a second memory slice different from the second target memory slice.

[0041] In a possible implementation, the device for recovering an application of a virtual machine further includes: a persistence module, located after the startup module and before the freezing module, and further used to write the non-persistent data stored in the first memory space into the file system of the first virtual machine.

[0042] In an example of this implementation, the device for recovering a virtual machine application further includes: an unloading module, located after the mapping module, for unloading the file system of the first virtual machine; and a mounting module, located before the recovery module, for mounting the file system to the second virtual machine.

[0043] In one example of this example, the unloading module is used to unload the file system of the first virtual machine after terminating the task that is accessing the file system.

[0044] In a third aspect, an embodiment of the present application provides a device for recovering an application of a virtual machine, comprising: at least one memory for storing programs; and at least one processor for executing the programs stored in the memory. When the programs stored in the memory are executed, the processor is used to execute the method provided in the first aspect.

[0045] In a fourth aspect, an embodiment of the present application provides a device for recovering an application of a virtual machine, characterized in that the device runs computer program instructions to execute the method provided in the first aspect. Exemplarily, the device may be a chip or a processor.

[0046] In one example, the device may include a processor, which may be coupled to a memory, read instructions in the memory and execute the method provided in the first aspect according to the instructions. The memory may be integrated in a chip or a processor, or may be independent of the chip or the processor.

[0047] In a fifth aspect, an embodiment of the present application provides a computer storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the method provided in the first aspect.

[0048] In a sixth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 It is a schematic diagram of a virtualization architecture of a host provided in an embodiment of the present application;

[0050] Figure 2a This is a schematic diagram of the structure of the computing device provided in the embodiment of the present application. Figure 1 ;

[0051] Figure 2b is a second structural diagram of a computing device provided in an embodiment of the present application;

[0052] Figure 2c This is a schematic diagram of the structure of the computing device provided in the embodiment of the present application. Figure 3 ;

[0053] Figure 3 It is a flowchart of the application recovery principle of the virtual machine provided in the embodiment of the present application;

[0054] Figure 4a It is a flowchart of a method for recovering an application of a virtual machine provided in an embodiment of the present application;

[0055] Figure 4b This is a scenario illustration of a method for recovering an application of a virtual machine provided in an embodiment of the present application;

[0056] Figure 5a It is a schematic diagram of the correspondence between the memory space and the physical memory space provided in the embodiment of the present application;

[0057] Figure 5b yes Figure 5a Schematic diagram of the correspondence between memory pages and physical memory pages in ;

[0058] Figure 5c yes Figure 5b Schematic diagram of the correspondence between the memory page and the physical memory page after processing in step 404;

[0059] Figure 6a It is a flowchart of another method for recovering an application of a virtual machine provided in an embodiment of the present application;

[0060] Figure 6b It is a scenario diagram of another method for recovering an application of a virtual machine provided in an embodiment of the present application;

[0061] Figure 7a It is a flowchart of another method for recovering an application of a virtual machine provided in an embodiment of the present application;

[0062] Figure 7b This is a scenario diagram of another method for recovering an application of a virtual machine provided in an embodiment of the present application;

[0063] Figure 8a It is a flowchart of another method for application recovery of a virtual machine provided in an embodiment of the present application;

[0064] Figure 8b This is a scenario diagram of another method for recovering an application of a virtual machine provided in an embodiment of the present application;

[0065] Figure 9a It is a schematic diagram of an application of application recovery of a virtual machine provided in an embodiment of the present application;

[0066] Figure 9b It is a schematic diagram of a scenario of application recovery of a virtual machine provided in an embodiment of the present application;

[0067] Fig.10 It is a structural diagram of a device for recovering an application of a virtual machine provided in an embodiment of the present application;

[0068] Among them, the reference numerals in the figure are:

[0069] 100-computing device; 110-motherboard; 111-CPU; 112-memory; 113-programmable logic device; 114-BMC; 115-PCIe slot; 121-power supply; 122-network card; 123-hard disk; 124-fan; 130-computing node; 140-power supply. DETAILED DESCRIPTION

[0070] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0071] In the description of the embodiments of the present application, words such as "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a concrete way.

[0072] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, B exists alone, and A and B exist at the same time. In addition, unless otherwise specified, the term "multiple" means two or more. For example, multiple systems refers to two or more systems, and multiple terminals refers to two or more terminals.

[0073] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprises", "has" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0074] Below, some terms in this embodiment are explained. It should be noted that these explanations are for the convenience of understanding by those skilled in the art and do not constitute a limitation on the scope of protection claimed in this application.

[0075] File system: It is the method and data structure used by the operating system to identify files on storage devices (usually disks) or partitions; it is the method of organizing files on storage devices. The file system uses the abstract logical concept of files and tree directories to replace the concept of data blocks used by physical devices such as hard disks and optical disks. Users who use the file system to save data do not need to care about the data block at which the data is actually saved on the hard disk. They only need to remember the directory and file name of the file. The file system can also be understood as the software organization in the operating system that is responsible for managing and storing file information.

[0076] Mounting: refers to connecting a storage device or file system to a directory of the operating system so that the operating system can access the files in the device or file system. In Linux, mounting is a very important operation. Using mounting can permanently mark the location of storage devices and file systems so that they can be used by the system. After mounting, these storage devices or file systems belong to the file tree structure in the operating system and become a subdirectory under the root directory.

[0077] Virtual machine (VM): is a special software. A virtual machine can create an environment between the computer platform and the end user, so that the end user can operate other software based on the environment created by the virtual machine. From the application's perspective, the program running on the virtual machine is the same as running on its corresponding physical computer.

[0078] Virtual machine monitor (VMM): It is also a special software. VMM can manage and externally monitor VMs. In addition, VMM is also called hypervisor.

[0079] EPT (the extended page-table machanism): a mechanism for implementing the conversion from the guest physical address (GPA) to the host physical address (HPA); on Intel CPUs (central processing unit), this mechanism is called EPT, and on AMD CPUs, this mechanism is called nested page tables (NPT). The term EPT is used uniformly in the embodiments of the present application. In a system that supports EPT, the conversion of the guest physical address GPA into the physical address of the host physical address HPA is implemented through a series of EPT page table structures. For ease of description and distinction, the embodiments of the present application refer to the client physical address as the virtual machine physical address.

[0080] PFN (page frame number): The so-called page frame refers to the physical memory. The physical memory is divided into areas of page size, and each page is numbered. This number is PFN. Assuming that the physical memory starts at address 0, the page frame with PFN equal to 0 is the page starting at address 0 (physical address). Assuming that the physical memory starts at address x, the first page frame number is (x>>PAGE_SHIFT).

[0081] CRIU (checkpoint restore in userspace): is a software tool that can freeze or partially freeze the execution of an application and save its execution state to a series of files on disk. Later, these files can be used to resume running the application and start execution from the previously frozen point. The biggest feature of CRIU is that it is executed in user space, which is different from other software.

[0082] APR (Address Resolution Protocol): It is a TCP (Transmission Control Protocol) / IP protocol that obtains the physical address based on the IP (internet protocol) address. When a host sends information, it broadcasts an ARP request containing the target IP address to all hosts on the local area network and receives a return message to determine the target's physical address. After receiving the return message, the IP address and physical address are stored in the local ARP cache and retained for a certain period of time. The next request directly queries the ARP cache to save resources.

[0083] Among the related technologies, virtualization technology has become one of the focuses of academia and industry, and it is also the basic technology of cloud computing. In terms of hardware, virtualization technology is used in enterprise servers, embedded systems and desktop platforms; in terms of usage, virtualization technology is used in system resource management, fault tolerance, software and hardware maintenance, and enhanced system security. Specifically, virtualization refers to the technology of running several virtual machines (also known as clients, VMs) on a physical computer (also known as a host). Virtualization technology introduces a new software layer in the host machine. The new software layer is a virtual machine monitor (VMM, or hypervisor). The virtual machine monitor provides the required operating environment abstraction for the virtual machine (VM), and can control and manage the virtual machine's (VM) access to and use of real physical resources.

[0084] like Figure 1 As shown, in the virtualization architecture of the host, hardware, a virtualization management system, and several virtual machines (VMs) are included. The virtual machine (VM) is equivalent to the host, and includes an operating system and several applications. Exemplarily, the host may include 2 virtual machines (VMs), one virtual machine (VM) includes an operating system such as Windows and N applications; the other virtual machine (VM) includes an operating system such as Linux and M applications. Among them, the virtualization management system is located between the virtual machine and the hardware, has the highest privilege level, can manage the hardware resources, and allocate physical resources to the virtual machine. Exemplarily, the virtualization management system can be a virtual machine monitor (VMM).

[0085] In kernel-based virtual machine (KVM) technology, a virtual machine has an operating system and multiple applications on a host machine, and the core of the operating system is the kernel. For virtual machines that are already running online, in order to enhance security, fix vulnerabilities, optimize source code level performance, etc., it is inevitable to upgrade the kernel of the virtual machine partially or completely, that is, the virtual machine running on the old version of the kernel needs to be upgraded to a virtual machine running on the new version of the kernel.

[0086] In the related art, in the process of upgrading the kernel of a virtual machine, the services running inside the virtual machine are first frozen, then a checkpoint is made for the services running inside the virtual machine, and then the upgraded kernel is started. The upgraded kernel restores the services running inside the virtual machine based on the checkpoint.

[0087] However, in the above solution, the time from the freezing moment to the recovery moment of the service running inside the virtual machine is long, resulting in a long service interruption time.

[0088] An embodiment of the present application provides a computing device.

[0089] In the scenario S1 of this embodiment, the computing device 100 may be a rack server. Figure 2a As shown, the computing device 100 may include a power supply 121 and a mainboard 110 , wherein the power supply 121 is electrically connected to the mainboard 110 to supply power to components on the mainboard 110 .

[0090] Exemplarily, the motherboard includes a CPU (central processing unit) 111, a memory slot 112, a programmable logic device (PLD) 113, a BMC (baseboard management controller) 114, a PCIE slot 115, a network card 122, a hard disk 123, and a fan 124.

[0091] Among them, the memory slot 112 is inserted with a volatile memory, i.e., a memory, which is used as an external cache. Exemplarily, the memory can be a random access memory (RAM). By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM).

[0092] Among them, the PCIE slot 115 is suitable for expanding at least one of a GPU card, a network card, a video capture card, an HBA (Host Bus Adapter) card, a RAID (redundant arrays of independent disks) card, and an SSD (solid state disk or solid state drive), and can also support the expansion of various adapter cards.

[0093] The programmable logic device 113 may be a complex logic device (CPLD, which is a digital integrated circuit whose logic functions are constructed by users according to their own needs) or a field programmable gate array (FPGA).

[0094] Among them, the hard disk 123 is divided into a mechanical hard disk (hard disk drive, HDD) and a solid state hard disk. For example, the solid state hard disk can be a solid state hard disk of a PCIe channel, such as a solid state hard disk of a logical device interface specification (nonvolatile memory express, NVME, used to access non-volatile memory media attached through a PCI Express (PCIe) bus). It should be understood that the hard disk 123 is only an example of a non-volatile memory and does not constitute a specific limitation. In actual applications, a non-volatile memory can be selected in combination with actual conditions.

[0095] It should be noted that Figure 2a The computing device 100 is merely an example and does not constitute a specific limitation. In practical applications, the computing device 100 may include: Figure 2a More or fewer devices, for example, may include a single-chip microcomputer (an integrated circuit chip, equivalent to a microcomputer), a digital signal processor (DSP), an application specific integrated circuit (ASIC), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, general-purpose processors, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0096] In scenario S2 of this embodiment, the computing device 100 may be a high-density server or a blade server. Figure 2b As shown, the computing device 100 includes a server chassis (not shown) and a plurality of server nodes 130. The server node 130 has the functions of a complete server and may be referred to as a computing node in some possible cases. The server node 130 includes a motherboard 110, on which a plurality of devices are arranged. The devices on the motherboard 110 may be referred to as Figure 2a , which can include Figure 2a More or fewer devices are shown, such as Figure 2b As shown, it may include a CPU 111, a memory slot 112, a BMC 114, a programmable logic device 113, a network card 122, a hard disk 123, etc. For detailed description, see scene S1, which will not be repeated here. The server chassis includes a power supply 121 and a fan 150. The power supply 121 is electrically connected to the motherboard 110 of the server node 130 and is used to power the components on the motherboard 110 in the server node 130. It should be noted that the server nodes 130 in the computing device 100 share the power supply 121.

[0097] In scenario S3 of this embodiment, the computing device 110 may be a whole-rack server, wherein the whole-rack server is an independent product formed by integrating the original architecture in which the rack and the machine are separated.

[0098] In this scenario S3, a possible situation is Figure 2c As shown, the cabinet is provided with a power supply 140 and a server node 130, and the server node 130 shares the power supply 130 provided in the cabinet. In a specific implementation, the server node 130 may optionally include a mainboard 110, without an independent power supply 121, and a plurality of devices are provided on the mainboard 110. The plurality of devices provided on the mainboard 110 can be referred to in Figure 2a , which can include Figure 2a More or fewer devices than shown, for example, may include Figure 2b The power supply 140 in the cabinet is electrically connected to the mainboard 110 of the server node 130 to supply power to the components on the mainboard 110 in the server node 130 .

[0099] The embodiment of the present application provides a method for application recovery of a virtual machine. This is only an overview of the method, and the details are described below.

[0100] The method for recovering an application of a virtual machine provided in the embodiment of the present application takes into account the memory address translation technology, and realizes the mapping of the virtual physical address (GPA) of the memory page of the virtual machine to the host physical address (HPA) of the physical memory page through the memory address translation technology. Therefore, in order to facilitate the understanding of the method for recovering an application of a virtual machine provided in the embodiment of the present application, memory virtualization is first introduced.

[0101] In a virtual machine, all addresses are virtual addresses, which are converted into virtual machine physical addresses (GPA) by the CPU based on information stored in a set of tables maintained by the VMM. In order to perform this conversion, the virtual memory and physical memory of the virtual machine are usually divided into blocks that can be called "pages". In the embodiment of the present application, the pages divided by the virtual memory are referred to as memory pages, and the pages divided by the physical memory are referred to as physical memory pages. For physical memory pages, these physical memory pages can be the same size, and each physical memory page corresponds to one or more memory pages of the virtual machine. In addition, each physical memory page is assigned a unique number, namely a page frame number (PFN); for the memory pages of the virtual machine, these memory pages can be the same size, and each memory page is assigned a unique number, namely a virtual page frame number (VPFN).

[0102] In the technology of memory virtual machines, memory address translation is one of the foundations of memory virtualization. The purpose of memory address translation is to provide a virtual machine with a continuous memory space starting from zero, and memory resources must be effectively isolated, scheduled, and shared between virtual machines. In order to achieve this goal, VMM introduces a new address space, namely the virtual machine physical address (GPA). This address space is not a real physical address space, it is just a mapping of the host memory address translation space to the virtual machine address space. For each virtual machine running on the computing device 100, an independent, continuous virtual machine physical address (GPA) starting from zero can be seen; but for the computing device 100, the virtual machine physical address (GPA) is not necessarily continuous, and the virtual machine physical address (GPA) may be mapped to several discontinuous host physical addresses (HPA).

[0103] In a specific implementation, the computing device 100 internally stores an address translation table, such as an EPT page table, for storing the correspondence between the virtual machine physical address (GPA) and the host machine physical address (HPA). Correspondingly, in the embodiment of the present application, the memory page of the virtual machine has a virtual machine physical address (GPA); when the computing device 100 reads the information stored in the memory page of the virtual machine, it needs to convert the virtual machine physical address (GPA) of the memory page to the host machine physical address (HPA) based on the address translation table, and then read the information stored in the physical memory page of the host machine physical address (HPA).

[0104] Based on the memory address conversion technology described above, the present application embodiment provides the following method for recovering an application of a virtual machine, such as: Figure 3 As shown, on the one hand, a new virtual machine with the same specifications as the original virtual machine (with a new kernel (upgraded kernel) is started; then, the application running on the original virtual machine is frozen; subsequently, the first memory page storing the application-related state on the original virtual machine is determined by utilizing the fact that the new virtual machine and the old virtual machine are located on the same physical host, and the new virtual machine establishes a mapping relationship with the first memory page. For example, the new virtual machine can establish a corresponding relationship between the virtual machine physical address (GPA) of its own memory page and the host physical address (HPA) corresponding to the first memory page. Subsequently, the application is restored in the new virtual machine. Here, since the application is not frozen during the process of starting the new virtual machine, there is no need to worry about the overhead of starting the new virtual machine. The service interruption starts from the freezing of the application after starting the new virtual machine. Since the service interruption time does not include the time of starting the new virtual machine, the service interruption duration can be reduced to a certain extent.

[0105] On the other hand, Figure 3As shown, in order to speed up the mounting of the file system of the new virtual machine, before the running application of the original virtual machine is frozen, the non-persistent data in the memory is written to the disk for persistence, so that the status of the file system is the latest (the data is the latest); subsequently, the new virtual machine can directly mount the file system without the need to repair the file system (if the data is not the latest, update the data to the latest status), or the amount of data that needs to be repaired (that is, the data generated between the completion of persistence and the freezing of the application) is small, thereby speeding up the mounting of the file system of the new virtual machine.

[0106] Next, a method for application recovery of a virtual machine provided in an embodiment of the present application is described in detail. For ease of description, the embodiment of the present application will describe the scheme according to the following naming as an example. It should be noted that the following naming is only used as a feasible implementation method, and other naming methods can be used in actual applications, and the embodiment of the present application does not specifically limit this.

[0107] The virtual machine to be upgraded is the first virtual machine, the kernel of the first virtual machine is the first kernel, the memory space allocated to the first virtual machine is the first memory space, the kernel after the first kernel is upgraded is the second kernel, the virtual machine started with the second kernel and having the same configuration as the first virtual machine is the second virtual machine, and the memory space allocated to the second virtual machine is the first memory space.

[0108] Figure 4a is a flowchart of a method for recovering an application of a virtual machine provided in an embodiment of the present application. Figure 4b 1 is a schematic diagram of a scenario of a method for recovering an application of a virtual machine provided in an embodiment of the present application. This embodiment can be applied to a computing device. For example, a computing device 100. A first virtual machine is run on the computing device 100, the first virtual machine includes a first kernel and a first memory space, the first virtual machine runs an application through the first kernel, and the first memory space caches data of the application run by the first virtual machine; Figure 4a and Figure 4b As shown, the application recovery method of the virtual machine provided in the embodiment of the present application includes at least the following steps:

[0109] Step 401, the computing device 100 starts a second virtual machine; the second virtual machine includes a second kernel and a second memory space; the second kernel is an upgraded kernel of the first kernel; the configurations of the first virtual machine and the second virtual machine are the same.

[0110] The configuration of the first virtual machine may include the number of vCPU (Virtualised CPU) cores, the size of the virtual memory (first memory space), etc. When the configuration of the second virtual machine is the same as the configuration of the first virtual machine, the configuration of the second virtual machine is the same as the first virtual machine, and without considering the kernel and application running in the virtual machine, the second virtual machine can be considered to be the same as the first virtual machine.

[0111] The following is an exemplary description of how the kernel starts the second virtual machine. It should be noted that there are multiple ways to start the second virtual machine.

[0112] As an implementation method, Figure 4b As shown, the computing device 100 loads the executable file of the second virtual machine (including information related to the virtual machine startup parameters) ( Figure 4b (not shown in the example), perform initialization operation of the virtual resources of the second virtual machine; then, the computing device 100 performs boot operation of the second kernel of the second virtual machine, loads the second kernel into the second memory space, and starts the second virtual machine.

[0113] Among them, the virtual resources may include a virtual CPU, a second memory space, a virtual network card, a virtual hard disk, and a virtual BIOS (Basic Input Output System). It should be noted that since the configurations of the first virtual machine and the second virtual machine are the same, the first memory space and the second memory space are used to represent the same virtual machine memory space and have the same virtual machine physical address (GPA) space. It is worth noting that the first memory space and the second memory space are essentially the same virtual memory space. In order to facilitate distinction and description, the embodiments of the present application use different names. Among them, the virtual machine physical address (GPA) includes a virtual page frame number (VPFN). The first memory space and the second memory space are both manifested as: a virtual memory space formed by continuous virtual page frame numbers (VPFN), and the range of the virtual page frame numbers (VPFN) of the first memory space and the second memory space are the same. For example, if Figure 5a As shown, the first memory space includes memory pages with virtual page frame numbers (VPFN) from 1 to 60, and the second memory space also includes memory pages with virtual page frame numbers (VPFN) from 1 to 60.

[0114] The process of the computing device 100 booting the second kernel of the second virtual machine may be as follows: the computing device 100 obtains an image file (for ease of description and distinction, it may be referred to as a second image file), the second image file includes the second kernel. Then, the computing device 100 enters the virtualization environment, the virtual BIOS accesses the disk, and loads the second image file, thereby implementing the booting operation of the second kernel.

[0115] For example, Figure 4b As shown, the production process of the second image file can be: the computing device 100 obtains the image file of the first virtual machine (for the convenience of description and distinction, it can be called the first image file), replaces the first kernel in the first image file with the second kernel, and obtains the second image file.

[0116] It should be noted that in order to prevent the ARP address broadcast message of the second virtual machine from affecting the operation of the first virtual machine, the ARP mechanism needs to be temporarily disabled during the process of starting the second virtual machine.

[0117] Step 402: The computing device 100 freezes the application running in the first virtual machine.

[0118] In a feasible implementation, the computing device may include a freezing tool such as CRIU; in a specific implementation, the computing device may use the freezing tool to freeze the application running in the first virtual machine. At this time, the application running in the first virtual machine will not be able to send any operations. In other words, the first virtual machine cannot provide services, and a service interruption occurs.

[0119] Step 403: The computing device 100 determines a first memory page from the first memory space; wherein the first memory page is used to store status information of the first application.

[0120] In a feasible implementation, the computing device 100 may include a freezing tool such as CRIU; in a specific implementation, the computing device 100 may mark the first memory page in the first memory space through the freezing tool, and the freezing tool may generally determine the virtual page frame number (VPFN).

[0121] Among them, the status information of the application (for the sake of distinction, it can be called the first application) is used to indicate the status information maintained internally by the application and the status information maintained by the first kernel for the application. Generally speaking, the status information maintained internally by the application is only known by the application itself and is confidential to the outside. The status information maintained by the first kernel for the application may include file information and communication information, wherein the file information is used to explain what file is opened and where the file is read, and the communication information is used to explain who is communicating with, the communication protocol used, etc. Here, the description of the application status information is only used as an example. In actual applications, it needs to be determined in combination with the status information actually recorded by the application and the kernel.

[0122] There may be multiple first memory pages, and the physical memory pages corresponding to one or more first memory pages may store the state information of the application running on the first virtual machine. In actual applications, the first virtual machine may run one or more applications.

[0123] In an embodiment of the present application, the first memory page has a virtual machine physical address (GPA), which actually indicates the location of the application status information in the virtual memory, including the virtual page frame number (VPFN); when the computing device 100 reads the information of the first application status stored in the first memory page, it is necessary to convert the virtual machine physical address (GPA) of the first memory page to the host physical address (HPA), and read the information of the first application status stored in the physical memory page of the host physical address (HPA).

[0124] Step 404: The computing device 100 determines a second memory page in the second memory space based on the first memory page; wherein the second memory page is used to store status information of the first application.

[0125] In a possible scenario, the first memory space includes N first memory slices, and the N first memory slices are mapped to files respectively; the second memory space includes N second memory slices, and at least part of the N second memory slices are mapped to files; the N second memory slices correspond to the N first memory slices one by one. It should be noted that the file mapped by the memory slice has a file name, and the corresponding file can be located by the file name. In the embodiment of the present application, the file with the file name is called a named file. It should be noted that in the embodiment of the present application, the second memory space and the first memory space are both virtual memory spaces (generally virtual machine physical address (GPA) space). For the second memory space and the first memory space, after the memory space is mapped to the file, it can be considered that the physical memory space where the file is located is allocated to the memory space. If the second memory slice and the first memory slice are mapped to the same file, it means that the physical memory space allocated to the second memory slice and the physical memory space allocated to the first memory slice are the same, in other words, they share the same physical memory space; otherwise they are different.

[0126] It should be noted that the embodiment of the present application adopts the method of segmented mapping of named files to allocate physical memory space for the second memory slice of the second virtual machine. Subsequently, the physical memory space of the first virtual machine can be directly allocated to the memory slice of the second virtual machine to realize the sharing of physical memory space. First, the method of segmented mapping of named files is exemplified. For example, for a virtual machine with 4G memory, when the memory slice size is 512MB, up to 8 address mapping relationships (i.e., memory slices) will be established for it, of which 0-512MB is mapped to a named file, 512MB-1GB is mapped to another named file, and so on. In the embodiment of the present application, the computing device 100 allocates as much physical memory space as needed in the process of starting the second virtual machine. Therefore, only a small number of second memory slices are mapped to named files, and the second memory slices that are not mapped to named files are not allocated physical memory space. Exemplarily, when the computing device 100 just creates the second virtual machine, it only maps the second memory slice that currently needs to be accessed, such as 0-512MB; during the execution of the second virtual machine, it may need to access the memory page at 513MB. Since the physical memory space of this memory page is not initially allocated, this memory access will cause virtualization to exit. The virtualization management software finds that the accessed memory page falls within the memory slice 512MB-1GB, so it maps a new named file to this memory slice of the second virtual machine, thereby realizing on-demand mapping of memory slices. A second virtual machine that does not run any services after startup may have only a few memory slices mapped with named files.

[0127] For example, Figure 5aAs shown, the first memory space includes 6 memory slices, denoted as A1, A2, A3, A4, A5, A6; A1, A2, A3, A4, A5, A6 are respectively mapped to six files: F1, F2, F3, F4, F5, F6; A1, A2, A3, A4, A5, A6 are each allocated a physical memory fragment: B1, B2, B3, B4, B5, B6; the identifier of the memory page of A1, A2, A3, A4, A5, A6 is a virtual page frame number (VPFN), and the range of the virtual page frame number (VPFN) of A1, A2, A3, A4, A5, A6 is 1-10, 11 -20, 21-30, 31-40, 41-50, 51-60, where 1-10 means A1 has 10 memory pages, each of which is identified as 1, 2, ..., 10, and 11-20, 21-30, 31-40, 41-50, 51-60 are similar and will not be repeated here. It should be noted that since A1, A2, A3, A4, A5, and A6 are mapped to six files respectively, each of which is allocated a physical memory fragment, the virtual page frame number (VPFN): 1-60 memory pages all correspond to a host physical address (HPA), which is used to indicate the location of the physical memory page. After the first computing device 100 starts the second virtual machine, a second memory space is obtained. The second memory space includes 6 memory slices, denoted as a1, a2, a3, a4, a5, and a6, wherein a1 and a5 are respectively mapped to files, denoted as f1 and f5; wherein A1 corresponds to a1, A2 corresponds to a2, A3 corresponds to a3, A4 corresponds to a4, A5 corresponds to a5, and A6 corresponds to a6; a1 and a5 are allocated physical memory fragments: b1 and b5. a2, a3, a4, and a6 are not allocated with physical memory segments (indicated by dotted lines in the figure); it should be noted that since a1 and a5 are mapped to six files respectively, each of which is allocated with a physical memory segment, the virtual page frame number (VPFN): 1-10 and 41-50 memory pages all correspond to a host physical address (HPA), which is used to indicate the location of the physical memory page; however, the memory pages 11-40 and 51-60 do not correspond to a host physical address (HPA).

[0128] In this scenario, step 404 may include: for each first memory page, determining the first target memory slice where the first memory page is located in the N first memory slices; determining the second target memory slice, the second target memory slice being the memory slice corresponding to the first target memory slice in the N second memory slices; and determining the second memory page in the second memory space based on the first target memory slice and the second target memory slice. In an embodiment of the present application, the second memory page may be a memory page used for application recovery by the second virtual machine. Specifically, the computing device 100 may read the state information of the first application through the virtual machine physical address (GPA) of the second memory page. In addition, if the virtual page frame number (VPFN) of the first memory page and the second memory page is the same, it can be considered that the first memory page and the second memory page are the same memory page and have the same virtual machine physical address (GPA); in other words, if the virtual page frame number (VPFN) of the first memory page and the second memory page is the same, or the virtual machine physical address (GPA), it can be considered that the first memory page and the second memory page are the same memory page.

[0129] It should be noted that the mapping situations of the first target memory slice and the second target memory slice to the file are different, and the corresponding methods of determining the second memory page in the second memory space based on the first target memory slice and the second target memory slice are different. Among them, there are the following three mapping situations of the first target memory slice and the second target memory slice to the file, and there are also three corresponding processing methods. For the convenience of description and distinction, the file mapped by the first target memory slice can be called the first file, and the file mapped by the second target memory slice can be called the second file. Each situation and the processing method of each situation are described in detail below.

[0130] In a possible situation Sa, when the name of the first file and the name of the second file are the same, it can be considered that the first memory page has been mapped to the second memory space, and no additional processing is required, and the first memory page can be directly used as the second memory page. It should be noted that due to the names of the files mapped by the first target memory slice and the second target memory slice, the first target memory slice and the second target memory slice share the same physical memory space. Considering that the virtual machine physical address (GPA) space of the first memory space and the second memory space is the same, for the second memory space, the state information of the first application stored in the physical memory page corresponding to the first memory page can be accessed through the virtual machine physical address (GPA) of the first memory page, so the first memory page can be directly used as the second memory page.

[0131] In another possible situation Sb, when the second target memory slicing does not have a mapped second file, the first file is used as the file mapped by the second target memory slicing, and subsequently, the first file is mapped to the second target memory slicing, so that the first target memory slicing and the second target memory slicing share the first memory page, and then the first memory page is determined as the second memory page. It should be noted that when the second target memory slicing does not have a mapped second file, it means that the computing device 100 has not yet allocated the actual physical memory space to the second target memory slicing. After mapping the second target memory slicing to the first file (the mapped file of the first target memory slicing), the computing device 100 now believes that the actual physical memory space allocated to the second target memory slicing, because the names of the files mapped by the first target memory slicing and the second target memory slicing are the same, the physical memory spaces allocated to the first target memory slicing and the second target memory slicing are the same, thereby realizing that the second target memory slicing and the first target memory slicing share the first memory page. In addition, considering that the virtual machine physical address (GPA) of the first memory space and the second memory space is the same, for the second memory space, the state information of the first application stored in the physical memory page corresponding to the first memory page can be accessed through the virtual machine physical address (GPA) of the first memory page, so the first memory page can be used as the second memory page.

[0132] In another possible situation Sc, when the names of the files mapped by the first target memory slice and the second target memory slice are different, the first memory page and the third memory page (a blank memory page, referred to as a blank page in the embodiment of the present application) in the second memory space are exchanged, so that the state information of the first application stored in the first memory page can be accessed through the third memory page, and then the third memory page can be used as the second memory page. It should be noted that the names of the files mapped by the first target memory slice and the second target memory slice are different, which means that the physical memory space allocated by the computing device 100 to the second target memory slice and the first target memory slice is different. After completing the exchange of the first memory page and the third memory page, at this time, the state information of the first application stored in the physical memory page corresponding to the first memory page can be accessed through the virtual machine physical address (GPA) of the third memory page, so the third memory page can be used as the second memory page.

[0133] The first memory page and the third memory page can be exchanged in the following two ways:

[0134] Implementation IM1: The computing device 100 exchanges the host physical addresses (HPA) corresponding to the first memory page and the third memory page. In this way, the physical memory page corresponding to the first memory page becomes the physical memory page corresponding to the third memory page, and the physical memory page corresponding to the third memory page becomes the physical memory page corresponding to the first memory page.

[0135] In actual applications, the computing device 100 stores an address translation table, and modifies the host physical address (HPA) corresponding to the first memory page in the address translation table to the host physical address (HPA) corresponding to the third memory page, and modifies the host physical address (HPA) corresponding to the third memory page to the host physical address (HPA) corresponding to the first memory page, thereby realizing the exchange of the first memory page and the third memory page.

[0136] It should be noted that if implementation method IM1 is adopted, the specific implementation method of step 404 can be expressed as: for each first memory page, the computing device 100 corresponds the host physical address (HPA) corresponding to the first memory page to the memory page of the second memory space, thereby determining the second memory page, and the second inner page page corresponds to the host physical address (HPA) corresponding to the first memory page.

[0137] Implementation method IM2: The computing device 100 writes the state information of the first application of the physical memory page of the first memory page into the physical memory page of the third memory page.

[0138] Corresponding to implementation method IM2, considering that the first memory page may be relatively large, adopting the data writing method may increase the data processing amount and increase the duration of memory page exchange.

[0139] The above implementations IM1 and IM2 are merely examples of exchanging the first memory page and the third memory page, and do not constitute a specific limitation. In other examples, a portion of the first memory page adopts the implementation IM1, and another portion of the first memory page adopts the implementation IM2.

[0140] For ease of description and distinction, in this embodiment of the present application, the second memory slice where the third memory page is located is referred to as the third target memory slice.

[0141] In some optional manners, the process of the computing device 100 determining the third memory page in the third target memory slice may be:

[0142] First, determine whether the memory page corresponding to the first memory page in the third target memory slice is a blank page. If so, use the memory page as the third memory page. Otherwise, use any other blank page in the third target memory slice as the third memory page.

[0143] The memory page corresponding to the first memory page in the third target memory slice can be understood as: the memory page in the third target memory slice having the same virtual page frame number (VPFN) as the first memory page. The second memory page determined in this way has the same virtual page frame number (VPFN) as the first memory page, which can reduce the complexity of subsequent processing and improve the processing speed to a certain extent.

[0144] In a possible scenario, the third target memory slice is the second target memory slice, and correspondingly, the third memory page is located in the second target memory slice.

[0145] In a specific implementation, when the computing device 100 determines that there are blank pages in the second target memory slice, the second target memory slice may be used as the third target memory slice.

[0146] In a possible scenario, the third target memory slice is located in a second memory slice outside the second target memory slice, and the third memory page is located in the second memory slice outside the second target memory slice.

[0147] In this scenario, the process of exchanging the first memory page and the third memory page in the second memory space can be as follows: if there is no blank page in the second target memory slice, determine the third target memory slice outside the second target memory slice of the second virtual machine, and determine the third memory page in the third target memory slice, and exchange the host physical address (HPA) of the physical memory page corresponding to the first memory page and the third memory page, so that the status information of the first application can be accessed through the third memory page.

[0148] Optionally, the process of determining the third target memory slice can be: searching for a memory slice of a blank page in the N second memory slices; if found, the found memory slice is used as the target memory slice; if not found, a new memory slice is created (for the convenience of description and distinction, it can be called a newly added memory slice), then it is necessary to first map the newly added memory slice to a file (for the convenience of description and distinction, it can be called a newly added file), and then use the newly added memory slice as the third target memory slice. It should be noted that in actual applications, the first memory space allocated to the first virtual machine may be larger than the space formed by the N first memory slices. Considering that the first virtual machine allocates memory slices as needed, a new memory slice can be added when there is still space left in the first memory space. If there is still space left in the first memory space configured by the first virtual machine, the corresponding second virtual machine is the same, and the computing device 100 can create a new memory slice according to actual needs. Therefore, the newly added file is a file other than the famous files mapped by the N first memory slices and the N second memory slices.

[0149] Among them, the process of searching for a memory slice with a blank page in N second memory slices can be: for each second memory slice of the second virtual machine, if the second memory slice does not have a named file mapped, and its corresponding first memory slice maps a named file, then after mapping the named file mapped by the first memory slice to its corresponding second memory slice, it is determined whether the second memory slice has a blank page. It should be noted that by adopting such a method, it is more convenient and faster to realize the mapping of the first memory space to the second memory space, so that the second virtual machine can quickly know the second memory page where the status information of the first application is located.

[0150] like Figure 5b As shown, in Figure 5a On the basis of, after freezing the application running in the first virtual machine, the computing device 100 identifies the first memory page where the state information of the running application is located, assuming there are 9, recorded as P1:5, P2:20, P3:21, P4:25, P5:35, P6:45, P7:53, P8:54, P9:60. Among them, P1:5 represents that the first memory page P1 is a memory page with a virtual page frame number (VPFN) of 5 in the first memory space. P2:20, P3:21, P4:25, P5:35, P6:45, P7:53, P8:54, P9:60 are similar and will not be repeated.

[0151] Among them, for the first memory page P1 (a memory page with a virtual page frame number (VPFN) of 5 in the first memory space), the physical memory page corresponding to the first memory page P1 is the physical memory page h1 in the physical memory slice B1.

[0152] The first memory page P2 (a memory page whose virtual page frame number (VPFN) is 20 in the first memory space), and the physical memory page corresponding to the first memory page P2 is the physical memory page h2 in the physical memory slice B2.

[0153] The first memory page P3 (a memory page whose virtual page frame number (VPFN) is 21 in the first memory space), and the physical memory page corresponding to the first memory page P3 is the physical memory page h3 in the physical memory slice B3.

[0154] The first memory page P4 (a memory page whose virtual page frame number (VPFN) is 25 in the first memory space), and the physical memory page corresponding to the first memory page P4 is the physical memory page h4 in the physical memory slice B3.

[0155] The first memory page P5 (a memory page whose virtual page frame number (VPFN) is 35 in the first memory space), and the physical memory page corresponding to the first memory page P5 is the physical memory page h5 in the physical memory slice B4.

[0156] The first memory page P6 (a memory page whose virtual page frame number (VPFN) is 45 in the first memory space), and the physical memory page corresponding to the first memory page P6 is the physical memory page h6 in the physical memory slice B5.

[0157] The second memory page P7 (a memory page whose virtual page frame number (VPFN) is 53 in the first memory space), the physical memory page corresponding to the first memory page P7 is the physical memory page h7 in the physical memory slice B6.

[0158] The second memory page P8 (a memory page whose virtual page frame number (VPFN) is 54 in the first memory space), the physical memory page corresponding to the first memory page P8 is the physical memory page h8 in the physical memory slice B6.

[0159] The second memory page P9 (a memory page whose virtual page frame number (VPFN) is 60 in the first memory space), the physical memory page corresponding to the first memory page P9 is the physical memory page h9 in the physical memory slice B6.

[0160] In summary, in the first physical memory space, the state information of the first application is stored through h1 to h9.

[0161] For the second virtual machine, the memory page with a virtual page frame number (VPFN) of 5 in the second memory space is a blank page, and the corresponding physical memory page is the physical memory page h10 in the physical memory slice b1. The memory page with a virtual page frame number (VPFN) of 45 in the second memory space corresponds to the physical memory page h11 in the physical memory slice b5; the memory page with a virtual page frame number (VPFN) of 46 is a blank page, and the corresponding physical memory page is the physical memory page h12 in the physical memory slice b5.

[0162] Assume that the first memory pages P1, P2, ..., P9 are processed sequentially. Figure 5c The result after the first memory pages P1, P2, ..., P9 are mapped to the second memory space is shown below. Figure 5b to Figure 5c Describe the process in between.

[0163] Among them, for the first memory page P1 (a memory page with a virtual page frame number (VPFN) of 5 in the first memory space), the first memory page P1 (a memory page with a virtual page frame number (VPFN) of 5 in the first memory space) is located in memory slice A1, memory slice A1 corresponds to memory slice a1, the file F1 mapped by memory slice A1 is different from the file f1 mapped by memory slice a1, and there is a third memory page (a blank page with a virtual page frame number (VPFN) of 5 in the second memory space) in memory slice a1, then the host physical address (HPA) of the physical memory page h1 of the first memory page P1 and the physical memory page h10 of the third memory page (a blank page with a virtual page frame number (VPFN) of 5 in the second memory space) are exchanged, so that the physical memory page h10 of the third memory page (a blank page with a virtual page frame number (VPFN) of 5 in the second memory space) is changed to h1, and the memory page with a virtual page frame number (VPFN) of 5 in the second memory space is used as the second memory page.

[0164] For the first memory page P2 (the memory page with a virtual page frame number (VPFN) of 20 in the first memory space), the first memory page P2 (the memory page with a virtual page frame number (VPFN) of 20 in the first memory space) is located in memory slice A2, memory slice A2 corresponds to memory slice a2, memory slice a2 is not mapped to a file, and memory slice a2 is mapped to file F2 corresponding to memory slice A2. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 20 in the second memory space is h2, and the memory page with a virtual page frame number (VPFN) of 20 in the second memory space can be used as the second memory page.

[0165] For the first memory page P3 (the memory page with a virtual page frame number (VPFN) of 21 in the first memory space), the first memory page P3 (the memory page with a virtual page frame number (VPFN) of 21 in the first memory space) is located in memory slice A3, memory slice A3 corresponds to memory slice a3, memory slice a3 is not mapped to a file, and memory slice a3 is mapped to file F3 corresponding to memory slice A3. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 21 in the second memory space is h3, and the memory page with a virtual page frame number (VPFN) of 21 in the second memory space can be used as the second memory page.

[0166] For the first memory page P4 (the memory page with a virtual page frame number (VPFN) of 25 in the first memory space), the first memory page P4 (the memory page with a virtual page frame number (VPFN) of 25 in the first memory space) is located in memory slice A3, memory slice A3 corresponds to memory slice a3, memory slice a3 is mapped to file F3, and the file F3 mapped to memory slice A3 is the same as the file F3 mapped to memory slice a3. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 25 in the second memory space is h4, and the memory page with a virtual page frame number (VPFN) of 25 in the second memory space can be used as the second memory page.

[0167] For the first memory page P5 (the memory page with a virtual page frame number (VPFN) of 35 in the first memory space), the first memory page P5 (the memory page with a virtual page frame number (VPFN) of 35 in the first memory space) is located in memory slice A4, memory slice A4 corresponds to memory slice a4, memory slice a4 is not mapped to a file, and memory slice a4 is mapped to file F4 corresponding to memory slice A4. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 35 in the second memory space is h5, and the memory page with a virtual page frame number (VPFN) of 35 in the second memory space can be used as the second memory page.

[0168] For the first memory page P6 (the memory page with a virtual page frame number (VPFN) of 45 in the first memory space), the first memory page P6 (the memory page with a virtual page frame number (VPFN) of 45 in the first memory space) is located in memory slice A5, memory slice A5 corresponds to memory slice a5, and the file f5 mapped to memory slice a5 is different from the file F5 mapped to memory slice A5. If the memory page with a virtual page frame number (VPFN) of 45 in memory slice A5 is not a blank page, but the memory page with a virtual page frame number (VPFN) of 46 is a blank page, the page is used as the third memory page. The host physical address (HPA) of the physical memory page h6 of the first memory page P6 and the physical memory page h12 of the third memory page (the memory page with the virtual page frame number (VPFN) being 46 in the second memory space) are exchanged. In this way, the physical memory page h12 of the third memory page (the memory page with the virtual page frame number (VPFN) being 46 in the second memory space) is changed to h6, and the memory page with the virtual page frame number (VPFN) being 46 in the second memory space can be used as the second memory page.

[0169] exist Figure 5bSome possible scenarios not shown, if there is no blank page in the memory slice a5, in one possible case, a blank page in any memory slice of the memory slices a1 to a4 can be selected as the third memory page to be exchanged with the first memory page P6, and then the third memory page in the second memory space can be used as the second memory page.

[0170] For the first memory page P7 (the memory page with a virtual page frame number (VPFN) of 53 in the first memory space), the first memory page P7 (the memory page with a virtual page frame number (VPFN) of 53 in the first memory space) is located in memory slice A6, memory slice A6 corresponds to memory slice a6, memory slice a6 is not mapped to a file, and memory slice a6 is mapped to file F6 corresponding to memory slice B6. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 53 in the second memory space is h7, and the memory page with a virtual page frame number (VPFN) of 53 in the second memory space can be used as the second memory page.

[0171] For the first memory page P8 (the memory page with a virtual page frame number (VPFN) of 54 in the first memory space), the first memory page P8 (the memory page with a virtual page frame number (VPFN) of 54 in the first memory space) is located in memory slice A6, memory slice A6 corresponds to memory slice a6, memory slice a6 is mapped to file F6, and the file F6 mapped to memory slice A6 is the same as the file F6 mapped to memory slice a6. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 54 in the second memory space is h8, and the memory page with a virtual page frame number (VPFN) of 54 in the second memory space can be used as the second memory page.

[0172] The first memory page P9 is similar to the first memory page P8 and will not be described in detail.

[0173] In another possible situation, the blank page in the memory slice a6 and the host physical address (HPA) corresponding to the first memory page P6 (the memory page with the virtual page frame number (VPFN) of 45 in the first memory space) may be selected for exchange.

[0174] In this case, the specific processing process is: map the memory slice a6 to the file F6 mapped by the memory file A6, and then determine the blank page in the memory slice a6 (assuming that it is a memory page with a virtual page frame number (VPFN) of 55 in the second memory space) and the host physical address (HPA) corresponding to the first memory page P6 to be exchanged, and the memory page with a virtual page frame number (VPFN) of 55 in the second memory space can be used as the second memory page.

[0175] For the first memory page P7 (the memory page with a virtual page frame number (VPFN) of 53 in the first memory space), the first memory page P7 (the memory page with a virtual page frame number (VPFN) of 53 in the first memory space) is located in memory slice A6, memory slice A6 corresponds to memory slice a6, memory slice a6 is mapped to file F6, and the file F6 mapped to memory slice A6 is the same as the file F6 mapped to memory slice a6. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 53 in the second memory space is h7, and the memory page with a virtual page frame number (VPFN) of 53 in the second memory space can be used as the second memory page.

[0176] The first memory pages P8 and P9 are similar to the first memory page P7 and are not described in detail.

[0177] After the processing is completed, the second physical memory space of the second memory space includes the physical memory spaces represented by b1, B2, B3, B4, b5, and B6.

[0178] It should be noted that the above implementation is only an example. In some possible cases, after determining the first memory page, in order to facilitate processing, for each first memory slice of the first virtual machine, if the first memory slice is mapped with a named file and its corresponding second memory slice is not mapped with a named file, the named file mapped by the first memory slice is mapped to its corresponding second memory slice, so that the first memory slice and its corresponding second memory slice have the same named file. Then, the second memory page is determined according to the above-described cases Sb and Sc. Correspondingly, relative to the above-described Figure 5b to Figure 5c The transformation process is as follows:

[0179] First, in the second memory space, the second memory slices a2, a3, a4, and a6 are mapped to the named files F2, F3, F4, and F6;

[0180] Secondly, for the first memory page P2 (the memory page with a virtual page frame number (VPFN) of 20 in the first memory space), the first memory page P2 (the memory page with a virtual page frame number (VPFN) of 20 in the first memory space) is located in memory slice A2, memory slice A2 corresponds to memory slice a2, and memory slice a2 is mapped to file F2. In this way, the physical memory page corresponding to the memory page with a virtual page frame number (VPFN) of 20 in the second memory space is h2, and the memory page with a virtual page frame number (VPFN) of 20 in the second memory space is used as the second memory page.

[0181] The first memory pages P3, P5, P6, and P7 are similar and will not be described in detail.

[0182] Step 405: The computing device 100 resumes the frozen first application in the first virtual machine through the second kernel of the second virtual machine based on the state information of the first application stored in the second memory page.

[0183] In a feasible implementation, the computing device 100 includes a freezing tool. In a specific implementation, the computing device can restore the application through the freezing tool.

[0184] Exemplarily, the computing device 100 reads state information of an application running on the first virtual machine from the memory based on the second memory page; then, based on the read state information of the application running on the first virtual machine, the computing device 100 restores the state information inside the application and the state information maintained by the first kernel for the application, thereby realizing application recovery.

[0185] exist Figure 5c In the scenario, there are multiple second memory pages, including memory pages with virtual page frame numbers (VPFN) of 5, 20, 21, 25, 35, 46, 53, 54, and 60 in the second memory space; in a specific implementation, the computing device 100 determines the corresponding virtual machine physical address (GPA) based on the memory pages with virtual page frame numbers (VPFN) of 5, 20, 21, 25, 35, 46, 53, 54, and 60 in the second memory space; and determines the host physical address (HPA) corresponding to the virtual machine physical address (GPA) through an address translation table, and reads the state information of the application running on the first virtual machine from the memory based on the host physical address (HPA); then, based on the read state information of the application running on the first virtual machine, restores the internal state information of the application and the state information maintained by the first kernel for the application to achieve application recovery.

[0186] In the embodiment of the present application, the service interruption starts from the freezing of the application after the new virtual machine is started. Since the service interruption time does not include the time of starting the new virtual machine, the duration of the service interruption can be reduced to a certain extent.

[0187] Figure 6a A flow chart of another method for recovering an application of a virtual machine provided in an embodiment of the present application is shown. Figure 6b A scenario diagram of another method for recovering an application of a virtual machine provided in an embodiment of the present application is shown.

[0188] like Figure 6a and Figure 6b As shown, in Figure 4a Based on the steps 401 to 405 shown in the figure, in the embodiment of the present application, after step 401 and before step 402, at least the following steps are included:

[0189] Step 601: The computing device 100 writes the non-persistent data stored in the first memory space into the file system of the first virtual machine for persistence.

[0190] In practical applications, such as Figure 6b As shown, the specific method of the computing device 100 writing the non-persistent data stored in the first memory space to the file system of the first virtual machine is: writing to the disk partition. It should be noted that the storage device used to store information in the computing device is mainly a hard disk, but the hard disk cannot be used directly. The hard disk must be divided into one or more hard disk areas (disk partitions), and then the disk partitions are formatted (a file system is created on the disk partitions) before they can be used.

[0191] In specific implementation, when the computing device runs the first virtual machine, the first virtual machine will frequently generate data, and the generated data needs to be written to the disk for persistence; at the same time, the first virtual machine will also frequently read data for processing. Considering that it takes a long time to read data from the disk, and the disk's read and write speed is far behind the speed of the memory, in actual applications, when the computing device runs the first virtual machine, the data generated by the first virtual machine needs to be written to the memory cache first, and when the amount of cached data is large or the buffer is full, the data is written to the disk for persistence; when the data needs to be read, if the data is cached in the memory, the data can be directly read from the memory, and if the data is not cached in the memory, the data is read from the disk, thereby improving the efficiency of reading data to a certain extent.

[0192] In addition, data has metadata (used to describe data). In specific implementations, data can be continuously modified through metadata, so the state of data is also constantly changing. The state of data can be understood as the state of the data content. If the data content does not change, the state of the data does not change. Correspondingly, the file system that stores data also has a state. When the file system is not in the latest state, it means that the data in the file system is not the latest data.

[0193] In summary, non-persistent data may be stored in the first memory space. When non-persistent data is stored in the first memory space, at this time, the state of the file system is not the latest state (the data in the file system is not the latest data); before freezing the application running on the first virtual machine, the computing device writes the non-persistent data stored in the first memory space to the disk partition of the first virtual machine for persistence; in this way, after the application is subsequently frozen, there is no need to repair the file system (that is, restore the state of the file system to the latest state) or the amount of data that needs to be repaired (that is, the data generated between the completion of step 601 and the freezing of the application) is relatively small.

[0194] Figure 7aA flow chart of another method for recovering an application of a virtual machine provided in an embodiment of the present application is shown. Figure 7b A scenario diagram of another method for recovering an application of a virtual machine provided in an embodiment of the present application is shown.

[0195] like Figure 7a and Figure 7b As shown, in Figure 4a Based on steps 401 to 405 shown, Figure 6a On the basis of step 601, in the embodiment of the present application, after step 403 and before step 404, at least the following steps are included:

[0196] Step 603: The computing device 100 unmounts the file system of the first virtual machine.

[0197] It should be noted that if Figure 7b As shown, the specific implementation of the computing device 100 unloading the file system of the first virtual machine may be: the computing device 100 deletes the association between the file system of the disk partition and the file access directory of the first kernel to unload the file system on the disk partition.

[0198] The file system of the disk partition is a system used to organize and allocate space in the storage device in the computing device 100, responsible for file storage of the disk partition and protecting and retrieving the stored files; for example, the file system refers to a system that titles files and indicates the location of files for storage and retrieval.

[0199] Before using the disk partition, it is necessary to connect the file system of the disk partition with the file access directory of the first kernel of the first virtual machine in the computing device 100 to establish a mapping relationship. In this way, the computing device reads the data in the file access directory and then reads the file system of the disk partition. Exemplarily, the file system is mounted under the file access directory of the first file (for ease of description and distinction, it can be called the first file access directory).

[0200] Here, the computing device 100 can read all the file systems accessible to the first virtual machine in the computing device through the first file. That is to say, the first file can contain information about all the file systems accessible to the first virtual machine in the computing device 100. In this embodiment, the first file can include a readable and writable partition; for example, the first file can include / proc / mounts. It should be noted that the first kernel of the first virtual machine can treat all the resources in the computing device as files, so the resources of the entire computing device 100 can be integrated into a large file directory; when the first virtual machine needs to access the file system, it must connect the file system to the first file access directory that already exists in the computing device, and then access the file system by accessing this first file access directory.

[0201] The first file access directory provides a mount point, which is the entry directory of the file system of the disk partition. Mounting is the process of associating a disk partition to a specified directory. Mounting a disk partition enables the disk partition starting from the specified directory (i.e., the mount point) to be used, such as the userdata partition, whose mount point directory is / data. In an embodiment of the present application, the process of associating a file system to the first file access directory of the first file is the process of establishing a mapping relationship between the file system and the first file access directory. Among them, all file systems accessible to the first virtual machine in the computing device are mounted under the first file access directory, that is, all file systems accessible to the first virtual machine in the computing device are connected to the first file access directory in the readable and writable partition.

[0202] When the file system of the disk partition needs to be unmounted, the computing device 100 deletes the mount point directory corresponding to the first file access directory of the file system in the first file, so that the first kernel of the first virtual machine cannot access the data stored in the disk partition through the first file access directory, thereby realizing the unmounting of the file system of the disk partition.

[0203] In one example, in this embodiment, the file system can be unmounted by running the umount function. Alternatively, any process search method in the related art can be used to achieve the purpose of unmounting the file system on the disk partition, which is not limited in this embodiment.

[0204] It should be noted that, when the file system is unmounted, the first kernel of the first virtual machine deletes various cached information from the first memory space, including the index of the file system.

[0205] Step 604: The computing device 100 mounts the file system of the first virtual machine to the second virtual machine.

[0206] It should be noted that if Figure 7bAs shown, the specific implementation process of the computing device 100 mounting the file system of the first virtual machine to the second virtual machine can be: the computing device 100 establishes an association between the file system of the disk partition of the first virtual machine and the file access directory of the second kernel to mount the file system on the disk partition so that the second virtual machine can access the files in the disk partition.

[0207] For details, please refer to the above description of mounting the file system to the first file access directory, which will not be repeated here. For example, in a specific implementation, the second file access directory of the second kernel includes a mount point, and the computing device 100 mounts the disk partition on the mount point. Subsequently, the second kernel can access the disk partition through the mount point to mount the file system. It should be noted that when the file system is mounted to the second kernel, the second kernel re-executes the operation of scanning the storage medium and writing the index of the file system in the second memory space.

[0208] It is worth noting that there is a certain time difference between the moment when step 601 is completed and the moment when step 402 (freezing the application) is started. Since the application has not been frozen within this time difference, some temporary data will be generated in the memory, and these data need to be persisted so that the file system is in the latest state. Therefore, when the computing device 100 executes step 604, it will check whether the file system is up to date. If not, it is necessary to write the data that is not persisted in the first memory space to the disk partition for persistence again to achieve the repair of the file system. In the embodiment of the present application, the time between the moment when step 601 ends and the moment when step 402 is started is short, and the amount of temporary data generated is small. Even if the file system needs to be repaired (updated to the latest state), it will not take too much time.

[0209] In this solution, before the running application of the original virtual machine is frozen, the non-persistent data in the memory is written to the disk for persistence, so that the status of the file system is the latest (that is, the data is the latest); subsequently, the new virtual machine can directly mount the file system without the need to repair the file system (that is, if the data is not the latest, update the data to the latest status) or the amount of data that needs to be repaired is extremely small, thereby speeding up the mounting of the file system of the new virtual machine.

[0210] Figure 8a A flow chart of another method for recovering an application of a virtual machine provided in an embodiment of the present application is shown. Figure 8b A scenario diagram of another method for recovering an application of a virtual machine provided in an embodiment of the present application is shown.

[0211] like Figure 8a and Figure 8b As shown, in Figure 4a Steps 401 to 405 shown in FIG. Figure 6a Step 601, Figure 7a On the basis of step 603 and step 604 shown in the figure, in the embodiment of the present application, after step 601 and before step 603, at least the following steps are further included:

[0212] Step 602: The computing device 100 kills the task that is accessing the file system of the first virtual machine.

[0213] It should be noted that when the computing device 100 has a task to access a file system on a disk partition, the file system may not be uninstalled. Figure 8b As shown, the computing device kills the task that is accessing the file on the disk partition.

[0214] For some types of operating systems, in this embodiment, the PID (Process Identification) of the process accessing the file on the disk partition of the first virtual machine can be identified by running the lsof (list openfiles) command or the fuser (find user processes) command. Alternatively, any process search method in the relevant technology can be used to achieve the purpose of finding the process accessing the above file, which is not limited in this embodiment.

[0215] In this embodiment, the process accessing the above file can be terminated by running the kill function or some advanced functions of the fuser command. Alternatively, any process search method in the relevant technology can be used to kill the process accessing the above file, which is not limited in this embodiment.

[0216] Based on the method for recovering an application of a virtual machine provided above, a specific application of the method for recovering an application of a virtual machine is described. Figure 9a A flowchart of a specific application of a method for recovering an application of a virtual machine provided for the implementation of this application; Figure 9b A schematic diagram of a specific application scenario of a method for recovering an application of a virtual machine provided for the implementation of the present application.

[0217] like Figure 9a and Figure 9b As shown, the specific contents include: upgrade preparation stage and service interruption stage. The inventor has verified through experiments that the upgrade preparation stage can be completed in seconds, and the service interruption stage can be achieved in hundreds of milliseconds, that is, the service interruption time is controlled within a few hundred milliseconds.

[0218] During the upgrade preparation phase, the upgrade management system creates a first image file through the second image file, and starts a second virtual machine with an upgraded second kernel through the first image file. The second virtual machine has the same configuration as the first virtual machine to be upgraded. In order to avoid the impact of the ARP address broadcast message of the second virtual machine on the virtual machine to be upgraded, the first virtual machine needs to temporarily turn off the ARP mechanism; after the second virtual machine is started, the first virtual machine can be notified to synchronize the status of the file system, that is, to write the non-persistent data in the memory to the disk partition for persistence to achieve memory data landing on the disk, so as to reduce the amount of data that needs to be written back to the file system when the file system is subsequently unmounted.

[0219] Service interruption stage: Since file system synchronization generally takes a long time, the application running on the first virtual machine is frozen after the file system synchronization is completed, and the CRIU tool is used to determine the memory page (referred to as the first memory page) where the state of the application running on the first virtual machine is located; after the state is saved, the upgrade management system is notified to map the memory pages of the second virtual machine and the first virtual machine, which can be specifically implemented by sharing the state of the saved application (see the case Sa and the case Sb described in step 404 for details) or transferring the page ownership (see the case Sc described in step 404 for details); after the sharing / transfer of the memory page is completed, the first virtual machine can kill the running task to release the reference to the file system so that the file system can be unloaded later. For the case of supporting forced unloading of the file system in use, it is not necessary to kill the task. At this point, the second virtual machine can also mount the relevant file system, and then restore the application running on the first virtual machine in the second memory space of the second virtual machine through tools such as CRIU, and finally open APR to restore the network. Subsequently, the upgrade management system can shut down the first virtual machine.

[0220] Based on the same concept as the embodiment of the method of the present application, the embodiment of the present application also provides a device for application recovery of a virtual machine. The device for application recovery of a virtual machine includes several modules, each of which is used to execute each step in the method for application recovery of a virtual machine provided in the embodiment of the present application, and the division of modules is not limited here. In addition, the specific names of the modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present application. The specific working process of the modules in the above-mentioned device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0221] For example, the device for recovering an application of a virtual machine is used to execute the method for recovering an application of a virtual machine provided in an embodiment of the present application. Fig.10 Schematic diagram of the structure of the device for recovering the application of the virtual machine provided in the embodiment of the present application. Fig.10 As shown, the device 1000 for recovering an application of a virtual machine provided in an embodiment of the present application includes:

[0222] A startup module 1001 is used to start a second virtual machine; wherein the second virtual machine includes a second kernel and a second memory space; the second kernel is a kernel upgraded from the first kernel; the first virtual machine and the second virtual machine have the same configuration;

[0223] A freezing module 1002, configured to freeze a first application running in the first virtual machine;

[0224] A marking module 1003, configured to determine a first memory page from the first memory space; wherein the first memory page is used to store state information of the first application;

[0225] A mapping module 1004, configured to determine a second memory page in the second memory space based on the first memory page; wherein the second memory page is used to store state information of the first application;

[0226] The recovery module 1005 is used to recover the frozen first application in the first virtual machine through the second kernel of the second virtual machine based on the state information of the first application stored in the second memory page.

[0227] In addition to the above methods, devices and electronic devices, the embodiments of the present application may also provide a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps in the method for application recovery of the virtual machine of various embodiments of the present application described in the "Method" section of the present specification. Wherein, the computer program product can be written in any combination of one or more programming languages ​​to perform computer program codes for the operation of the embodiments of the present application, and the programming languages ​​include object-oriented programming languages, such as Java, C++, etc., and also include conventional procedural programming languages, such as "C" language or similar programming languages. Wherein, the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer program code can be executed completely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on the remote computing device, or completely on the remote computing device or server.

[0228] In addition, the embodiment of the present application may also provide a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions, when executed by the processor, cause the processor to execute the steps in the method for application recovery of the virtual machine according to various embodiments of the present disclosure described in the above "Method" section of this specification. The computer-readable storage medium may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may, for example, include but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of readable storage media (non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0229] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.

[0230] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.

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

[0232] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0233] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. must be possessed by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the fact that the above specific details must be used to implement.

[0234] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.

[0235] It should also be noted that in the apparatus, device and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.

[0236] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

[0237] It should be understood that the various numerical numbers involved in the embodiments of the present application are only used for the convenience of description and are not used to limit the scope of the embodiments of the present application.

Claims

1. A method for recovering an application of a virtual machine, characterized in that: Applied to a computing device, the computing device runs a first virtual machine; the first virtual machine includes a first kernel and a first memory space; wherein the first virtual machine runs a first application through the first kernel; The method comprises: Starting a second virtual machine; wherein the second virtual machine includes a second kernel and a second memory space; the second kernel is an upgraded kernel of the first kernel; the first virtual machine and the second virtual machine have the same configuration; Freezing a first application running in the first virtual machine; Determine a first memory page from the first memory space; wherein the first memory page is used to store state information of the first application; Based on the first memory page, determining a second memory page in the second memory space; wherein the second memory page is used to store state information of the first application; Based on the state information of the first application stored in the second memory page, resuming the operation of the frozen first application in the first virtual machine through the second kernel of the second virtual machine; The first memory space includes N first memory slices, where N is a positive integer greater than or equal to 2; the second memory space includes N second memory slices; wherein the N first memory slices correspond to the N second memory slices one by one; The determining, based on the first memory page, a second memory page in the second memory space includes: Determine a first target memory slice from the N first memory slices; wherein the first target memory slice is the memory slice where the first memory page is located; Determine, based on the first target memory slice, a second memory page in the second memory space; The first target memory slice has a mapped first file; Determining a second memory page in the second memory space based on the first target memory slice includes: Determine whether the second target memory slice has a mapped second file; wherein the second target memory slice is a memory slice corresponding to the first target memory slice among the N second memory slices; In a case where the second target memory slice does not have a mapped second file, using the first file as a mapped file of the second target memory slice; The first memory page is determined as the second memory page.

2. The method according to claim 1, characterized in that The method further comprises: In the case where the second target memory slice has a mapped second file, determining whether the name of the first file is the same as the name of the second file; When the name of the first file is the same as the name of the second file, the first memory page is determined as the second memory page.

3. The method according to claim 2, characterized in that The method further comprises: In a case where the name of the first file is different from the name of the second file, determining a third target memory slice among the N second memory slices; wherein the third target memory slice includes a third memory page, and the third memory page is a blank page in the third target memory slice; swapping the first memory page and the third memory page so that the state information of the first application stored in the first memory page can be accessed through the third memory page; Determine that the third memory page is the second memory page.

4. The method according to claim 3, characterized in that In the case where there are blank pages in the second target memory slice, the third target memory slice is the second target memory slice; In a case where the second target memory slice does not have a blank page, the third target memory slice is a second memory slice different from the second target memory slice.

5. The method according to any one of claims 1 to 4, characterized in that: Before freezing the first application running in the first virtual machine, the method further includes: The non-persistent data stored in the first memory space is written into the file system of the first virtual machine.

6. The method according to claim 5, characterized in that After determining the second memory page from the second memory space based on the first memory page, the method further includes: Uninstalling the file system of the first virtual machine; Before resuming the operation of the frozen first application in the first virtual machine through the second kernel of the second virtual machine, the method further includes: The file system is mounted to the second virtual machine.

7. The method according to claim 6, characterized in that Before uninstalling the file system of the first virtual machine, the method further includes: Terminates the task that is accessing the file system.

8. A computing device, characterized in that comprising a processor and a memory; wherein, The memory is used to store instructions; The processor is configured to execute the stored instructions so as to enable the computing device to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • KVM (Kernel-based Virtual Machine)-based on-line virtual-to-virtual migration method and device

    CN104598303A

  • Method and device for upgrading virtualization simulator

    CN110968392A

  • Virtual machine data migration method and device, computer equipment and storage medium

    CN112099916A

  • Virtual machine deployment and hot-migration methods, VMM upgrade method, and server

    US20230009596A1