Virtual machine processing method and device, equipment, storage medium and program product

By copying target snapshots in the anonymous memory area of ​​the virtual machine for use by virtual machines, the problem of data usage conflicts during virtual machine creation is solved, and the reliability of virtual machine data processing is improved.

CN119645569APending Publication Date: 2025-03-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411787522.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

When creating multiple virtual machines with the same memory snapshot, existing virtual machine creation methods can easily lead to data usage conflicts, reducing the reliability of virtual machine data processing.

Method used

When memory data does not exist in the anonymous memory area of ​​the target virtual machine, the memory data usage requirement of the virtual machine is detected, and the target snapshot is determined from each candidate snapshot of the host and copied it to the anonymous memory area for the virtual machine to make memory data calls.

Benefits of technology

When multiple virtual machines are pulled up with the same memory snapshot, the reliability of virtual machine data processing is improved and data usage conflicts are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645569A_ABST
    Figure CN119645569A_ABST
Patent Text Reader

Abstract

The invention relates to a virtual machine processing method and device, equipment, a storage medium and a program product. The method comprises the steps of determining a target snapshot required by a target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine under the conditions that no memory data exists in an anonymous memory area of the target virtual machine and that the target virtual machine has a memory data use requirement is detected, and copying the target snapshot into the anonymous memory area for the target virtual machine to call memory data. By adopting the method, the reliability of virtual machine data processing can be improved.
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 virtual machine processing method, device, equipment, storage medium and program product. Background Art

[0002] With the continuous development of computer technology, in order to meet the needs of cloud computing environment for rapid deployment and efficient use of resources, virtual machines can be used for data processing. In order to improve the efficiency of virtual machine creation. The existing virtual machine creation method is generally to map the memory snapshot in the host machine to the memory space of the virtual machine, and use the memory snapshot in the host machine as the memory data of the virtual machine.

[0003] However, using the existing virtual machine creation method, when using the same memory snapshot to create multiple virtual machines, data usage conflicts may occur, thereby reducing the reliability of virtual machine data processing. Summary of the invention

[0004] Based on this, it is necessary to provide a virtual machine processing method, device, equipment, storage medium and program product that can improve the reliability of virtual machine data processing in response to the above technical problems.

[0005] In a first aspect, the present application provides a virtual machine processing method, comprising:

[0006] When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine;

[0007] The target snapshot is copied to the anonymous memory area so that the target virtual machine can call the memory data.

[0008] In one embodiment, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine includes:

[0009] According to the virtual machine building request of the target virtual machine, snapshot identification information of the target snapshot required by the target virtual machine is determined; wherein the snapshot identification information includes the snapshot storage location and the snapshot offset; according to the snapshot identification information of the target snapshot, the target snapshot required by the target virtual machine is determined from each candidate snapshot stored in the host machine corresponding to the target virtual machine.

[0010] In one embodiment, detecting that a target virtual machine has a memory data usage requirement includes:

[0011] Obtain monitoring events fed back by the monitoring thread corresponding to the anonymous memory area; when there is a page fault mark in the monitoring event, determine that the monitoring thread detects that the target virtual machine has a memory data usage demand; wherein the page fault mark is used to indicate the existence of a memory usage demand for the anonymous memory area.

[0012] In one embodiment, the method further comprises:

[0013] After the target virtual machine is created, the anonymous memory area of ​​the target virtual machine is registered in the kernel of the host machine, and a corresponding monitoring thread is configured for the anonymous memory area.

[0014] In one embodiment, the method further comprises:

[0015] After the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

[0016] In one of the embodiments, when there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, before determining the target snapshot required by the target virtual machine from candidate snapshots stored in the host machine corresponding to the target virtual machine, the method further includes:

[0017] In response to a virtual machine construction request, the length of the memory region is determined according to the size of the memory space occupied by each candidate snapshot in the host machine; an anonymous memory region of the memory region length is configured for the target virtual machine to create a target virtual machine associated with the host machine.

[0018] In a second aspect, the present application further provides a virtual machine processing device, including:

[0019] A snapshot acquisition module is used to determine a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine when there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data;

[0020] The snapshot copy module is used to copy the target snapshot to the anonymous memory area so that the target virtual machine can call the memory data.

[0021] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0022] When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine;

[0023] The target snapshot is copied to the anonymous memory area so that the target virtual machine can call the memory data.

