Snapshot management method, device, electronic device and storage medium
By introducing memory snapshot control components and related management components in the cloud computing environment, the parallel processing of virtual machine snapshot operations is solved, and the operation efficiency and user experience are improved.
Patent Information
- Application Number
- CN202411773086.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-08
AI Technical Summary
In a cloud computing environment, the snapshot creation process of virtual machines takes a long time, resulting in an increase in virtual machine downtime and affecting the user experience.
By introducing memory snapshot control components, virtual machine management components and disk management components, parallel processing of snapshot creation, recovery and deletion of virtual machine memory and disks is achieved, reducing the overall time-consuming of snapshot operations.
Improves the efficiency of virtual machine snapshot creation, recovery and deletion, reduces the downtime of virtual machines, and improves the user experience.
Smart Images

Figure CN119781903A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a snapshot management method, device, electronic device and storage medium. Background Art
[0002] In cloud computing environments, virtualization technology has become the core of managing and deploying applications. Virtual machine technology allows multiple independent operating system instances to run on a single physical server, thereby improving resource utilization and flexibility. However, as the size and complexity of virtual machines increase, managing the memory state and data backup of virtual machines becomes increasingly difficult.
[0003] Sometimes, according to actual needs, it is necessary to create a snapshot of a virtual machine. For example, first create a virtual machine memory snapshot file, and then create a virtual machine disk snapshot file. This causes the virtual machine to take too long to create a snapshot, which is inefficient. For example, it will increase the downtime of the virtual machine and affect the user experience. Summary of the invention
[0004] The present application shows a snapshot management method, device, electronic device and storage medium.
[0005] In a first aspect, the present application provides a snapshot management method, the method comprising:
[0006] Receiving, based on the virtual machine API service, a request to create a snapshot of a target virtual machine in the cluster;
[0007] Based on the virtual machine API service, according to the creation request, a new ID of a new memory snapshot resource object of the target virtual machine is added to the ID list of the memory snapshot resource object in the virtual machine resource object of the target virtual machine in the virtual machine API service;
[0008] Based on the memory snapshot control component, detect whether there is a new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service;
[0009] In the case that there is no new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service, based on the memory snapshot control component, sending a first creation instruction to the memory snapshot API service, where the first creation instruction is used to instruct to create a new memory snapshot resource object of the target virtual machine;
[0010] Based on the memory snapshot API service, according to the first creation instruction, in the memory snapshot API service, a new memory snapshot resource object of the target virtual machine corresponding to the new ID is created, and in the new memory snapshot resource object of the target virtual machine, a state of the new memory snapshot resource object of the target virtual machine is recorded as being in a creating state;
[0011] In a case where the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in the creating state, a memory snapshot file of the target virtual machine is created based on the virtual machine management component, the memory snapshot file of the target virtual machine is stored, and a first storage instruction is sent to the memory snapshot API service via the memory snapshot control component, where the first storage instruction carries a storage path of the memory snapshot file and a new ID of the new memory snapshot resource object of the target virtual machine;
[0012] Based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the storage path of the memory snapshot file of the target virtual machine is stored in the new memory snapshot resource object of the target virtual machine;
[0013] In the case that the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, a disk snapshot file of the target virtual machine is created based on the disk management component, the disk snapshot file of the target virtual machine is stored, and a second storage instruction is sent to the memory snapshot API service via the memory snapshot control component, where the second storage instruction carries the ID of the disk snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine;
[0014] Based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the ID of the disk snapshot file of the target virtual machine is stored in the new memory snapshot resource object of the target virtual machine;
[0015] In the case where the memory snapshot API service monitors that the new memory snapshot resource object of the target virtual machine has the storage path of the memory snapshot file of the target virtual machine and the ID of the disk snapshot file of the target virtual machine, the memory snapshot API service updates the state of the new memory snapshot resource object of the target virtual machine to a creation completed state in the new memory snapshot resource object of the target virtual machine.
[0016] In a second aspect, the present application provides a snapshot management method, the method comprising:
[0017] The recovery request is received based on the virtual machine API service. The recovery request carries the ID of the target virtual machine and the ID of the target memory snapshot resource object to be restored of the target virtual machine. The recovery request is used to perform snapshot recovery on the target virtual machine according to the ID of the target virtual machine and the ID of the target memory snapshot resource object.
[0018] Based on the virtual machine API service, according to the ID of the target virtual machine in the recovery request, the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine in the virtual machine API service;
[0019] In the case where the memory snapshot control component monitors that the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine, the memory snapshot control component obtains the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the memory snapshot API service according to the ID of the target memory snapshot resource object;
[0020] Based on the memory snapshot control component, a first recovery instruction is sent to the disk management component, where the first recovery instruction carries the ID of the disk snapshot file;
[0021] Based on the memory snapshot control component, a second restoration instruction is sent to the virtual machine management component, where the second restoration instruction carries a storage path of the memory snapshot file;
[0022] Based on the disk management component, the disk snapshot file corresponding to the disk snapshot file ID is searched, and the disk of the target virtual machine is rolled back and restored according to the found disk snapshot file;
[0023] Based on the virtual machine management component, the memory snapshot file is searched according to the storage path of the memory snapshot file, and the memory of the target virtual machine is rolled back and restored according to the found memory snapshot file.
[0024] In a third aspect, the present application provides a snapshot management method, the method comprising:
[0025] The memory snapshot API service receives a deletion request, where the deletion request carries the ID of the target memory snapshot resource object;
[0026] Based on the memory snapshot API service, according to the ID of the target memory snapshot resource object, in the target memory snapshot resource object in the memory snapshot API service, setting the state of the target memory snapshot resource object to a pre-deletion state;
[0027] In the case that the memory snapshot control component monitors that the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is in the pre-deletion state, the memory snapshot control component obtains the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file through the memory snapshot API service;
[0028] Based on the memory snapshot control component, a first deletion instruction is sent to the disk management component, where the first deletion instruction carries the ID of the disk snapshot file;
[0029] Based on the memory snapshot control component, a second deletion instruction is sent to the virtual machine management component, where the second deletion instruction carries a storage path of the memory snapshot file;
[0030] Based on the disk management component, find the disk snapshot file corresponding to the disk snapshot file ID, and delete the found disk snapshot file;
[0031] Based on the virtual machine management component, the memory snapshot file is searched according to the storage path of the memory snapshot file, and the found memory snapshot file is deleted.
[0032] In a fourth aspect, the present application provides a snapshot management device, the device comprising:
[0033] A first receiving module, configured to receive, based on a virtual machine API service, a request for creating a snapshot of a target virtual machine in a cluster;
[0034] A new module is added, which is used to add a new ID of a new memory snapshot resource object of a target virtual machine in a list of identity identification numbers ID of a memory snapshot resource object in a virtual machine resource object of a target virtual machine in the virtual machine API service according to a creation request based on the virtual machine API service;
[0035] A detection module, used to detect whether there is a new memory snapshot resource object of a target virtual machine corresponding to a new ID in the memory snapshot API service based on the memory snapshot control component;
[0036] A first sending module is used to send a first creation instruction to the memory snapshot API service based on the memory snapshot control component when there is no new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service, wherein the first creation instruction is used to instruct to create a new memory snapshot resource object of the target virtual machine;
[0037] A first creation module is used to create a new memory snapshot resource object of a target virtual machine corresponding to a new ID in the memory snapshot API service according to a first creation instruction based on the memory snapshot API service, and record in the new memory snapshot resource object of the target virtual machine a state of the new memory snapshot resource object of the target virtual machine as a creating state;
[0038] A second creation module is used for, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in the creating state, creating a memory snapshot file of the target virtual machine based on the virtual machine management component, storing the memory snapshot file of the target virtual machine, and sending a first storage instruction to the memory snapshot API service via the memory snapshot control component, the first storage instruction carrying the storage path of the memory snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine;
[0039] A first storage module is used to store a storage path of the memory snapshot file of the target virtual machine in a new memory snapshot resource object of the target virtual machine based on the memory snapshot API service according to a new ID of the new memory snapshot resource object of the target virtual machine;
[0040] A third creation module is used for, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, creating a disk snapshot file of the target virtual machine based on the disk management component, storing the disk snapshot file of the target virtual machine, and sending a second storage instruction to the memory snapshot API service via the memory snapshot control component, where the second storage instruction carries the ID of the disk snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine;
[0041] A second storage module is used to store the ID of the disk snapshot file of the target virtual machine in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service according to the new ID of the new memory snapshot resource object of the target virtual machine;
[0042] The update module is used to update the state of the new memory snapshot resource object of the target virtual machine to a creation completed state in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service, when the new memory snapshot resource object of the target virtual machine has the storage path of the memory snapshot file of the target virtual machine and the ID of the disk snapshot file of the target virtual machine monitored based on the memory snapshot API service.
[0043] In a fifth aspect, the present application provides a snapshot management device, the device comprising:
[0044] a second receiving module, configured to receive a recovery request based on the virtual machine API service, the recovery request carrying the ID of the target virtual machine and the ID of the target memory snapshot resource object to be recovered of the target virtual machine, the recovery request being used to perform snapshot recovery on the target virtual machine according to the ID of the target virtual machine and the ID of the target memory snapshot resource object;
[0045] An adding module, configured to add the ID of a target memory snapshot resource object to be restored in the virtual machine resource object of the target virtual machine in the virtual machine API service according to the ID of the target virtual machine in the restore request based on the virtual machine API service;
[0046] The first acquisition module is used to acquire, based on the memory snapshot control component, the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the memory snapshot API service according to the ID of the target memory snapshot resource object, when the memory snapshot control component monitors that the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine;
[0047] A third sending module is used to send a first restoration instruction to the disk management component based on the memory snapshot control component, where the first restoration instruction carries the ID of the disk snapshot file;
[0048] A fourth sending module, configured to send a second restoration instruction to the virtual machine management component based on the memory snapshot control component, where the second restoration instruction carries a storage path of the memory snapshot file;
[0049] A first recovery module is used to search for a disk snapshot file corresponding to an ID of the disk snapshot file based on a disk management component, and perform rollback recovery on the disk of the target virtual machine according to the found disk snapshot file;
[0050] The second recovery module is used to search for the memory snapshot file according to the storage path of the memory snapshot file based on the virtual machine management component, and perform rollback recovery on the memory of the target virtual machine according to the found memory snapshot file.
[0051] In a sixth aspect, the present application provides a snapshot management device, the device comprising:
[0052] A third receiving module is used to receive a deletion request based on the memory snapshot API service, where the deletion request carries the ID of the target memory snapshot resource object;
[0053] A second setting module is used to set the state of the target memory snapshot resource object to a pre-deletion state in the target memory snapshot resource object in the memory snapshot API service based on the memory snapshot API service according to the ID of the target memory snapshot resource object;
[0054] A second acquisition module is used to acquire the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the target memory snapshot resource object through the memory snapshot API service based on the memory snapshot control component when the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is in a pre-deletion state based on the memory snapshot control component;
[0055] A fifth sending module, configured to send a first deletion instruction to the disk management component based on the memory snapshot control component, where the first deletion instruction carries the ID of the disk snapshot file;
[0056] A sixth sending module, configured to send a second deletion instruction to the virtual machine management component based on the memory snapshot control component, where the second deletion instruction carries a storage path of the memory snapshot file;
[0057] A first deletion module is used to search for a disk snapshot file corresponding to the ID of the disk snapshot file based on the disk management component, and delete the found disk snapshot file;
[0058] The second deleting module is used to search for the memory snapshot file according to the storage path of the memory snapshot file based on the virtual machine management component, and delete the found memory snapshot file.
[0059] In a seventh aspect, the present application illustrates an electronic device, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the method described in any of the above aspects.
[0060] In an eighth aspect, the present application illustrates a non-temporary computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute a method as described in any of the above aspects.
[0061] In a ninth aspect, the present application illustrates a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the method described in any of the above aspects.
[0062] The technical solution provided by this application may have the following beneficial effects:
[0063] In the present application, a memory snapshot control component, a virtual machine management component and a disk management component are added, and the memory snapshot control component can control the virtual machine management component and the disk management component respectively.
[0064] For example, the memory snapshot control component can control the virtual machine management component to create a memory snapshot file of the virtual machine and control the disk management component to create a disk snapshot file of the virtual machine, and the process of the memory snapshot control component controlling the virtual machine management component to create a memory snapshot file of the virtual machine and controlling the disk management component to create a disk snapshot file of the virtual machine can be performed simultaneously, thereby reducing the time spent in the process of creating a snapshot of the virtual machine, saving time, improving the efficiency of creating a snapshot of the virtual machine, reducing the downtime of the virtual machine, and improving the user experience.
[0065] Secondly, the memory snapshot control component can control the virtual machine management component to restore the virtual machine's memory according to the virtual machine's memory snapshot file and control the disk management component to restore the virtual machine's disk according to the virtual machine's disk snapshot file, and the process of the memory snapshot control component controlling the virtual machine management component to restore the virtual machine's memory according to the virtual machine's memory snapshot file and controlling the disk management component to restore the virtual machine's disk according to the virtual machine's disk snapshot file can be performed simultaneously, thereby reducing the time spent in the process of restoring the virtual machine according to the virtual machine's snapshot, saving time, improving the efficiency of restoring the virtual machine according to the virtual machine's snapshot, reducing the downtime of the virtual machine, and improving the user experience.
[0066] In addition, the memory snapshot control component can control the virtual machine management component to delete the virtual machine's memory snapshot files and control the disk management component to delete the virtual machine's disk snapshot files, and the process of the memory snapshot control component controlling the virtual machine management component to delete the virtual machine's memory snapshot files and controlling the disk management component to delete the virtual machine's disk snapshot files can be performed simultaneously, thereby reducing the time spent on deleting the virtual machine's snapshots, saving time, improving the efficiency of deleting the virtual machine's snapshots, and enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 It is a schematic diagram of a snapshot management system of the present application.
[0068] Figure 2 It is a flowchart of the steps of a snapshot management method of the present application.
[0069] Figure 3 It is a flowchart of the steps of a snapshot management method of the present application.
[0070] Figure 4 It is a flowchart of the steps of a snapshot management method of the present application.
[0071] Figure 5 This is a structural block diagram of a snapshot management device of the present application.
[0072] Figure 6 This is a structural block diagram of a snapshot management device of the present application.
[0073] Figure 7 This is a structural block diagram of a snapshot management device of the present application.
[0074] Figure 8 It is a block diagram of an electronic device of the present application.
[0075] Fig. 9 It is a block diagram of an electronic device of the present application. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0077] Reference Figure 1 , shows a structural block diagram of a snapshot management system of the present application, wherein the system includes:
[0078] Memory snapshot API (Application Programming Interface) service, virtual machine API service, memory snapshot control component, virtual machine management component and disk management component.
[0079] The memory snapshot API service, the virtual machine API service, the memory snapshot control component, the virtual machine management component, and the disk management component may all be located on the same physical machine in the cluster, or may not be located on the same physical machine or virtual machine, for example, they may be located on different physical machines or virtual machines in the cluster.
[0080] The memory snapshot API service, virtual machine API service, memory snapshot control component, virtual machine management component and disk management component can be regarded as different applications, each with different functions. Each is integrated on a physical machine or virtual machine in the cluster to play its own function.
[0081] The cluster can be a Kubernetes cluster, etc.
[0082] The memory snapshot API service can exchange data with external clients, the memory snapshot API service can exchange data with virtual machine API services, and the memory snapshot API service can exchange data with memory snapshot control components.
[0083] The virtual machine API service and the external client can exchange data with each other, the virtual machine API service and the memory snapshot API service can exchange data with each other, and the virtual machine API service and the memory snapshot control component can exchange data with each other.
[0084] The memory snapshot control component and the virtual machine management component can exchange data.
[0085] The memory snapshot control component and the disk management component can exchange data.
[0086] The virtual machine management component is used to create a memory snapshot file of the virtual machine, restore the memory of the virtual machine based on the created memory snapshot file of the virtual machine, and delete the created memory snapshot file of the virtual machine.
[0087] The disk management component is used to create a disk snapshot file of a virtual machine, restore the disk of the virtual machine based on the created disk snapshot file of the virtual machine, and delete the created disk snapshot file of the virtual machine.
[0088] The external client can be a client used by cluster operation and maintenance personnel, etc.
[0089] Among them, you can add a memory snapshot API service and a virtual machine API service to the Kubernetes API service by customizing the memory snapshot resource.
[0090] The memory snapshot API service provides customized memory snapshot resource request processing logic. The memory snapshot API service can be located in the control plane of the Kubernetes cluster. The virtual machine API service can be located in the control plane of the Kubernetes cluster.
[0091] Reference Figure 2 , shows a flowchart of the steps of a snapshot management method of the present application, the method is used to create a memory snapshot file and a disk snapshot file of a virtual machine, the method comprising:
[0092] In step S101, a creation request for creating a snapshot of a target virtual machine in a cluster is received based on a virtual machine API service.
[0093] There are multiple virtual machines in the cluster, and the target virtual machine is a virtual machine in the cluster, for example, a virtual machine on a physical machine in the cluster.
[0094] The creation request may be sent by the operation and maintenance personnel of the cluster to the virtual machine API service in the cluster using the client. For example, when the operation and maintenance personnel need to create a snapshot of a target virtual machine in the cluster, a creation request for creating a snapshot of the target virtual machine in the cluster may be sent to the virtual machine API service through the client. The creation request may carry the ID (Identity Document) of the target virtual machine to specify which virtual machine in the cluster needs to have its snapshot created.
[0095] In this way, the cluster can receive the creation request sent by the client based on the virtual machine API service.
[0096] In step S102, based on the virtual machine API service, a new ID of a new memory snapshot resource object of the target virtual machine is added to the ID list of the memory snapshot resource object in the virtual machine resource object of the target virtual machine in the virtual machine API service according to the creation request.
[0097] In this scenario, a snapshot of the target virtual machine needs to be created. Each snapshot of the virtual machine uniquely corresponds to a memory snapshot resource object. The new memory snapshot resource object is the memory snapshot resource object corresponding to the snapshot of the target virtual machine that needs to be created according to the creation request.
[0098] Before the new ID of the new memory snapshot resource object of the target virtual machine is added to the ID list of the memory snapshot resource object in the virtual machine resource object of the target virtual machine in the virtual machine API service, the new memory snapshot resource object does not exist in the memory snapshot API service.
[0099] The virtual machine API service has virtual machine resource objects for each virtual machine in the cluster.
[0100] The virtual machine resource object of the virtual machine records relevant information of the virtual machine, for example, the ID list of the virtual machine's memory snapshot resource objects. The ID list of the virtual machine's memory snapshot resource objects is used to store: the IDs of each memory snapshot resource object of the virtual machine. The IDs of different memory snapshot resource objects in this application are different.
[0101] The relevant information of the virtual machine may also include the ID of the virtual machine, the time when the virtual machine was created, the time when the virtual machine was continued, the time when the virtual machine was started, the amount of system resources allocated to the virtual machine by the physical machine, and the utilization rate of the system resources of the virtual machine.
[0102] In this step, a new ID may be added to the ID list of the memory snapshot resource object in the virtual machine resource object of the target virtual machine in the virtual machine API service, and the new ID is the ID of the new memory snapshot resource object of the target virtual machine to be established subsequently.
[0103] In step S103, based on the memory snapshot control component, it is detected whether there is a new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service.
[0104] The memory snapshot API service has a memory snapshot resource object for each virtual machine in the cluster.
[0105] The memory snapshot resource object of the virtual machine records relevant information of the virtual machine's snapshot, such as the storage path of the virtual machine's memory snapshot file, the virtual machine's ID, the ID of the virtual machine's memory snapshot resource object, the ID of the virtual machine's disk snapshot file, and the status of the virtual machine's memory snapshot resource object (pre-deletion, deletable / deletable, creating, usable / usable, and prohibited, etc.).
[0106] Different virtual machines have different IDs, different memory snapshot resource objects have different IDs, and different disk snapshot files have different IDs.
[0107] In this step, when the memory snapshot control component detects that "a new ID of a new memory snapshot resource object of the target virtual machine is added to the ID list of the memory snapshot resource objects in the virtual machine resource objects of the target virtual machine in the virtual machine API service", the memory snapshot control component can search for a memory snapshot resource object with a new ID in the existing memory snapshot resource objects of the target virtual machine in the memory snapshot API service.
[0108] The existing memory snapshot resource object of the target virtual machine is: a memory snapshot resource object having an ID of the target virtual machine.
[0109] In the case where a memory snapshot resource object with a new ID is found, it can be determined that a new memory snapshot resource object of the target virtual machine corresponding to the new ID exists in the memory snapshot API service, wherein the memory snapshot resource object with the new ID is the new memory snapshot resource object of the target virtual machine corresponding to the new ID. Alternatively, in the case where a memory snapshot resource object with a new ID is not found, it is determined that a new memory snapshot resource object of the target virtual machine corresponding to the new ID does not exist in the memory snapshot API service.
[0110] When there is no new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service, in step S104, based on the memory snapshot control component, a first creation instruction is sent to the memory snapshot API service, where the first creation instruction is used to instruct the creation of a new memory snapshot resource object of the target virtual machine.
[0111] In step S105, based on the memory snapshot API service, according to the first creation instruction, a new memory snapshot resource object of the target virtual machine corresponding to the new ID is created in the memory snapshot API service, and in the new memory snapshot resource object of the target virtual machine, the state of the new memory snapshot resource object of the target virtual machine is recorded as being in a creating state.
[0112] If the creation request also carries the ID of the target virtual machine, the ID of the target virtual machine is recorded in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service. Different virtual machines have different IDs.
[0113] The new memory snapshot resource object of the target virtual machine has multiple fields, and different fields are used to store different information of the snapshot of the target virtual machine. One field is used to store the status of the new memory snapshot resource object of the target virtual machine. "Creating" can be recorded in this field to achieve the state of the new memory snapshot resource object of the target virtual machine being recorded as being in the creating state in the new memory snapshot resource object of the target virtual machine.
[0114] After executing step S105, step S106 and step S108 may be executed in parallel. After executing step S106, step S107 may be executed. After executing step S108, step S109 may be executed. Thus, step S107 and step S109 may also be executed in parallel.
[0115] In step S106, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in the creating state, a memory snapshot file of the target virtual machine is created based on the virtual machine management component, the memory snapshot file of the target virtual machine is stored, and a first storage instruction is sent to the memory snapshot API service via the memory snapshot control component, where the first storage instruction carries the storage path of the memory snapshot file and a new ID of the new memory snapshot resource object of the target virtual machine.
[0116] In one embodiment, the virtual machine management component can directly monitor the content of the new memory snapshot resource object of the target virtual machine in the memory snapshot API service, thereby obtaining a conclusion as to whether the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state.
[0117] In another embodiment, the virtual machine management component can indirectly monitor the content of the new memory snapshot resource object of the target virtual machine in the memory snapshot API service via the memory snapshot control component, thereby obtaining a conclusion as to whether the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state. For example, the memory snapshot control component can directly monitor the content of the new memory snapshot resource object of the target virtual machine in the memory snapshot API service, thereby obtaining a conclusion as to whether the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state, and send the conclusion to the virtual machine management component, and the virtual machine management component can obtain the conclusion sent by the memory snapshot control component.
[0118] The memory snapshot file of the target virtual machine may be stored in a region in the cluster specifically used for storing memory snapshot files, or the memory snapshot file of the target virtual machine may be stored in a storage space specifically allocated for the target virtual machine by a physical machine in the cluster.
[0119] In step S107, based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the storage path of the memory snapshot file of the target virtual machine is stored in the new memory snapshot resource object of the target virtual machine.
[0120] Based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the new memory snapshot resource object of the target virtual machine is searched (the memory snapshot resource object of the target virtual machine with the new ID is the new memory snapshot resource object of the target virtual machine), the new memory snapshot resource object of the target virtual machine has a plurality of fields, different fields are used to store different information of the snapshot of the target virtual machine, one of the fields is used to store the storage path of the memory snapshot file, and the storage path of the memory snapshot file of the target virtual machine can be stored in the field.
[0121] In step S108, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, the disk management component creates a disk snapshot file of the target virtual machine, stores the disk snapshot file of the target virtual machine, and sends a second storage instruction to the memory snapshot API service via the memory snapshot control component, where the second storage instruction carries the ID of the disk snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine.
[0122] In one embodiment, the disk management component can directly monitor the content of the new memory snapshot resource object of the target virtual machine in the memory snapshot API service, thereby obtaining a conclusion as to whether the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state.
[0123] In another embodiment, the disk management component can indirectly monitor the content of the new memory snapshot resource object of the target virtual machine in the memory snapshot API service via the memory snapshot control component, thereby obtaining a conclusion as to whether the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state. For example, the memory snapshot control component can directly monitor the content of the new memory snapshot resource object of the target virtual machine in the memory snapshot API service, thereby obtaining a conclusion as to whether the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state, and send the conclusion to the disk management component, and the disk management component can obtain the conclusion sent by the memory snapshot control component.
[0124] The disk snapshot file of the target virtual machine may be stored in an area in the cluster specifically used for storing memory snapshot files, or the disk snapshot file of the target virtual machine may be stored in a storage space specifically allocated for the target virtual machine on a physical machine in the cluster.
[0125] In step S109, based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the ID of the disk snapshot file of the target virtual machine is stored in the new memory snapshot resource object of the target virtual machine.
[0126] Based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the new memory snapshot resource object of the target virtual machine is searched (the memory snapshot resource object of the target virtual machine with the new ID is the new memory snapshot resource object of the target virtual machine), the new memory snapshot resource object of the target virtual machine has a plurality of fields, different fields are used to store different information of the snapshot of the target virtual machine, one of the fields is used to store the ID of the disk snapshot file, and the ID of the disk snapshot file of the target virtual machine can be stored in the field.
[0127] In step S110, when the memory snapshot API service monitors that the new memory snapshot resource object of the target virtual machine has the storage path of the memory snapshot file of the target virtual machine and the ID of the disk snapshot file of the target virtual machine, the memory snapshot API service updates the state of the new memory snapshot resource object of the target virtual machine to a creation completed state in the new memory snapshot resource object of the target virtual machine.
[0128] One of the fields in the new memory snapshot resource object of the target virtual machine is used to store the status of the new memory snapshot resource object of the target virtual machine. The field currently records "creating". "Creating" is deleted from the field and "created" is recorded to update the status of the new memory snapshot resource object of the target virtual machine to the creation completed state in the new memory snapshot resource object of the target virtual machine.
[0129] The creation completed state means that the new memory snapshot resource object of the target virtual machine can be used later.
[0130] In the present application, a memory snapshot control component, a virtual machine management component and a disk management component are added, and the memory snapshot control component can control the virtual machine management component and the disk management component respectively.
[0131] For example, the memory snapshot control component can control the virtual machine management component to create a memory snapshot file of the virtual machine and control the disk management component to create a disk snapshot file of the virtual machine, and the process of the memory snapshot control component controlling the virtual machine management component to create a memory snapshot file of the virtual machine and controlling the disk management component to create a disk snapshot file of the virtual machine can be performed simultaneously, thereby reducing the time spent in the process of creating a snapshot of the virtual machine, saving time, improving the efficiency of creating a snapshot of the virtual machine, reducing the downtime of the virtual machine, and improving the user experience.
[0132] In another embodiment of the present application, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in the creating state, the target virtual machine is first controlled to suspend operation based on the virtual machine management component.
[0133] Based on the virtual machine management component, a state change instruction is sent to the virtual machine API service via the memory snapshot control component, and the state change instruction carries the ID of the target virtual machine and an indication that the target virtual machine is suspended. Then, a memory snapshot file of the target virtual machine is created based on the virtual machine management component.
[0134] After receiving the state change instruction, the virtual machine API service sets the state of the target virtual machine in the virtual machine resource object of the target virtual machine to the suspended state according to the ID of the target virtual machine and the indication that the target virtual machine is suspended.
[0135] Accordingly, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, creating a disk snapshot file of the target virtual machine based on the disk management component includes:
[0136] When the disk management component monitors that the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state, the disk management component monitors whether the state of the target virtual machine in the virtual machine resource object of the target virtual machine is in the paused state.
[0137] When the disk management component monitors that the state of the target virtual machine in the virtual machine resource object of the target virtual machine is in the suspended state, the disk management component creates a disk snapshot file of the target virtual machine.
[0138] When it is necessary to create a memory snapshot file of the target virtual machine based on the virtual machine management component and a disk snapshot file of the target virtual machine based on the disk management component, the target virtual machine is running, but the virtual machine may not be working, that is, no action is performed. In this way, the data in the memory and the data in the disk of the virtual machine may not change. In this way, the memory snapshot file of the target virtual machine created based on the virtual machine management component and the disk snapshot file of the target virtual machine created based on the disk management component can correspond.
[0139] However, if the virtual machine is working, the data in the virtual machine's memory and / or the data in the disk may change, which may cause the memory snapshot file of the target virtual machine created based on the virtual machine management component and the disk snapshot file of the target virtual machine created based on the disk management component to be inconsistent, resulting in snapshot errors.
[0140] However, through this embodiment, the creation of the target virtual machine's memory snapshot file based on the virtual machine management component and the creation of the target virtual machine's disk snapshot file based on the disk management component can be executed when the target virtual machine is suspended. The target virtual machine is not working when it is suspended. When it is not working, the data in the virtual machine's memory and / or the data in the disk will not change. The memory snapshot file of the target virtual machine and the disk snapshot file of the target virtual machine can be correctly corresponded to avoid snapshot errors.
[0141] Reference Figure 3, shows a flowchart of the steps of a snapshot management method of the present application, the method is used to restore the memory of the virtual machine based on the created memory snapshot file of the virtual machine and restore the disk of the virtual machine based on the created disk snapshot file of the virtual machine, the method comprising:
[0142] In step S201, a recovery request is received based on the virtual machine API service, and the recovery request carries the ID of the target virtual machine and the ID of the target memory snapshot resource object to be restored of the target virtual machine. The recovery request is used to perform snapshot recovery on the target virtual machine according to the ID of the target virtual machine and the ID of the target memory snapshot resource object.
[0143] The target virtual machine is a virtual machine in the cluster, for example, a virtual machine on a physical machine in the cluster.
[0144] The recovery request can be sent by the operation and maintenance personnel of the cluster to the virtual machine API service in the cluster using the client. For example, when the operation and maintenance personnel need to restore the snapshot of the target virtual machine in the cluster, the recovery request can be sent to the virtual machine API service through the client. The recovery request can carry the ID of the target virtual machine and the ID of the target memory snapshot resource object that needs to be restored of the target virtual machine, so as to specify which snapshot of the virtual machine in the cluster is to be restored and to which snapshot to restore.
[0145] In this way, the cluster can receive the recovery request sent by the client based on the virtual machine API service.
[0146] In step S202, based on the virtual machine API service, according to the ID of the target virtual machine in the recovery request, the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine in the virtual machine API service.
[0147] The virtual machine API service has virtual machine resource objects for each virtual machine in the cluster.
[0148] The virtual machine resource object of the virtual machine records the relevant information of the virtual machine. Thus, in this step, based on the virtual machine API service, the virtual machine resource object of the target virtual machine in the virtual machine API service can be searched according to the ID of the target virtual machine, and then the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine.
[0149] In step S203, when the memory snapshot control component monitors that the ID of the target memory snapshot resource object that needs to be restored is added to the virtual machine resource object of the target virtual machine, the memory snapshot control component obtains the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the memory snapshot API service according to the ID of the target memory snapshot resource object.
[0150] In the present application, based on the memory snapshot control component, it is possible to monitor in real time whether the ID of the target memory snapshot resource object that needs to be restored is added in the virtual machine resource object of the target virtual machine. Once it is monitored that the ID of the target memory snapshot resource object that needs to be restored is added in the virtual machine resource object of the target virtual machine, based on the memory snapshot control component, according to the ID of the target memory snapshot resource object, the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file are obtained in the memory snapshot API service.
[0151] For example, based on the memory snapshot control component, a request is sent to the memory snapshot API service, and the request carries the ID of the target memory snapshot resource object.
[0152] Based on the memory snapshot API service receiving the acquisition request, searching for the target memory snapshot resource object according to the ID of the target memory snapshot resource object in the acquisition request, acquiring the storage path of the memory snapshot file and the ID of the disk snapshot file in the target memory snapshot resource object, and sending the storage path of the memory snapshot file and the ID of the disk snapshot file in the target memory snapshot resource object to the memory snapshot control component.
[0153] The memory snapshot control component receives the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file.
[0154] After executing step S203, step S204 and step S205 may be executed synchronously. After executing step S204, step S206 may be executed. After executing step S205, step S207 may be executed.
[0155] Step S206 and step S207 may also be executed synchronously.
[0156] In step S204, based on the memory snapshot control component, a first restoration instruction is sent to the disk management component, where the first restoration instruction carries the ID of the disk snapshot file.
[0157] In step S205, based on the memory snapshot control component, a second restoration instruction is sent to the virtual machine management component, where the second restoration instruction carries the storage path of the memory snapshot file.
[0158] In step S206, based on the disk management component, the disk snapshot file corresponding to the disk snapshot file ID is searched, and the disk of the target virtual machine is rolled back and restored according to the searched disk snapshot file.
[0159] The specific method for rolling back and restoring the disk of a virtual machine according to the disk snapshot file can refer to the currently existing method, which is not limited in this application and will not be described in detail.
[0160] In step S207, based on the virtual machine management component, the memory snapshot file is searched according to the storage path of the memory snapshot file, and the memory of the target virtual machine is rolled back and restored according to the found memory snapshot file.
[0161] The specific method for rolling back and restoring the memory of the virtual machine according to the memory snapshot file can refer to the currently existing method, which is not limited in this application and will not be described in detail.
[0162] In the present application, a memory snapshot control component, a virtual machine management component and a disk management component are added, and the memory snapshot control component can control the virtual machine management component and the disk management component respectively.
[0163] The memory snapshot control component can control the virtual machine management component to restore the virtual machine's memory according to the virtual machine's memory snapshot file and control the disk management component to restore the virtual machine's disk according to the virtual machine's disk snapshot file, and the process of the memory snapshot control component controlling the virtual machine management component to restore the virtual machine's memory according to the virtual machine's memory snapshot file and controlling the disk management component to restore the virtual machine's disk according to the virtual machine's disk snapshot file can be performed simultaneously, thereby reducing the time spent in the process of restoring the virtual machine according to the virtual machine's snapshot, saving time, improving the efficiency of restoring the virtual machine according to the virtual machine's snapshot, reducing the downtime of the virtual machine, and improving the user experience.
[0164] Reference Figure 4 , shows a flowchart of the steps of a snapshot management method of the present application, the method is used to delete the memory snapshot file and the disk snapshot file of the virtual machine, the method comprising:
[0165] In step S301, a deletion request is received based on the memory snapshot API service, and the deletion request carries the ID of a target memory snapshot resource object.
[0166] The deletion request can be sent by the operation and maintenance personnel of the cluster to the memory snapshot API service in the cluster using the client. For example, when the operation and maintenance personnel need to delete a memory snapshot of a virtual machine in the cluster, the deletion request can be sent to the memory snapshot API service through the client. The deletion request carries the ID of the target memory snapshot resource object to specify the memory snapshot file corresponding to the storage path of the memory snapshot file in which the memory snapshot resource object in the cluster is to be deleted, and to specify the disk snapshot file corresponding to the ID of the disk snapshot file in which the memory snapshot resource object in the cluster is to be deleted.
[0167] In this way, the cluster can receive the deletion request sent by the client based on the memory snapshot API service.
[0168] In step S302, based on the memory snapshot API service, according to the ID of the target memory snapshot resource object, in the target memory snapshot resource object in the memory snapshot API service, the state of the target memory snapshot resource object is set to a pre-deletion state.
[0169] The memory snapshot API service has each memory snapshot resource object of each virtual machine in the cluster, and the memory snapshot resource object of the virtual machine records the relevant information of the memory snapshot of the virtual machine.
[0170] Among them, based on the memory snapshot API service, according to the ID of the target memory snapshot resource object, the target memory snapshot resource object can be searched in the memory snapshot API service, and one of the fields in the target memory snapshot resource object is used to record the state of the target memory snapshot resource object. At this time, the field may record "created", and the "created" in the field may be deleted, and "pre-deleted" may be recorded in the field, so as to set the state of the target memory snapshot resource object in the memory snapshot API service to the pre-deleted state.
[0171] In step S303, when the memory snapshot control component monitors that the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is in a pre-deletion state, the memory snapshot control component obtains the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file via the memory snapshot API service.
[0172] In the present application, the memory snapshot control component can monitor in real time whether the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is a pre-deletion state. Once it is monitored that the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is a pre-deletion state, the memory snapshot control component obtains the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file via the memory snapshot API service.
[0173] For example, based on the memory snapshot control component, a request is sent to the memory snapshot API service, and the request carries the ID of the target memory snapshot resource object.
[0174] Based on the memory snapshot API service, a request is received, the target memory snapshot resource object is searched according to the ID of the target memory snapshot resource object in the request, the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file are obtained, and the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file are sent to the memory snapshot control component.
[0175] Based on the memory snapshot control component, the storage path of the memory snapshot file and the ID of the disk snapshot file in the target memory snapshot resource object are received.
[0176] After executing step S303, step S304 and step S305 may be executed synchronously. After executing step S304, step S306 may be executed. After executing step S305, step S307 may be executed.
[0177] Step S306 and step S307 may also be executed synchronously.
[0178] In step S304, based on the memory snapshot control component, a first deletion instruction is sent to the disk management component, where the first deletion instruction carries the ID of the disk snapshot file.
[0179] In step S305, based on the memory snapshot control component, a second deletion instruction is sent to the virtual machine management component, where the second deletion instruction carries the storage path of the memory snapshot file.
[0180] In step S306, based on the disk management component, the disk snapshot file corresponding to the ID of the disk snapshot file is searched, and the found disk snapshot file is deleted.
[0181] In step S307, based on the virtual machine management component, the memory snapshot file is searched according to the storage path of the memory snapshot file, and the found memory snapshot file is deleted.
[0182] In the present application, a memory snapshot control component, a virtual machine management component and a disk management component are added, and the memory snapshot control component can control the virtual machine management component and the disk management component respectively.
[0183] The memory snapshot control component can control the virtual machine management component to delete the virtual machine's memory snapshot files and control the disk management component to delete the virtual machine's disk snapshot files, and the process of the memory snapshot control component controlling the virtual machine management component to delete the virtual machine's memory snapshot files and controlling the disk management component to delete the virtual machine's disk snapshot files can be performed simultaneously, thereby reducing the time spent on deleting the virtual machine's snapshots, saving time, improving the efficiency of deleting the virtual machine's snapshots, and enhancing the user experience.
[0184] Furthermore, when the state of the target memory snapshot resource object in the memory snapshot API service is in the pre-deletion state based on the memory snapshot control component monitoring, the ID of the virtual machine in the target memory snapshot resource object in the memory snapshot API service is obtained according to the ID of the target memory snapshot resource object, and a deletion instruction is sent to the virtual machine API service based on the memory snapshot control component, and the deletion instruction carries the ID of the virtual machine in the target memory snapshot resource object and the ID of the target memory snapshot resource object. Based on the virtual machine API service, the ID list of the memory snapshot resource object of the virtual machine corresponding to the ID of the virtual machine is searched in the virtual machine API service, and the ID of the target memory snapshot resource object is deleted from the ID list of the memory snapshot resource object of the virtual machine corresponding to the ID of the virtual machine to save space.
[0185] Secondly, based on the memory snapshot control component, a delete state change instruction is sent to the memory snapshot API service, and the delete state change instruction carries the ID of the target memory snapshot resource object.
[0186] Based on the memory snapshot API service receiving the deletion state change instruction, according to the ID of the target memory snapshot resource object, the target memory snapshot resource object is searched in the memory snapshot API service, and in the target memory snapshot resource object, the state of the target memory snapshot resource object is set to a deletable state.
[0187] Among them, one of the fields in the target memory snapshot resource object is used to record the status of the target memory snapshot resource object. At this time, what is recorded in the field may be "pre-deletion". The "pre-deletion" in the field may be deleted, and "deletable" may be recorded in the field to set the status of the target memory snapshot resource object to a deletable state in the target memory snapshot resource object.
[0188] When the memory snapshot API service monitors that the state of the target memory snapshot resource object is a deletable state, the memory snapshot API service deletes the target memory snapshot resource object in the memory snapshot API service in the new memory snapshot resource object of the target virtual machine, thereby saving space.
[0189] It should be noted that, for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions involved are not necessarily required by the present application.
[0190] Reference Figure 5 , shows a snapshot management device of the present application, the device comprising:
[0191] A first receiving module 11 is used to receive a creation request for creating a snapshot of a target virtual machine in a cluster based on a virtual machine API service;
[0192] A new module 12 is used to add a new ID of a new memory snapshot resource object of a target virtual machine in a list of identity identification numbers ID of a memory snapshot resource object in a virtual machine resource object of a target virtual machine in the virtual machine API service according to a creation request based on the virtual machine API service;
[0193] The detection module 13 is used to detect whether there is a new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service based on the memory snapshot control component;
[0194] A first sending module 14 is used to send a first creation instruction to the memory snapshot API service based on the memory snapshot control component when there is no new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service, where the first creation instruction is used to instruct to create a new memory snapshot resource object of the target virtual machine;
[0195] The first creation module 15 is used to create a new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service according to the first creation instruction based on the memory snapshot API service, and record the state of the new memory snapshot resource object of the target virtual machine as being in a creating state in the new memory snapshot resource object of the target virtual machine;
[0196] The second creation module 16 is used to create a memory snapshot file of the target virtual machine based on the virtual machine management component, store the memory snapshot file of the target virtual machine, and send a first storage instruction to the memory snapshot API service via the memory snapshot control component, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in the creating state; the first storage instruction carries the storage path of the memory snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine;
[0197] The first storage module 17 is used to store the storage path of the memory snapshot file of the target virtual machine in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service according to the new ID of the new memory snapshot resource object of the target virtual machine;
[0198] The third creation module 18 is used to create a disk snapshot file of the target virtual machine based on the disk management component, store the disk snapshot file of the target virtual machine, and send a second storage instruction to the memory snapshot API service via the memory snapshot control component, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in the creating state based on the disk management component; the second storage instruction carries the ID of the disk snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine;
[0199] The second storage module 19 is used to store the ID of the disk snapshot file of the target virtual machine in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service according to the new ID of the new memory snapshot resource object of the target virtual machine;
[0200] The updating module 20 is used to update the state of the new memory snapshot resource object of the target virtual machine to a creation completed state in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service, when it is monitored based on the memory snapshot API service that the new memory snapshot resource object of the target virtual machine has the storage path of the memory snapshot file of the target virtual machine and the ID of the disk snapshot file of the target virtual machine.
[0201] In an optional implementation, the device further includes:
[0202] A pause module, used for controlling the target virtual machine to pause operation based on the virtual machine management component when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in a creating state;
[0203] A second sending module is used to send a state change instruction to the virtual machine API service via the memory snapshot control component based on the virtual machine management component, where the state change instruction carries the ID of the target virtual machine and an indication that the target virtual machine is suspended;
[0204] A first setting module is used for, after receiving the state change instruction based on the virtual machine API service, setting the state of the target virtual machine in the virtual machine resource object of the target virtual machine to the suspended state according to the ID of the target virtual machine and the indication that the target virtual machine is suspended;
[0205] Accordingly, the third creation module includes:
[0206] A monitoring unit, configured to monitor whether the state of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in a paused state based on the disk management component monitoring the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine is in a creating state based on the disk management component monitoring the state of the target virtual machine in the virtual machine resource object of the target virtual machine based on the disk management component;
[0207] The creation unit is used to create a disk snapshot file of the target virtual machine based on the disk management component when the disk management component monitors that the state of the target virtual machine in the virtual machine resource object of the target virtual machine is in the suspended state.
[0208] In an optional implementation, the detection module includes:
[0209] A searching unit is used to search for a memory snapshot resource object with a new ID in the existing memory snapshot resource objects of the target virtual machine in the memory snapshot API service based on the memory snapshot control component; a first determining unit is used to determine that a new memory snapshot resource object of the target virtual machine corresponding to the new ID exists in the memory snapshot API service when the memory snapshot resource object with the new ID is found; or, a second determining unit is used to determine that a new memory snapshot resource object of the target virtual machine corresponding to the new ID does not exist in the memory snapshot API service when the memory snapshot resource object with the new ID is not found.
[0210] Reference Figure 6 , shows a snapshot management device of the present application, the device comprising:
[0211] The second receiving module 31 is used to receive a recovery request based on the virtual machine API service, where the recovery request carries the ID of the target virtual machine and the ID of the target memory snapshot resource object to be restored of the target virtual machine, and the recovery request is used to perform snapshot recovery on the target virtual machine according to the ID of the target virtual machine and the ID of the target memory snapshot resource object;
[0212] An adding module 32 is used to add the ID of the target memory snapshot resource object to be restored in the virtual machine resource object of the target virtual machine in the virtual machine API service according to the ID of the target virtual machine in the recovery request based on the virtual machine API service;
[0213] The first acquisition module 33 is used to obtain the storage path of the memory snapshot file and the ID of the disk snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the target memory snapshot resource object in the memory snapshot API service based on the memory snapshot control component and the ID of the target memory snapshot resource object when the memory snapshot control component monitors that the ID of the target memory snapshot resource object that needs to be restored is added to the virtual machine resource object of the target virtual machine;
[0214] A third sending module 34 is used to send a first restoration instruction to the disk management component based on the memory snapshot control component, where the first restoration instruction carries the ID of the disk snapshot file;
[0215] A fourth sending module 35, configured to send a second restoration instruction to the virtual machine management component based on the memory snapshot control component, where the second restoration instruction carries a storage path of the memory snapshot file;
[0216] A first recovery module 36 is used to search for a disk snapshot file corresponding to the ID of the disk snapshot file based on the disk management component, and perform rollback recovery on the disk of the target virtual machine according to the found disk snapshot file;
[0217] The second recovery module 37 is used to search for the memory snapshot file according to the storage path of the memory snapshot file based on the virtual machine management component, and perform rollback recovery on the memory of the target virtual machine according to the found memory snapshot file.
[0218] Reference Figure 7 , shows a snapshot management device of the present application, the device comprising:
[0219] The third receiving module 41 is used to receive a deletion request based on the memory snapshot API service, where the deletion request carries the ID of the target memory snapshot resource object;
[0220] A second setting module 42 is used to set the state of the target memory snapshot resource object to a pre-deletion state in the target memory snapshot resource object in the memory snapshot API service based on the memory snapshot API service and according to the ID of the target memory snapshot resource object;
[0221] The second acquisition module 43 is used to acquire the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the target memory snapshot resource object through the memory snapshot API service based on the memory snapshot control component when the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is in the pre-deletion state based on the memory snapshot control component;
[0222] A fifth sending module 44 is configured to send a first deletion instruction to the disk management component based on the memory snapshot control component, where the first deletion instruction carries the ID of the disk snapshot file;
[0223] A sixth sending module 45, configured to send a second deletion instruction to the virtual machine management component based on the memory snapshot control component, where the second deletion instruction carries a storage path of the memory snapshot file;
[0224] A first deleting module 46 is used to search for a disk snapshot file corresponding to the ID of the disk snapshot file based on the disk management component, and delete the found disk snapshot file;
[0225] The second deleting module 47 is used to search for the memory snapshot file according to the storage path of the memory snapshot file based on the virtual machine management component, and delete the found memory snapshot file.
[0226] Optionally, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0227] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0228] Figure 8 800 is a block diagram of an electronic device 800 shown in the present application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0229] Reference Figure 8, the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0230] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0231] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, images, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0232] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.
[0233] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also monitor the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0234] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0235] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0236] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can monitor the open / closed state of the device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also monitor the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to monitor the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0237] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast operation information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (I rDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0238] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0239] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0240] Fig. 9 1 is a block diagram of an electronic device 1900 shown in the present application. For example, the electronic device 1900 may be provided as a server.
[0241] Reference Fig. 9 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0242] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0243] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0244] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0245] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0246] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0247] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0248] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0249] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0250] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0251] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0252] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A snapshot management method, characterized in that: The method comprises: Receiving, based on the virtual machine application programming interface API service, a creation request for creating a snapshot of a target virtual machine in the cluster; Based on the virtual machine API service, according to the creation request, a new ID of a new memory snapshot resource object of the target virtual machine is added to the ID list of the memory snapshot resource object in the virtual machine resource object of the target virtual machine in the virtual machine API service; Based on the memory snapshot control component, detect whether there is a new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service; In the case that there is no new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service, based on the memory snapshot control component, sending a first creation instruction to the memory snapshot API service, where the first creation instruction is used to instruct to create a new memory snapshot resource object of the target virtual machine; Based on the memory snapshot API service, according to the first creation instruction, in the memory snapshot API service, a new memory snapshot resource object of the target virtual machine corresponding to the new ID is created, and in the new memory snapshot resource object of the target virtual machine, a state of the new memory snapshot resource object of the target virtual machine is recorded as being in a creating state; In a case where the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in the creating state, a memory snapshot file of the target virtual machine is created based on the virtual machine management component, the memory snapshot file of the target virtual machine is stored, and a first storage instruction is sent to the memory snapshot API service via the memory snapshot control component, where the first storage instruction carries a storage path of the memory snapshot file and a new ID of the new memory snapshot resource object of the target virtual machine; Based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the storage path of the memory snapshot file of the target virtual machine is stored in the new memory snapshot resource object of the target virtual machine; In the case that the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, a disk snapshot file of the target virtual machine is created based on the disk management component, the disk snapshot file of the target virtual machine is stored, and a second storage instruction is sent to the memory snapshot API service via the memory snapshot control component, where the second storage instruction carries the ID of the disk snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine; Based on the memory snapshot API service, according to the new ID of the new memory snapshot resource object of the target virtual machine, the ID of the disk snapshot file of the target virtual machine is stored in the new memory snapshot resource object of the target virtual machine; In the case where the memory snapshot API service monitors that the new memory snapshot resource object of the target virtual machine has the storage path of the memory snapshot file of the target virtual machine and the ID of the disk snapshot file of the target virtual machine, the memory snapshot API service updates the state of the new memory snapshot resource object of the target virtual machine to a creation completed state in the new memory snapshot resource object of the target virtual machine.
2. The method according to claim 1, characterized in that The method further comprises: In a case where the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in a creating state, controlling the target virtual machine to suspend operation based on the virtual machine management component; Sending a state change instruction to the virtual machine API service via the memory snapshot control component based on the virtual machine management component, the state change instruction carrying the ID of the target virtual machine and an indication of suspending the operation of the target virtual machine, and then executing the step of creating a memory snapshot file of the target virtual machine based on the virtual machine management component; After receiving the state change instruction, the virtual machine API service sets the state of the target virtual machine in the virtual machine resource object of the target virtual machine to the suspended state according to the ID of the target virtual machine and the indication that the target virtual machine is suspended; Accordingly, in the case that the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, creating a disk snapshot file of the target virtual machine based on the disk management component includes: In the case that the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, the state of the target virtual machine in the virtual machine resource object monitored by the disk management component is whether it is in the paused state; When the disk management component monitors that the state of the target virtual machine in the virtual machine resource object of the target virtual machine is in the suspended state, the disk management component creates a disk snapshot file of the target virtual machine.
3. The method according to claim 2, characterized in that The memory snapshot control component is based on detecting whether there is a new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service, including: Based on the memory snapshot control component, searching for a memory snapshot resource object with a new ID in the existing memory snapshot resource objects of the target virtual machine in the memory snapshot API service; When a memory snapshot resource object with a new ID is found, determining that a new memory snapshot resource object of the target virtual machine corresponding to the new ID exists in the memory snapshot API service; Alternatively, when no memory snapshot resource object with a new ID is found, it is determined that no new memory snapshot resource object of the target virtual machine corresponding to the new ID exists in the memory snapshot API service.
4. A snapshot management method, characterized in that: The method comprises: A recovery request is received based on a virtual machine application programming interface API service, the recovery request carries an identity ID of a target virtual machine and an ID of a target memory snapshot resource object of the target virtual machine that needs to be recovered, and the recovery request is used to perform snapshot recovery on the target virtual machine according to the ID of the target virtual machine and the ID of the target memory snapshot resource object; Based on the virtual machine API service, the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine in the virtual machine API service according to the ID of the target virtual machine in the restore request; In the case where the memory snapshot control component monitors that the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine, the memory snapshot control component obtains the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the memory snapshot API service according to the ID of the target memory snapshot resource object; Based on the memory snapshot control component, a first recovery instruction is sent to the disk management component, where the first recovery instruction carries the ID of the disk snapshot file; Based on the memory snapshot control component, a second restoration instruction is sent to the virtual machine management component, where the second restoration instruction carries a storage path of the memory snapshot file; Based on the disk management component, the disk snapshot file corresponding to the disk snapshot file ID is searched, and the disk of the target virtual machine is rolled back and restored according to the found disk snapshot file; Based on the virtual machine management component, the memory snapshot file is searched according to the storage path of the memory snapshot file, and the memory of the target virtual machine is rolled back and restored according to the found memory snapshot file.
5. A snapshot management method, characterized in that: The method comprises: Based on the memory snapshot application programming interface API service, a deletion request is received, where the deletion request carries the identity ID of the target memory snapshot resource object; Based on the memory snapshot API service, according to the ID of the target memory snapshot resource object, in the target memory snapshot resource object in the memory snapshot API service, setting the state of the target memory snapshot resource object to a pre-deletion state; In the case that the memory snapshot control component monitors that the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is in the pre-deletion state, the memory snapshot control component obtains the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file through the memory snapshot API service; Based on the memory snapshot control component, a first deletion instruction is sent to the disk management component, where the first deletion instruction carries the ID of the disk snapshot file; Based on the memory snapshot control component, a second deletion instruction is sent to the virtual machine management component, where the second deletion instruction carries a storage path of the memory snapshot file; Based on the disk management component, find the disk snapshot file corresponding to the disk snapshot file ID, and delete the found disk snapshot file; Based on the virtual machine management component, the memory snapshot file is searched according to the storage path of the memory snapshot file, and the found memory snapshot file is deleted.
6. A snapshot management device, characterized in that: The device comprises: A first receiving module is used to receive a creation request for creating a snapshot of a target virtual machine in a cluster based on a virtual machine application programming interface API service; A new module is added, which is used to add a new ID of a new memory snapshot resource object of a target virtual machine in a list of identity identification numbers ID of a memory snapshot resource object in a virtual machine resource object of a target virtual machine in the virtual machine API service according to a creation request based on the virtual machine API service; A detection module, used to detect whether there is a new memory snapshot resource object of a target virtual machine corresponding to a new ID in the memory snapshot API service based on the memory snapshot control component; A first sending module is used to send a first creation instruction to the memory snapshot API service based on the memory snapshot control component when there is no new memory snapshot resource object of the target virtual machine corresponding to the new ID in the memory snapshot API service, wherein the first creation instruction is used to instruct to create a new memory snapshot resource object of the target virtual machine; A first creation module is used to create a new memory snapshot resource object of a target virtual machine corresponding to a new ID in the memory snapshot API service according to a first creation instruction based on the memory snapshot API service, and record in the new memory snapshot resource object of the target virtual machine a state of the new memory snapshot resource object of the target virtual machine as a creating state; A second creation module is used for, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the virtual machine management component is in the creating state, creating a memory snapshot file of the target virtual machine based on the virtual machine management component, storing the memory snapshot file of the target virtual machine, and sending a first storage instruction to the memory snapshot API service via the memory snapshot control component, the first storage instruction carrying the storage path of the memory snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine; A first storage module is used to store a storage path of the memory snapshot file of the target virtual machine in a new memory snapshot resource object of the target virtual machine based on the memory snapshot API service according to a new ID of the new memory snapshot resource object of the target virtual machine; A third creation module is used for, when the state of the new memory snapshot resource object of the target virtual machine recorded in the new memory snapshot resource object of the target virtual machine monitored by the disk management component is in the creating state, creating a disk snapshot file of the target virtual machine based on the disk management component, storing the disk snapshot file of the target virtual machine, and sending a second storage instruction to the memory snapshot API service via the memory snapshot control component, where the second storage instruction carries the ID of the disk snapshot file and the new ID of the new memory snapshot resource object of the target virtual machine; A second storage module is used to store the ID of the disk snapshot file of the target virtual machine in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service according to the new ID of the new memory snapshot resource object of the target virtual machine; The update module is used to update the state of the new memory snapshot resource object of the target virtual machine to a creation completed state in the new memory snapshot resource object of the target virtual machine based on the memory snapshot API service, when the new memory snapshot resource object of the target virtual machine has the storage path of the memory snapshot file of the target virtual machine and the ID of the disk snapshot file of the target virtual machine monitored based on the memory snapshot API service.
7. A snapshot management device, characterized in that: The device comprises: A second receiving module is used to receive a recovery request based on a virtual machine application programming interface API service, where the recovery request carries an identity ID of a target virtual machine and an ID of a target memory snapshot resource object of the target virtual machine that needs to be restored, and the recovery request is used to perform snapshot recovery on the target virtual machine according to the ID of the target virtual machine and the ID of the target memory snapshot resource object; An adding module is used to add the ID of the target memory snapshot resource object to be restored in the virtual machine resource object of the target virtual machine in the virtual machine API service according to the ID of the target virtual machine in the recovery request based on the virtual machine API service; The first acquisition module is used to acquire, based on the memory snapshot control component, the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the memory snapshot API service according to the ID of the target memory snapshot resource object, when the memory snapshot control component monitors that the ID of the target memory snapshot resource object to be restored is added to the virtual machine resource object of the target virtual machine; A third sending module is used to send a first restoration instruction to the disk management component based on the memory snapshot control component, where the first restoration instruction carries the ID of the disk snapshot file; A fourth sending module, configured to send a second restoration instruction to the virtual machine management component based on the memory snapshot control component, where the second restoration instruction carries a storage path of the memory snapshot file; A first recovery module is used to search for a disk snapshot file corresponding to an ID of the disk snapshot file based on a disk management component, and perform rollback recovery on the disk of the target virtual machine according to the found disk snapshot file; The second recovery module is used to search for the memory snapshot file according to the storage path of the memory snapshot file based on the virtual machine management component, and perform rollback recovery on the memory of the target virtual machine according to the found memory snapshot file.
8. A snapshot management device, characterized in that: The device comprises: A third receiving module is used to receive a deletion request based on the memory snapshot application programming interface API service, where the deletion request carries an identity ID of a target memory snapshot resource object; A second setting module is used to set the state of the target memory snapshot resource object to a pre-deletion state in the target memory snapshot resource object in the memory snapshot API service based on the memory snapshot API service according to the ID of the target memory snapshot resource object; A second acquisition module is used to acquire the storage path of the memory snapshot file in the target memory snapshot resource object and the ID of the disk snapshot file in the target memory snapshot resource object through the memory snapshot API service based on the memory snapshot control component when the state of the target memory snapshot resource object in the target memory snapshot resource object in the memory snapshot API service is in a pre-deletion state based on the memory snapshot control component; A fifth sending module, configured to send a first deletion instruction to the disk management component based on the memory snapshot control component, where the first deletion instruction carries an ID of the disk snapshot file; A sixth sending module, configured to send a second deletion instruction to the virtual machine management component based on the memory snapshot control component, where the second deletion instruction carries a storage path of the memory snapshot file; A first deletion module is used to search for a disk snapshot file corresponding to the ID of the disk snapshot file based on the disk management component, and delete the found disk snapshot file; The second deleting module is used to search for the memory snapshot file according to the storage path of the memory snapshot file based on the virtual machine management component, and delete the found memory snapshot file.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the snapshot management method according to any one of claims 1 to 5 when executed by the processor.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the snapshot management method according to any one of claims 1 to 5 is implemented.