[0024] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0025] When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine;

[0026] The target snapshot is copied to the anonymous memory area so that the target virtual machine can call the memory data.

[0027] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0028] When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine;

[0029] The target snapshot is copied to the anonymous memory area so that the target virtual machine can call the memory data.

[0030] The above-mentioned virtual machine processing method, device, equipment, storage medium and program product, when there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for memory data use, determines the target snapshot required by the target virtual machine from the candidate snapshots stored in the host machine corresponding to the target virtual machine, and copies the target snapshot to the anonymous memory area for the target virtual machine to call the memory data. Compared with the related art, in which the memory snapshot in the host machine is directly mapped to the memory space of the virtual machine, the above-mentioned method, by copying the target snapshot to the anonymous memory area for the target virtual machine to call the memory data, can improve the reliability of data processing of each virtual machine when multiple virtual machines are pulled up using the same memory snapshot. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0032] Figure 1 A flowchart of a virtual machine processing method in one embodiment;

[0033] Figure 2A A schematic diagram of a process for determining a target snapshot in one embodiment;

[0034] Figure 2B A schematic diagram of memory snapshot storage in one embodiment;

[0035] Figure 3 A schematic diagram of a process for detecting memory data usage requirements in one embodiment;

[0036] Figure 4 A flowchart of target virtual machine operation in one embodiment;

[0037] Figure 5 A flowchart of a virtual machine processing method in another embodiment;

[0038] Figure 6 is a structural block diagram of a virtual machine processing device in one embodiment;

[0039] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0041] With the continuous development of computer technology, in order to meet the needs of cloud computing environment for rapid deployment and efficient use of resources, virtual machines can be used for data processing. In order to improve the efficiency of virtual machine creation. The existing virtual machine creation method is generally to map the memory snapshot in the host machine to the memory space of the virtual machine, and use the memory snapshot in the host machine as the memory data of the virtual machine.

[0042] However, using the existing virtual machine creation method, when using the same memory snapshot to create multiple virtual machines, data usage conflicts may occur, thereby reducing the reliability of virtual machine data processing.

[0043] Based on this, in an exemplary embodiment, Figure 1 As shown, a virtual machine processing method is provided, which is described by taking the method applied to a virtual machine processing device deployed in a host machine as an example, and specifically includes the following steps:

[0044] S101, when there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a memory data usage demand, determine a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine.

[0045] Among them, the virtual machine processing device is used to characterize a device that can process a virtual machine. In an embodiment of the present application, the virtual machine processing device may be a virtualization management platform StratoVirt. StratoVirt can directly pull up a virtual machine through a pre-built memory snapshot to save time-consuming virtual machine kernel loading and execution, user space initialization, etc., and realize rapid startup of the virtual machine. Specifically, the user calls the snapshot creation command provided by StratoVirt on the host machine to create memory snapshots in various states, which can completely persist the system memory of the virtual machine to the specified file of the host machine, and also persist the device state maintained by it in the form of a byte stream to the specified file of the host machine.

[0046] The target virtual machine is a virtual machine launched based on the memory snapshot in the host machine; the anonymous memory area is the memory area configured for the target virtual machine at the initial stage of creation, and there is no memory data in the anonymous memory area when it is created. In this application, the anonymous memory area is used to initialize the memory of the virtual machine; the candidate snapshot refers to the memory snapshot stored in the host machine. The so-called memory snapshot is a complete copy of the system memory state at a certain moment, including the running state of each process and thread, variable values, data structure and other information; the target snapshot is the memory snapshot required by the target virtual machine when launching the target virtual machine.

[0047] In one possible implementation, after starting the target virtual machine associated with the host machine, since there is no memory data in the anonymous memory area of ​​the target virtual machine, in order to ensure the feasibility of using the target virtual machine's memory data, the memory usage demand of the target virtual machine needs to be monitored.

[0048] When it is detected that the target virtual machine has a demand for memory data usage, the target snapshot required by the target virtual machine can be determined from candidate snapshots stored in a host machine corresponding to the target virtual machine according to the identification information of the target virtual machine.

[0049] S102, copying the target snapshot to the anonymous memory area for the target virtual machine to call memory data.

[0050] It is understandable that in the related art, the memory snapshot required by the virtual machine is directly mapped to the virtual machine, but when the same memory snapshot is allocated to multiple virtual machines, multiple virtual machines using the same memory snapshot will cause data anomalies. For example, virtual machine A and virtual machine B use memory snapshot 1 at the same time. If virtual machine A modifies the data in memory snapshot 1, then when virtual machine B uses memory snapshot 1 again, data anomalies will occur.

[0051] Based on this, in an embodiment of the present application, the target snapshot required by the target virtual machine can be copied to the anonymous memory area. In this way, the memory data usage of the target virtual machine can be guaranteed without modifying the target snapshot in the host machine, and the target snapshot can also pull up multiple virtual machines at the same time.

[0052] For example, for the StratoVirt-based secure container Kata (which can be regarded as a virtual machine), in the Function as a Service FaaS function computing platform, the Kata container can provide an isolated running environment. The FaaS function computing platform triggers execution through the application programming interface API-driven / event-driven form, and does not occupy computing and storage resources when there is no request.

[0053] After receiving the request, the FaaS function computing platform will use the memory snapshot in StratoVirt to pull up the secure container Kata in real time to respond to the request. That is, the user can create a secure container K1 in advance; then, use the interface provided by the secure container to create a runtime memory snapshot K' ​​of the secure container K1, and then pull up the secure containers K2 and K3 at the same time by copying the memory snapshot K' ​​to the anonymous memory area in the secure containers K2 and K3.

[0054] In the above-mentioned virtual machine processing method, when there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for memory data use, the target snapshot required by the target virtual machine is determined from the candidate snapshots stored in the host machine corresponding to the target virtual machine, and the target snapshot is copied to the anonymous memory area for the target virtual machine to call the memory data. Compared with the related art, in which the memory snapshot in the host machine is directly mapped to the memory space of the virtual machine, the above-mentioned method, by copying the target snapshot to the anonymous memory area for the target virtual machine to call the memory data, can improve the reliability of data processing of each virtual machine when multiple virtual machines are pulled up using the same memory snapshot.

[0055] In order to ensure the accuracy of the target snapshot determination, based on the above embodiments, in the embodiment of the present application, an optional method for determining the target snapshot is provided, such as Figure 2A As shown, the specific steps include:

[0056] S201: Determine snapshot identification information of a target snapshot required by the target virtual machine according to a virtual machine building request of the target virtual machine.

[0057] Among them, the virtual machine construction request is a request to build a target virtual machine, and the virtual machine construction request needs to include snapshot identification information of the target snapshot to be used by the target virtual machine; the snapshot identification information is used to represent the unique identification information that can represent the target snapshot, and further, the snapshot identification information includes the snapshot storage location and the snapshot offset.

[0058] In the examples of this application, refer to Figure 2B The memory snapshot storage diagram shown in the figure shows that when storing a memory snapshot, the actual memory data is persisted to the host's memory file (memory file), and the data structure of the memory snapshot is persisted to the host's state file (state file). The state file stores the snapshot storage location offset and snapshot offset size of each candidate snapshot.

[0059] In one possible implementation, snapshot identification information of a target snapshot required by the target virtual machine may be extracted from a virtual machine construction request of the target virtual machine.

[0060] S202: Determine, according to snapshot identification information of the target snapshot, a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine.

[0061] In one possible implementation, a query can be performed in the memory file according to the snapshot storage location and the snapshot offset, and then the target snapshot required by the target virtual machine can be determined from the candidate snapshots stored in the memory file. For example, when the snapshot storage location of the target snapshot S is S1 and the snapshot offset is S2, the byte amount of S2 can be obtained backward from the position of S1 in the memory file to obtain the target snapshot S.

[0062] In the embodiment of the present application, by determining the target snapshot required by the target virtual machine from each candidate snapshot according to the snapshot storage position and the snapshot offset of the target snapshot, the accuracy of the determination of the target snapshot can be ensured.

[0063] In order to ensure the accuracy of detecting the memory data usage demand, based on the above embodiments, in the embodiments of the present application, an optional method for detecting the memory data usage demand is provided, such as Figure 3 As shown, the specific steps include:

[0064] S301, obtaining monitoring events fed back by a monitoring thread corresponding to an anonymous memory area.

[0065] The monitoring thread is used to represent a thread that can monitor various events occurring in the anonymous memory area; the monitoring event is an event occurring in the anonymous memory area monitored by the monitoring thread, such as a data acquisition event.

[0066] It can be understood that in order to ensure the reliability of the monitoring thread operation, in an embodiment of the present application, after creating the target virtual machine, the anonymous memory area of ​​the target virtual machine is registered in the kernel of the host machine, and a corresponding monitoring thread is configured for the anonymous memory area.

[0067] In one possible implementation, after creating the target virtual machine, it is necessary to register the memory range corresponding to the anonymous memory area of ​​the target virtual machine with the kernel of the host machine, and configure a corresponding monitoring thread for the anonymous memory area of ​​the target virtual machine so that the host machine kernel can monitor the anonymous memory area.

[0068] Exemplarily, a user-mode page fault handling mechanism userfaultfd may be used to create a file descriptor fd. After the memory range corresponding to the anonymous memory area of ​​the target virtual machine is registered in the host kernel using the fd, the fd may be used to feed back monitoring events to the host.

[0069] In one possible implementation, the monitoring event fed back by the monitoring thread corresponding to the anonymous memory area can be obtained through a pre-configured monitoring thread. Exemplarily, the monitoring poll() function can be used to block the monitoring event (POLLIN event) waiting on the monitoring thread using fd call.

[0070] S302: When a page fault indicator is present in the monitoring event, it is determined that the monitoring thread detects that the target virtual machine has a memory data usage requirement.

[0071] The page fault flag is used to indicate that there is a demand for memory usage in the anonymous memory area.

[0072] In one possible implementation, after obtaining a monitoring event, event identification information in the monitoring event can be obtained. If the event identification information is a page fault identification, it is determined that there is a memory usage demand for the anonymous memory area, that is, it is determined that the monitoring thread has detected that the target virtual machine has a memory data usage demand; if the event identification information is other identification, it is determined that the monitoring thread has not detected that the target virtual machine has a memory data usage demand.

[0073] In the embodiment of the present application, by determining that the monitoring thread detects that the target virtual machine has a memory data usage demand when there is a page fault indicator in the monitoring event, the accuracy of the memory data usage demand detection can be guaranteed.

[0074] In order to ensure the reliability of the host machine operation, based on the above embodiments, in the embodiments of the present application, a clearing processing method is provided, specifically, after the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

[0075] The registration information is used to represent the memory range corresponding to the anonymous memory area of ​​the target virtual machine registered in the host machine.

[0076] In one feasible implementation, after the target snapshot is copied to the anonymous memory area, memory data already exists in the anonymous memory area. At this time, the host kernel does not need to continue to monitor the memory data usage requirements of the anonymous memory area. Therefore, the registration information of the anonymous memory area in the kernel can be cleared, and the monitoring thread corresponding to the anonymous memory area can be deleted.

[0077] In an embodiment of the present application, after the target snapshot is copied to the anonymous memory area, by clearing the registration information of the anonymous memory area in the kernel and deleting the monitoring thread corresponding to the anonymous memory area, the host machine can no longer monitor the anonymous memory area where memory data already exists, thereby ensuring the reliability of the host machine's operation.

[0078] In order to ensure the accuracy of the target virtual machine construction, based on the above embodiments, in an embodiment of the present application, an optional method for constructing the target virtual machine is provided, specifically, in response to a virtual machine construction request, determining the length of the memory area according to the size of the memory space occupied by each candidate snapshot in the host machine; configuring an anonymous memory area of ​​the memory area length for the target virtual machine to create a target virtual machine associated with the host machine.

[0079] The virtual machine construction request may be a request to create a new virtual machine based on a memory snapshot, or a request to restore an existing virtual machine based on a memory snapshot, which is not limited in this application. The memory region length is the length of the memory region in the virtual machine.

[0080] In one possible implementation, after a virtual machine construction request is obtained, in order to ensure that the anonymous memory area can store the target snapshot, the length of the memory area required by the target virtual machine can be determined based on the size of the memory space occupied by each candidate snapshot in the host machine.

[0081] For example, since the state file stores description information of the memory area corresponding to each candidate snapshot, the length of the memory area required by the target virtual machine can be directly obtained from the state file.

[0082] After determining the length of the memory region, an anonymous memory region of the length of the memory region may be configured for the target virtual machine, and the anonymous memory region may be regarded as memory data to configure the target virtual machine.

[0083] In the embodiment of the present application, by determining the memory area length of the anonymous memory area according to the size of the memory space occupied by each candidate snapshot in the host machine, it is ensured that the anonymous memory area can completely store the target snapshot, thereby ensuring the rationality of the memory area division.

[0084] In order to ensure the reliability of the operation of the target virtual machine, based on the above embodiment, in the embodiment of the present application, an overall process of the operation of the target virtual machine is provided, which specifically includes the following steps:

[0085] The first step is to configure an anonymous memory area for the target virtual machine based on the size of the memory space occupied by each candidate snapshot in the host machine. Figure 4 The target virtual machine operation flow chart shown can configure an anonymous memory region (anonmemory) for the target virtual machine VM based on the size of the memory occupied by the target snapshot pointed to by the snapshot identification information (memory region).

[0086] The second step is to register the anonymous memory area of ​​the target virtual machine with the host kernel. For example, refer to Figure 4 As shown in the target virtual machine operation flow chart, the registration structure _UFFDIO_REGISTER in the page fault handling mechanism userfaultfd can be used to register the memory range corresponding to the anonymous memory area of ​​the target virtual machine in the host kernel (Host Kernel).

[0087] The third step is to use the information loop thread to feed back the file descriptor carrying the event type to the host kernel. For example, refer to Figure 4 The target virtual machine operation flow chart shown may use an information loop thread handler to feed back a file descriptor uffd carrying an event type to the host kernel based on a Poll() function.

[0088] The fourth step is to determine whether the event type returned by the kernel is a page fault event. If so, execute the following fifth step; if not, continue to determine whether the next event type fed back by the file descriptor is a page fault event. For example, refer to Figure 4 The target virtual machine operation flow chart shown can determine whether the event type fed back by uffd is a page fault event (userfaultevent).

[0089] The fifth step is to copy the memory snapshot of the specified offset and length in the memory file to the anonymous memory area in the target virtual machine according to the snapshot identification information. Figure 4As shown in the target virtual machine operation flow chart, the copy statement _UFFDIO_COPY can be used to copy the memory snapshot pointed to by the snapshot identification information to the anonymous memory area in the target virtual machine.

[0090] Step 6: Unregister the anonymous memory area with the host kernel. Figure 4 As shown in the target virtual machine operation flow chart, the unregistration structure _UFFDIO_UNREGISTER in the page fault handling mechanism userfaultfd can be used to unregister the memory range corresponding to the anonymous memory area of ​​the target virtual machine in the host kernel.

[0091] In an embodiment of the present application, an overall process of running a target virtual machine is provided, which can ensure the reliability of the running of the target virtual machine.

[0092] Figure 5 FIG. 1 is a flow chart of a virtual machine processing method in another embodiment. Based on the above embodiment, this embodiment provides an optional example of a virtual machine processing method. Figure 5 The specific implementation process is as follows:

[0093] S501 , in response to a virtual machine construction request, determining a memory region length according to the size of the memory space occupied by each candidate snapshot in the host machine.

[0094] S502: configure an anonymous memory area of ​​a memory area length for a target virtual machine to create a target virtual machine associated with a host machine.

[0095] S503, registering the anonymous memory area of ​​the target virtual machine into the kernel of the host machine, and configuring a corresponding monitoring thread for the anonymous memory area.

[0096] S504, obtaining a monitoring event fed back by a monitoring thread corresponding to the anonymous memory area.

[0097] S505 : When there is a page fault indicator in the monitoring event, determine snapshot indicator information of a target snapshot required by the target virtual machine according to a virtual machine construction request of the target virtual machine.

[0098] The snapshot identification information includes the snapshot storage location and the snapshot offset.

[0099] S506: Determine, according to the snapshot identification information of the target snapshot, a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine.

[0100] S507, copying the target snapshot to the anonymous memory area for the target virtual machine to call memory data.

[0101] S508, after the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

[0102] The specific process of the above S501-S508 can refer to the description of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0103] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0104] Based on the same inventive concept, the embodiment of the present application also provides a virtual machine processing device for implementing the virtual machine processing method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more virtual machine processing device embodiments provided below can refer to the limitations of the virtual machine processing method above, and will not be repeated here.

[0105] In an exemplary embodiment, Figure 6 As shown, a virtual machine processing device 1 is provided, comprising: a snapshot acquisition module 10 and a snapshot copy module 20, wherein:

[0106] The snapshot acquisition module 10 is used to determine the target snapshot required by the target virtual machine from the candidate snapshots stored in the host machine corresponding to the target virtual machine when there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a memory data usage demand;

[0107] The snapshot copy module 20 is used to copy the target snapshot to the anonymous memory area so that the target virtual machine can call the memory data.

[0108] In an exemplary embodiment, the snapshot acquisition module 10 is specifically used for:

[0109] According to the virtual machine building request of the target virtual machine, snapshot identification information of the target snapshot required by the target virtual machine is determined; wherein the snapshot identification information includes the snapshot storage location and the snapshot offset; according to the snapshot identification information of the target snapshot, the target snapshot required by the target virtual machine is determined from each candidate snapshot stored in the host machine corresponding to the target virtual machine.

[0110] In an exemplary embodiment, the snapshot acquisition module 10 is further configured to:

[0111] Obtain monitoring events fed back by the monitoring thread corresponding to the anonymous memory area; when there is a page fault mark in the monitoring event, determine that the monitoring thread detects that the target virtual machine has a memory data usage demand; wherein the page fault mark is used to indicate the existence of a memory usage demand for the anonymous memory area.

[0112] In an exemplary embodiment, the virtual machine processing device 1 further includes a registration module, wherein the registration module is specifically used to:

[0113] After the target virtual machine is created, the anonymous memory area of ​​the target virtual machine is registered in the kernel of the host machine, and a corresponding monitoring thread is configured for the anonymous memory area.

[0114] In an exemplary embodiment, the virtual machine processing device 1 further includes a deletion module, wherein the deletion module is specifically used to:

[0115] After the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

[0116] In an exemplary embodiment, the virtual machine processing device 1 further includes a creation module, wherein the creation module is specifically used to:

[0117] In response to a virtual machine construction request, the length of the memory region is determined according to the size of the memory space occupied by each candidate snapshot in the host machine; an anonymous memory region of the memory region length is configured for the target virtual machine to create a target virtual machine associated with the host machine.

[0118] Each module in the above-mentioned virtual machine processing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0119] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store memory snapshot data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a virtual machine processing method is implemented.

[0120] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0121] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0122] When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine;

[0123] The target snapshot is copied to the anonymous memory area so that the target virtual machine can call the memory data.

[0124] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0125] According to the virtual machine building request of the target virtual machine, snapshot identification information of the target snapshot required by the target virtual machine is determined; wherein the snapshot identification information includes the snapshot storage location and the snapshot offset; according to the snapshot identification information of the target snapshot, the target snapshot required by the target virtual machine is determined from each candidate snapshot stored in the host machine corresponding to the target virtual machine.

[0126] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0127] Obtain monitoring events fed back by the monitoring thread corresponding to the anonymous memory area; when there is a page fault mark in the monitoring event, determine that the monitoring thread detects that the target virtual machine has a memory data usage demand; wherein the page fault mark is used to indicate the existence of a memory usage demand for the anonymous memory area.

[0128] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0129] After the target virtual machine is created, the anonymous memory area of ​​the target virtual machine is registered in the kernel of the host machine, and a corresponding monitoring thread is configured for the anonymous memory area.

[0130] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0131] After the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

[0132] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0133] In response to a virtual machine construction request, the length of the memory region is determined according to the size of the memory space occupied by each candidate snapshot in the host machine; an anonymous memory region of the memory region length is configured for the target virtual machine to create a target virtual machine associated with the host machine.

[0134] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0135] When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine;

[0136] The target snapshot is copied to the anonymous memory area so that the target virtual machine can call the memory data.

[0137] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0138] According to the virtual machine building request of the target virtual machine, snapshot identification information of the target snapshot required by the target virtual machine is determined; wherein the snapshot identification information includes the snapshot storage location and the snapshot offset; according to the snapshot identification information of the target snapshot, the target snapshot required by the target virtual machine is determined from each candidate snapshot stored in the host machine corresponding to the target virtual machine.

[0139] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0140] Obtain monitoring events fed back by the monitoring thread corresponding to the anonymous memory area; when there is a page fault mark in the monitoring event, determine that the monitoring thread detects that the target virtual machine has a memory data usage demand; wherein the page fault mark is used to indicate the existence of a memory usage demand for the anonymous memory area.

[0141] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0142] After the target virtual machine is created, the anonymous memory area of ​​the target virtual machine is registered in the kernel of the host machine, and a corresponding monitoring thread is configured for the anonymous memory area.

[0143] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0144] After the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

[0145] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0146] In response to a virtual machine construction request, the length of the memory region is determined according to the size of the memory space occupied by each candidate snapshot in the host machine; an anonymous memory region of the memory region length is configured for the target virtual machine to create a target virtual machine associated with the host machine.

[0147] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0148] When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine;

[0149] The target snapshot is copied to the anonymous memory area so that the target virtual machine can call the memory data.

[0150] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0151] According to the virtual machine building request of the target virtual machine, snapshot identification information of the target snapshot required by the target virtual machine is determined; wherein the snapshot identification information includes the snapshot storage location and the snapshot offset; according to the snapshot identification information of the target snapshot, the target snapshot required by the target virtual machine is determined from each candidate snapshot stored in the host machine corresponding to the target virtual machine.

[0152] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0153] Obtain monitoring events fed back by the monitoring thread corresponding to the anonymous memory area; when there is a page fault mark in the monitoring event, determine that the monitoring thread detects that the target virtual machine has a memory data usage demand; wherein the page fault mark is used to indicate the existence of a memory usage demand for the anonymous memory area.

[0154] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0155] After the target virtual machine is created, the anonymous memory area of ​​the target virtual machine is registered in the kernel of the host machine, and a corresponding monitoring thread is configured for the anonymous memory area.

[0156] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0157] After the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

[0158] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0159] In response to a virtual machine construction request, the length of the memory region is determined according to the size of the memory space occupied by each candidate snapshot in the host machine; an anonymous memory region of the memory region length is configured for the target virtual machine to create a target virtual machine associated with the host machine.

[0160] It should be noted that the data involved in this application (including but not limited to memory snapshot data, etc.) are all data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0161] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0162] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0163] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A virtual machine processing method, characterized in that: The method comprises: When there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data, determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine; The target snapshot is copied to the anonymous memory area so that the target virtual machine can call memory data.

2. The method according to claim 1, characterized in that The step of determining a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine includes: Determining snapshot identification information of a target snapshot required by the target virtual machine according to the virtual machine building request of the target virtual machine; wherein the snapshot identification information includes a snapshot storage location and a snapshot offset; According to the snapshot identification information of the target snapshot, a target snapshot required by the target virtual machine is determined from candidate snapshots stored in a host machine corresponding to the target virtual machine.

3. The method according to claim 1, characterized in that: The detecting that the target virtual machine has a memory data usage demand includes: Obtaining monitoring events fed back by the monitoring thread corresponding to the anonymous memory area; In the case where the monitoring event has a page fault indicator, it is determined that the monitoring thread detects that the target virtual machine has a memory data usage demand; wherein the page fault indicator is used to indicate that there is a memory usage demand for the anonymous memory area.

4. The method according to claim 3, characterized in that: The method further comprises: After the target virtual machine is created, the anonymous memory area of ​​the target virtual machine is registered in the kernel of the host machine, and a corresponding monitoring thread is configured for the anonymous memory area.

5. The method according to claim 4, characterized in that: The method further comprises: After the target snapshot is copied to the anonymous memory area, the registration information of the anonymous memory area in the kernel is cleared, and the monitoring thread corresponding to the anonymous memory area is deleted.

6. The method according to claim 1, characterized in that: In the case that there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a memory data usage demand, before determining the target snapshot required by the target virtual machine from each candidate snapshot stored in the host machine corresponding to the target virtual machine, the method further includes: In response to a virtual machine construction request, determining a length of a memory region according to a size of a memory space occupied by each candidate snapshot in the host machine; An anonymous memory area of ​​the memory area length is configured for the target virtual machine to create the target virtual machine associated with the host machine.

7. A virtual machine processing device, characterized in that: The device comprises: a snapshot acquisition module, configured to determine a target snapshot required by the target virtual machine from candidate snapshots stored in a host machine corresponding to the target virtual machine, when there is no memory data in the anonymous memory area of ​​the target virtual machine and it is detected that the target virtual machine has a demand for using memory data; The snapshot copy module is used to copy the target snapshot to the anonymous memory area so that the target virtual machine can call the memory data.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.