Virtual machine restoration method and device and electronic equipment
By using the writable advanced file system driver in the GuestOS stage, data restoration of virtual machines is solved based on startup information and policy information, and the difficulties and data security issues in implementing writable advanced file system drivers in UEFI are solved, ensuring data integrity and Security.
Patent Information
- Application Number
- CN202310760228.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-26
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2043-06-26
AI Technical Summary
In the UEFI VOI scheme, it is difficult to implement a complete writable advanced file system driver, and due to defects in writable advanced file system drivers, it may lead to serious consequences such as data loss, data overwrite or data inconsistency.
By reading the startup information in the GuestOS stage, the data of the object to be restored is restored to the target restore point based on the restore identifier and restore policy information, and the writable advanced file system driver in GuestOS is used to restore data, avoiding the implementation of writable advanced in the UEFI stage File system driver.
It effectively avoids data problems caused by difficulties and defects in implementing writable advanced file system drivers in the UEFI stage, ensuring data security and integrity.
Smart Images

Figure CN119201330A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of virtual machines, and in particular to a method, device and electronic device for restoring a virtual machine. Background Art
[0002] With the rapid development of virtualization and cloud computing technologies, the use of cloud desktops is becoming more and more popular. The virtual operating system infrastructure (VOI) in cloud desktops has no hardware virtualization layer, which avoids the overhead of the virtualization layer, has almost zero performance consumption, and maximizes compatibility. It has gradually become one of the mainstream virtual machine technologies and has been adopted by many manufacturers.
[0003] At present, among the traditional VOI solutions, the VOI technical solution based on the unified extensible firmware interface (UEFI) basic input output system (BIOS) to directly start the virtual machine (VM), namely the UEFI VOI solution, has gradually come into people's view because the startup time only introduces a short loading time of the boot manager (bootmgr) and is compatible with various central processing unit (CPU) architectures.
[0004] When the above UEFI VOI solution starts the VM, based on user needs, a restore operation needs to be introduced into the UEFI VOI solution to restore the object to be restored to the target restore point, thereby avoiding problems such as data loss caused by VM failure or downtime. The UEFI VOI solution can be divided into two stages: the UEFI stage and the Guest Operating System (GuestOS) stage.
[0005] When the restore operation is introduced in the UEFI stage, it is first necessary to read the VM image file in the advanced file system through the readable advanced file system driver, and then restore the object to be restored based on the writable advanced file system driver.
[0006] However, there is only a readable advanced file system driver in UEFI. Therefore, when the restore operation is introduced in the UEFI stage, it is also necessary to implement a complete writable advanced file system driver in UEFI, and then restore the object to be restored based on the writable advanced file system driver.
[0007] However, when implementing a complete writable advanced file system driver in UEFI, engineers with a deep understanding of the advanced file system are needed to write the relevant code of the writable advanced file system driver, and a large number of test data sets are also needed to test the correctness of the relevant code, etc., which makes it very difficult to implement a complete writable advanced file system driver; at the same time, during the operation of the writable advanced file system driver, once the writable advanced file system driver itself has defects, serious consequences such as data loss, data overwriting, and data inconsistency will occur. Summary of the invention
[0008] The present application provides a method, device and electronic device for restoring a virtual machine, which is used to solve the problem of the difficulty of implementing a complete writable advanced file system driver in UEFI when restoring the object to be restored, and the serious consequences such as data loss caused by the defects of the complete writable advanced file system driver itself during the operation of the driver. The specific implementation scheme is as follows:
[0009] In a first aspect, the present application provides a method for restoring a virtual machine, the method comprising:
[0010] In response to starting the guest operating system GuestOS in the target virtual machine, reading the startup information from the designated storage area, the startup information including a restore flag, the restore flag being used to indicate whether to restore the data in the object to be restored to the data corresponding to the target restore point;
[0011] If the restore identifier indicates restoration, the data in the object to be restored is restored to the data corresponding to the target restore point according to the restoration policy information corresponding to the target virtual machine, and each virtual disk in the target virtual machine is mounted as a disk recognizable by the GuestOS, wherein the restoration policy information indicates the object to be restored.
[0012] Through the above method, based on the restore identifier and the restore policy information, the restore operation of the virtual machine is configured to the GuestOS stage. Because there is a writable advanced file system driver in the GuestOS, the data in the object to be restored can be restored to the data corresponding to the target restore point based on the writable advanced file system driver in the GuestOS stage according to the restore policy information. Therefore, it is avoided to implement a complete writable advanced file system driver in the UEFI stage, and it is avoided that when the writable advanced file system driver is run in the UEFI stage, serious consequences such as data loss caused by its own defects are caused.
[0013] In a possible implementation manner, before reading the startup information from the designated storage area, the method further includes:
[0014] In the Unified Extensible Firmware Interface (UEFI) stage or in the maintenance system, the startup information is generated and saved in the designated storage area.
[0015] In the above manner, the startup information can be generated in the UEFI stage or in the maintenance system, and the startup information is stored in the designated storage area, so that when the electronic device determines whether to perform the restore operation in the GuestOS stage, it can directly read the generated startup information from the designated storage area. At the same time, if the startup information is generated in the maintenance system, the startup information can be directly parsed in the UEFI stage later, which reduces the running time of the UEFI stage.
[0016] In a possible implementation manner, the generating the startup information includes:
[0017] Obtain a metadata file path, where the metadata file path corresponds to the target virtual machine to be started;
[0018] The startup information is generated according to the restoration identifier and the metadata file path.
[0019] In the above manner, the startup information is generated according to the restore identifier and the metadata file path, so that based on the restore identifier in the startup information, the electronic device can determine whether to perform the restore operation, further ensuring that the restore operation is delayed to the GuestOS stage, avoiding the limitation that UEFI does not have a writable advanced file system driver, thereby further ensuring that the electronic device can perform the restore operation. And the restore identifier is saved in the startup information, and the content in the restore identifier can be dynamically adjusted, so that the restore identifier is updated in real time each time the virtual machine is started. In addition, according to the metadata file path, the metadata in the metadata file can be read, and the metadata is the entry to access the persistent data in the target virtual machine, which contains various key information of the target virtual machine, so that the target virtual machine to be started can be determined according to the metadata file path, so that when there are multiple virtual machines, the electronic device can determine the virtual machine to be operated.
[0020] In a possible implementation manner, before generating the startup information according to the restoration identifier and the metadata file path, the method further includes:
[0021] Receiving a restore instruction generated based on a user operation or a restore instruction generated based on the restore policy information;
[0022] According to the restoration instruction, the restoration flag is updated.
[0023] In the above manner, the restore flag can be updated according to the restore instruction generated by the user operation, so that it can be determined based on the user selection whether the target virtual machine is started to perform the restore operation. The restore instruction can also be automatically generated according to the restore policy information, and the restore flag is updated based on the restore instruction, so that the electronic device can determine whether the target virtual machine is started to perform the restore operation.
[0024] In a possible implementation manner, before reading the startup information from the designated storage area, the method further includes:
[0025] Obtaining the restoration time corresponding to the target virtual machine and the object to be restored in the target virtual machine;
[0026] The restoration policy information is generated according to the restoration time and the object to be restored.
[0027] Through the above method, the restore policy information is generated according to the restore time and the object to be restored corresponding to the received target virtual machine. Based on the restore policy information, it is further ensured that the restore operation is delayed to the GuestOS stage, avoiding the limitation that UEFI does not have a writable advanced file system driver, thereby further ensuring that the electronic device can perform the restore operation; and, based on the restore time in the restore policy information, data can be provided for the restore identifier in the startup information to support the restore identifier to indicate whether to restore; at the same time, based on the object to be restored in the restore policy information, the electronic device can clearly identify the object of the restore operation when performing the restore operation.
[0028] In a possible implementation manner, before reading the startup information from the designated storage area, the method further includes:
[0029] Receiving an instruction indicating the target restore point;
[0030] Based on the instruction, in the startup information, the initial restore point is modified to the target restore point.
[0031] Through the above method, based on the received instruction containing the target restore point, the initial restore point is modified to the target restore point in the startup information, so that the target restore point can be determined through the startup information, so that the electronic device can clearly know the data to be restored when the data in the object to be restored is restored; and, by setting the target restore point in the startup information, the specific target restore point can be dynamically adjusted, so that the target restore point can be modified in real time each time the VM is started.
[0032] In a possible implementation manner, after reading the startup information from the designated storage area, the method further includes:
[0033] If the restore flag indicates not to restore, each virtual disk in the target virtual machine is mounted as a disk recognizable by the GuestOS.
[0034] In the above manner, when the restore flag indicates not to restore, the electronic device directly mounts each virtual disk in the target virtual machine as a disk recognizable by the GuestOS, so that when the target virtual machine is started this time without performing a restore action, the target virtual machine can continue to be started.
[0035] In a possible implementation manner, after mounting each virtual disk in the target virtual machine as a disk recognizable by the GuestOS, the method further includes:
[0036] When the target virtual machine is running, saving data in the change information generated by the target virtual machine to the created differential file;
[0037] The new path in the change information is updated to the metadata file corresponding to the metadata file path or the created temporary file, wherein the new path is the path after the path corresponding to the file in the target virtual machine has changed.
[0038] By means of the above method, the change information generated when the target virtual machine is running is saved, so that the change information generated when the target virtual machine is running last time cannot be restored after the target virtual machine is started to perform a restore action next time.
[0039] In a possible implementation manner, the startup information is stored in the designated storage area that is readable and persistent, and after mounting each virtual disk in the target virtual machine as a disk recognizable by the GuestOS, the method further includes:
[0040] Obtaining the restoration time in the restoration policy information or receiving a new restoration instruction generated based on a user operation;
[0041] Generate a new restoration identifier according to the restoration time or the new restoration instruction;
[0042] Generate new startup information according to the new restore identifier and the acquired new metadata file path, and save the new startup information to the designated storage area that is readable, writable and persistent, wherein the new metadata file path corresponds to the target virtual machine to be started;
[0043] According to the new startup information, a restart operation of the target virtual machine is performed.
[0044] Through the above method, a new restore identifier is generated according to the restore time in the restore policy information or the new restore instruction of the user operation; then new startup information is generated according to the new restore identifier and the new metadata file path; thereby, the electronic device can clearly identify the virtual machine to be started according to the new metadata file path in the new startup information, and then the electronic device can execute the restart operation of the target virtual machine; and the electronic device can also clearly determine whether a restore operation needs to be performed when starting the target virtual machine according to the new restore identifier in the new startup information.
[0045] In a second aspect, the present application further provides a virtual machine restoration device, the device comprising:
[0046] A reading module, configured to read startup information from a specified storage area in response to starting a guest operating system GuestOS in a target virtual machine, wherein the startup information includes a restore flag, and the restore flag is used to indicate whether to restore data in the object to be restored to data corresponding to a target restore point;
[0047] A processing module is used to restore the data in the object to be restored to the data corresponding to the target restore point according to the restoration policy information corresponding to the target virtual machine if the restoration identifier indicates restoration, and to mount each virtual disk in the target virtual machine as a disk recognizable by the GuestOS, wherein the restoration policy information indicates the object to be restored.
[0048] In a possible implementation, the reading module is specifically configured to generate the startup information in a unified extensible firmware interface UEFI stage or in a maintenance system, and save the startup information to the designated storage area.
[0049] In a possible implementation, the reading module is specifically used to obtain a metadata file path, where the metadata file path corresponds to the target virtual machine to be started;
[0050] The startup information is generated according to the restoration identifier and the metadata file path.
[0051] In a possible implementation manner, the reading module is specifically configured to receive a restore instruction generated based on a user operation or a restore instruction generated based on the restore policy information;
[0052] According to the restoration instruction, the restoration flag is updated.
[0053] In a possible implementation manner, the reading module is specifically configured to obtain the restoration time corresponding to the target virtual machine and the object to be restored in the target virtual machine;
[0054] The restoration policy information is generated according to the restoration time and the object to be restored.
[0055] In a possible implementation manner, the reading module is specifically configured to receive an instruction indicating the target restore point;
[0056] Based on the instruction, in the startup information, the initial restore point is modified to the target restore point.
[0057] In a possible implementation manner, the processing module is specifically configured to mount each virtual disk in the target virtual machine as a disk recognizable by the GuestOS if the restoration flag indicates not to perform restoration.
[0058] In a possible implementation manner, the processing module is specifically configured to save data in the change information generated by the target virtual machine to the created differential file when the target virtual machine is running;
[0059] The new path in the change information is updated to the metadata file corresponding to the metadata file path or the created temporary file, wherein the new path is the path after the path corresponding to the file in the target virtual machine has changed.
[0060] In a possible implementation manner, the processing module is specifically configured to obtain the restoration time in the restoration policy information or receive a new restoration instruction generated based on a user operation;
[0061] Generate a new restoration identifier according to the restoration time or the new restoration instruction;
[0062] Generate new startup information according to the new restore identifier and the acquired new metadata file path, and save the new startup information to the designated storage area that is readable, writable and persistent, wherein the new metadata file path corresponds to the target virtual machine to be started;
[0063] According to the new startup information, a restart operation of the target virtual machine is performed.
[0064] In a third aspect, the present application provides an electronic device, including:
[0065] Memory, used to store computer programs;
[0066] The processor is used to implement the above-mentioned steps of the method for restoring a virtual machine when executing the computer program stored in the memory.
[0067] In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for restoring a virtual machine are implemented.
[0068] For each aspect from the second to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 A flowchart of a method for restoring a virtual machine provided in this application;
[0070] Figure 2 A snapshot diagram provided for this application;
[0071] Figure 3 A schematic diagram of the processing process of a virtual machine restoration method provided in this application;
[0072] Figure 4 A schematic diagram of the structure of a virtual machine restoration device provided in this application;
[0073] Figure 5 A schematic diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operating methods in the method embodiments can also be applied to device embodiments or system embodiments. It should be noted that in the description of the present application, "multiple" is understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent: A is directly connected to B and A is connected to B through C. In addition, in the description of the present application, words such as "first" and "second" are only used to distinguish the purpose of description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.
[0075] In addition, the collection, dissemination, and use of data in the technical solution of this application comply with the requirements of relevant national laws and regulations.
[0076] The embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0077] Currently, when the restore operation is introduced in the UEFI stage, since there is no writable advanced file system driver in UEFI, it is necessary to implement a complete writable advanced file system driver in UEFI so as to restore the object to be restored based on the writable advanced file system driver.
[0078] However, when implementing a complete writable advanced file system driver in UEFI, engineers with a deep understanding of the advanced file system are needed to write the relevant code of the writable advanced file system driver, and a large number of test data sets are also needed to test the correctness of the relevant code, etc., which makes it very difficult to implement a complete writable advanced file system driver; at the same time, during the operation of the writable advanced file system driver, once the writable advanced file system driver itself has defects, serious consequences such as data loss, data overwriting, and data inconsistency will occur.
[0079] Therefore, the present application proposes a method for restoring a virtual machine, which specifically includes: in response to starting the GuestOS in the target VM, reading the startup information from a designated storage area; if the restore identifier in the startup information indicates restoration, restoring the data in the object to be restored to the data corresponding to the target restore point according to the restore policy information corresponding to the target VM, and mounting each virtual disk in the target VM as a disk recognizable by the GuestOS.
[0080] Through this method, the restore operation of the VM is configured to the GuestOS stage based on the restore identifier and the restore policy information. Since there is a writable advanced file system driver in the GuestOS, the data in the object to be restored can be restored to the data corresponding to the target restore point based on the writable advanced file system driver in the GuestOS stage according to the restore policy information. Therefore, it is avoided to implement a complete writable advanced file system driver in the UEFI stage, and it is avoided that when the writable advanced file system driver is run in the UEFI stage, serious consequences such as data loss caused by the defects of the writable advanced file system driver itself are caused.
[0081] Reference Figure 1 The figure shows a flow chart of a method for restoring a virtual machine provided in an embodiment of the present application. The method is applied to an electronic device, and the method includes:
[0082] S1, in response to starting a guest operating system GuestOS in a target virtual machine, reading startup information from a designated storage area.
[0083] When an electronic device executes the startup of a target VM, it can be divided into the UEFI stage and the GuestOS stage. In the UEFI stage, startup information is generated, and the system disk in the target VM is mounted, and then the loader (English: Loader) in the system disk is started. Then, based on the startup of the Loader, the GuestOS in the target VM is started. Then, in the GuestOS stage, the electronic device reads the startup information from the specified storage area.
[0084] It is worth noting that in addition to generating startup information in the UEFI stage, startup information can also be generated in the maintenance system and saved to a designated storage area. In an embodiment of the present application, it can be determined based on the user's choice whether to generate startup information in the UEFI stage or in the maintenance system.
[0085] It is understood that, in one embodiment, the maintenance system may include a maintenance function module stored locally, which may not be in the VM. One maintenance system corresponds to M VMs; M is an integer greater than or equal to 1. The maintenance system may install and configure the UEFI booter in the deployment phase before the UEFI phase. Optionally or additionally, the maintenance system may solve the disk damage problem when a third-party system is needed to solve the disk damage problem.
[0086] The above-mentioned designated storage area can be a readable, writable and persistent location in the embodiment of the present application, such as the Extensible Firmware Interface System Partition (ESP) of the hard disk, or a readable and writable UEFI variable, or a baseboard management controller (BMC) of a server-type terminal. When the restart operation is abandoned, the above-mentioned designated storage area can also be a memory in the embodiment of the present application.
[0087] In the above manner, the startup information can be generated in the UEFI stage or in the maintenance system, and the startup information is stored in the designated storage area, so that when the electronic device determines whether to perform the restore operation in the GuestOS stage, it can directly read the generated startup information from the designated storage area. At the same time, if the startup information is generated in the maintenance system, the startup information can be directly parsed in the UEFI stage later, which reduces the running time of the UEFI stage.
[0088] Before the electronic device reads the startup information, that is, before the electronic device enters the GuestOS stage, it needs to perform the corresponding operations in UEFI in the UEFI stage, and then enter the GuestOS stage. Before the UEFI stage, it is also necessary to deploy relevant information of the VM in order to obtain relevant information in the UEFI stage or in the GuestOS stage.
[0089] Specifically, when an electronic device deploys VM-related information, it includes completing the partition formatting of the native hard disk through the maintenance system, installing and configuring the UEFI booter, configuring the virtual machine list, deploying the virtual disk file, etc. The virtual disk file is also a kind of persistent data.
[0090] It should be noted here that in the embodiment of the present application, the virtual machine list contains multiple metadata file paths, each metadata file path corresponds to a metadata file, and the metadata in a metadata file corresponds to a VM. Therefore, when configuring the virtual machine list, the metadata file also needs to be configured.
[0091] The metadata in the above metadata file contains the disk information of each virtual disk in the VM. The virtual disk can be a system disk in the VM or a data disk in the VM. Therefore, the disk information can be the path information of the data disk, the path information of the system disk, the location information of the Loader in the system disk, etc. The above Loader is, for example, bootx64.efi.
[0092] In particular, restore policy information is added to the above metadata, and the restore policy information includes a restore time. For example, if the restore time is every day, it means that when the VM is started, the electronic device performs a restore operation when the VM is started for the first time in a day; for example, if the restore time is every time, it means that the electronic device performs a restore operation every time the VM is started.
[0093] At the same time, in addition to the restoration time, the above-mentioned restoration policy information also includes the object to be restored. For example, if the object to be restored is the system disk, it means that when the VM is started, the electronic device only needs to restore the system disk in the VM; for another example, if the object to be restored is the data disk and the system disk in the VM, it means that when the VM is started, the electronic device performs the restoration operation on both the data disk and the system disk in the VM.
[0094] In a possible implementation, when generating the above restoration policy information, firstly, the restoration time corresponding to the target VM and the object to be restored in the target VM are obtained; and then the restoration policy information is generated according to the restoration time and the object to be restored.
[0095] Through the above method, the restore policy information is generated according to the restore time and the object to be restored corresponding to the acquired target VM. Based on the restore policy information, it is further ensured that the restore operation is delayed to the GuestOS stage, avoiding the limitation that UEFI does not have a writable advanced file system driver, thereby further ensuring that the electronic device can perform the restore operation; and, based on the restore time in the restore policy information, data can be provided for the restore identifier in the startup information to support the restore identifier to indicate whether to restore; at the same time, based on the object to be restored in the restore policy information, the electronic device can clearly identify the object of the restore operation when performing the restore operation.
[0096] In addition, in order for the electronic device to perform the restore operation, it is also necessary to determine the restore point, that is, it is necessary to restore the object to be restored to a certain historical operating state. In the embodiment of the present application, the restore point can be determined by an external snapshot or an internal snapshot.
[0097] Specifically, files in each virtual disk in the VM can be snapshotted based on an external snapshot or internal snapshot mechanism to retain the snapshot point, that is, to retain the restore point, and the restore point can also be found through metadata or files in the virtual disk so that the electronic device can perform a restore operation based on the restore point.
[0098] For example, a snapshot is taken of file a in the data disk in the VM based on an external snapshot mechanism, a differential file b is created for file a, and the moment when differential file b is created for file a is used as restore point S1; then file a becomes a read-only file; all data generated when the VM is run thereafter is saved in differential file b, so that the electronic device can restore the VM to the state corresponding to file a based on restore point S1.
[0099] Furthermore, in order for the electronic device to be able to clearly identify the restore location of the object to be restored, that is, in order for the electronic device to be able to clearly identify the restore point, relevant descriptions of the restore point can also be added to the metadata. For example, the snapshot device takes three snapshots of the VM, and the snapshot points of the three snapshots are A, B, and C, respectively. That is, the restore points can be A, B, and C, and then the restore point set can be {A, B, C}. That is, the electronic device can restore the object to be restored to A or B or C, and at the same time set the default restore point to A in the metadata.
[0100] Furthermore, after completing the deployment of the relevant information of the VM, the electronic device enters the UEFI stage.
[0101] In the UEFI stage, it mainly includes a UEFI launcher. In an embodiment of the present application, the UEFI launcher is mainly used to start the UEFI program set developed by the VM in the embodiment of the present application. The UEFI launcher includes a bootmgr directly started by the UEFI Boot option, that is, the UEFI program set includes a bootmgr directly started by the UEFI Boot option.
[0102] In a possible implementation, the above bootmgr mainly has the following functions:
[0103] 1) VM image selection and startup information generation function;
[0104] 2) Start the information analysis function;
[0105] 3) Load UEFI advanced file system, virtual disk and other driver functions;
[0106] 4) Mount the system disk file in the target VM in read-only mode according to the startup information, and start the Loader function in the system disk.
[0107] Before the electronic device generates startup information through bootmgr, it is also necessary to determine whether startup information currently exists. If startup information exists, the startup information is directly parsed through bootmgr and subsequent steps are executed; if startup information does not exist, the startup information is generated through bootmgr.
[0108] In a possible implementation, when the electronic device generates startup information through bootmgr in the UEFI stage, it first obtains a metadata file path corresponding to a target VM to be started; and then generates startup information according to the restore identifier and the metadata file path.
[0109] It should be noted here that when the electronic device generates startup information in the maintenance system, the startup information is also generated according to the restoration identifier and the metadata file path.
[0110] Through the above method, the startup information is generated according to the restore identifier and the metadata file path, so that the electronic device can determine whether to perform the restore operation according to the restore identifier in the startup information, further ensuring that the restore operation is delayed to the GuestOS stage, avoiding the limitation that UEFI does not have a writable advanced file system driver, thereby further ensuring that the electronic device can perform the restore operation; and the restore identifier is saved in the startup information, and the content in the restore identifier can be dynamically adjusted, so that the restore identifier is modified in real time each time the VM is started; in addition, according to the metadata file path, the metadata in the metadata file can be read, and the metadata is the entry for accessing the persistent data in the target VM, which contains various key information of the target VM, so that the target VM to be started can be determined according to the metadata file path, so that when there are multiple VMs, the electronic device can determine the VM to be operated.
[0111] Furthermore, before generating the startup information according to the restore identifier and the metadata file path, a restore instruction generated based on a user operation or a restore instruction generated based on restore policy information is first received; and then the restore identifier is updated according to the restore instruction.
[0112] When the restore instruction is generated based on the restore policy information, the restore instruction is related to the restore time in the restore policy information. For example, if the restore time is every time, it means that the electronic device performs a restore operation every time the VM is started. At this time, every time the restore instruction is generated, the restore instruction indicates that the restore flag is TRUE. Further, when the default value of the restore flag is FALSE, FALSE is updated to TRUE according to the restore instruction.
[0113] In the above manner, the restore flag can be updated according to the restore instruction generated by the user operation, so that it can be determined based on the user selection whether the target VM is started to perform the restore operation. The restore instruction can also be automatically generated according to the restore policy information, and the restore flag can be updated based on the restore instruction, so that the electronic device can determine whether the target VM is started to perform the restore action. Then, the startup information can be generated based on the restore flag.
[0114] Furthermore, in order for the electronic device to further clarify the restore location of the object to be restored, the target restore point is also determined in the startup information. Specifically, an instruction indicating the target restore point is first received; then based on the instruction, the initial restore point is modified to the target restore point in the startup information.
[0115] It is worth noting that the initial restore point is the default restore point set in the metadata.
[0116] For example, the restore point set in the metadata is {A, B, C}, and the default restore point in the metadata is A. When the VM is started to generate startup information, the electronic device receives an instruction from the user through bootmgr, which indicates that the target restore point is B, thereby updating the initial restore point in the startup information from A to B through bootmgr.
[0117] Through the above method, based on the received instruction indicating the target restore point, the initial restore point is updated to the target restore point in the startup information, so that the target restore point can be determined through the startup information, so that the electronic device can clearly know the data in the object to be restored to; and, by setting the target restore point in the startup information, the specific target restore point can be dynamically adjusted, so that the target restore point can be modified in real time each time the VM is started.
[0118] In addition, it should be noted that when the electronic device generates the startup information, the restore flag in the startup information for the following special scenarios is FALSE, that is, the electronic device does not perform the restore operation. The special scenarios are:
[0119] 1) Restart the VM without enabling the restore function;
[0120] 2) Pause the restore function during image editing;
[0121] 3) The periodic restoration strategy only performs the restoration action once after the period times out (the period is recalculated after the execution is completed).
[0122] Taking restart as an example, when an electronic device performs a restart operation, the specific operations are as follows:
[0123] First, obtain the restore time in the restore policy information or the new restore instruction generated based on the user operation; then generate a new restore identifier according to the restore time or the new restore instruction; then generate new startup information according to the new restore identifier and the obtained new metadata file path, and save the new startup information to a designated storage area that is readable, writable and persistent. The new metadata file path corresponds to the target VM to be started; finally, execute the restart operation of the target VM according to the new startup information.
[0124] It should be noted here that when generating new startup information in a restart scenario, the electronic device generates the new startup information through a driver in the GuestOS or a program in the GuestOS.
[0125] Through the above method, a new restore identifier is generated according to the restore time in the restore policy information or the new restore instruction of the user operation; and new startup information is generated according to the new restore identifier and the new metadata file path; thereby, the electronic device can clearly identify the VM to be started according to the new metadata file path in the new startup information, and then the electronic device can execute the restart operation of the target VM; and the electronic device can also clearly identify whether the restore operation needs to be performed according to the new restore identifier in the new startup information.
[0126] In addition, in the embodiment of the present application, in the above-mentioned special scenario 2), when executing the image editing process, the image editing can be performed based on the remote management platform.
[0127] Furthermore, after generating the startup information and clarifying the target VM to be started, the electronic device determines through bootmgr whether the system disk needs to perform a restore operation.
[0128] Specifically, if the object to be restored in the restore policy information includes a system disk, and the restore identifier indicates restoration, the metadata file is determined according to the metadata file path, and then according to the system disk path in the metadata in the metadata file, the system disk is mounted as a UEFI-recognizable disk through the advanced file system driver in UEFI, that is, the system disk is mounted, and mounting the system disk is essentially mounting a differential file of the restore point location, and the differential file is a differential file about the system disk.
[0129] For example, refer to Figure 2 As shown in the snapshot diagram, the current latest state of the system disk is the writable state. The differential file corresponding to the writable state is the latest differential file, and snapshot 2 corresponds to the second latest differential file. Snapshot 1 is equivalent to the base file. If the restore flag indicates restoration, the system disk needs to be restored to snapshot 2. Therefore, the second latest differential file is mounted, that is, the differential file corresponding to snapshot 2 is mounted; if the restore flag indicates not to restore, the latest differential file is mounted, that is, the differential file corresponding to the writable state is mounted.
[0130] After the electronic device mounts the system disk, the Loader in the system disk is started, and the GuestOS is initialized by the Loader, thereby indicating that the GuestOS stage has been entered, and then the electronic device reads the startup information.
[0131] Next, in the GuestOS stage, after reading the startup information, the electronic device determines whether to execute step S2 or step S3 according to the specific indication content of the restoration identifier in the startup information.
[0132] Specifically, if the restoration flag indicates restoration, step S2 is executed;
[0133] If the restoration flag indicates not to restore, step S3 is executed.
[0134] S2, restore the data in the object to be restored to the data corresponding to the target restore point according to the restoration policy information corresponding to the target virtual machine, and mount each virtual disk in the target virtual machine as a disk recognizable by the GuestOS.
[0135] Specifically, the electronic device first determines the object to be restored according to the restoration policy information corresponding to the target VM, and determines the target restore point according to the startup information, and then restores the data in the object to be restored to the data corresponding to the target restore point based on the writable advanced file system driver in the GuestOS, thereby completing the restoration operation; after completing the restoration operation, each virtual disk in the target VM is mounted as a disk recognizable by the GuestOS.
[0136] In a possible implementation, after mounting each virtual disk in the target VM as a disk recognizable by the GuestOS, the electronic device creates a differential file at the restored location, so that when the target VM is running, the data in the change information generated by the target VM is saved to the created differential file. For example, when the VM is running, an excel sheet about personal information is generated in file b, and the excel sheet is saved to the created differential file; the excel sheet is the data in the change information.
[0137] In addition, the new path in the change information is updated to the metadata file or the created temporary file, where the new path is the path corresponding to the file in the target VM after the path has changed. For example, if the path of file a in the target VM changes from "user / c / us / a.doc" to "user / c / df / a.doc", the path of file a in the metadata is updated from "user / c / us / a.doc" to "user / c / df / a.doc", or the new path of file a "user / c / df / a.doc" is stored in the created temporary file; the new path "user / c / df / a.doc" is the new path in the change information.
[0138] It is worth noting that when the new path after the file path in the target VM is changed is updated to the metadata or the created temporary file, in addition to updating the changed path to the metadata or saving it to the temporary file, the newly generated restore point information and the latest differential file can also be updated to the metadata or saved to the temporary file. The latest differential file represents the outermost virtual disk file in the VM after the VM is started this time.
[0139] If the file path in the target VM has not changed, there is no new path in the change information. The file path in the target VM can be the path of the system disk in the target VM, the path of the data disk in the target VM, or the path of the Loader in the target VM. In the embodiment of the present application, the file path in the target VM is not limited to the specific file path included.
[0140] By means of the above method, the change information generated when the target virtual machine is running is saved, so that after the target virtual machine is started next time to perform a restore operation, the change information generated when the target virtual machine is running last time cannot be restored.
[0141] In one possible implementation, after updating the created temporary file with the new path corresponding to the file in the target VM after the path has changed, the historical temporary files are deleted from the temporary file list according to the temporary file deletion policy. The temporary file list contains the name of each temporary file and the path of each temporary file. The temporary file is used to save the change information.
[0142] The above-mentioned temporary file deletion strategy can be that once the electronic device finds the existence of a historical temporary file, it deletes the historical temporary file; it can also be that it receives an instruction from the user containing an instruction to delete a specified historical temporary file and deletes the specified historical temporary file. In the embodiment of the present application, the temporary file deletion strategy can be adjusted according to the specific application scenario.
[0143] In the above manner, based on the temporary file deletion policy, the historical temporary files in the temporary file list are deleted, thereby reducing the capacity of the disk.
[0144] Furthermore, after the electronic device mounts each virtual disk in the target VM as a disk recognizable by the GuestOS, the remaining steps in starting the VM are continued.
[0145] However, since the remaining steps in starting the VM are common methods in the prior art, the remaining steps in the VM are not explained in the embodiments of the present application.
[0146] S3, mount each virtual disk in the target virtual machine as a disk that can be recognized by GuestOS.
[0147] If the restore flag in the startup information indicates not to restore, the restore operation is not performed, and the electronic device directly mounts each virtual disk in the target VM as a disk recognizable by the GuestOS.
[0148] Furthermore, after mounting each virtual disk in the target VM as a disk recognizable by the GuestOS, the electronic device continues to execute the remaining steps in starting the VM, consistent with step S2.
[0149] Similarly, since the remaining steps in starting the VM are common methods in the prior art, the remaining steps in the VM are not explained in the embodiments of the present application.
[0150] In summary, the virtual machine restoration method proposed in the present application reads the startup information from the specified storage area in response to starting the GuestOS in the target VM; if the restore identifier in the startup information indicates restoration, the data in the object to be restored is restored to the data corresponding to the target restore point according to the restore policy information corresponding to the target VM, and each virtual disk in the target VM is mounted as a disk recognizable by the GuestOS.
[0151] Through this method, the restore operation of the VM is configured to the GuestOS stage based on the restore identifier and the restore policy information. Since there is a writable advanced file system driver in the GuestOS, the object to be restored can be restored to the target restore point according to the restore policy information based on the writable advanced file system driver in the GuestOS stage. Therefore, it is avoided to implement a complete writable advanced file system driver in the UEFI stage, and it is avoided that when the writable advanced file system driver is run in the UEFI stage, serious consequences such as data loss caused by the defects of the writable advanced file system driver itself are caused.
[0152] In addition, by adding a restore identifier and metadata file path in the startup information, and generating restore policy information containing the restore time and the object to be restored, it is further ensured that the restore operation is delayed to the GuestOS stage, avoiding the limitation of UEFI that there is no writable advanced file system driver, thereby further ensuring that the electronic device can perform the restore operation.
[0153] In addition, by saving the restore identifier in the startup information, the content in the restore identifier can be dynamically adjusted, so that the restore identifier can be modified in real time each time the VM is started; the target VM to be started can be determined based on the metadata file path in the startup information, so that when there are multiple VMs, the electronic device can determine the VM to be operated; based on the object to be restored in the restore policy information, the electronic device can clearly identify the object of the restore operation when performing the restore operation.
[0154] The technical solution of this application is further explained below in conjunction with a specific application process.
[0155] like Figure 3The figure shows a processing diagram of a method for restoring a virtual machine. First, in the deployment phase, the electronic device deploys the relevant information of the VM, including completing the partition formatting of the native hard disk, installing and configuring the UEFI booter, configuring the virtual machine list, deploying the virtual disk file, the metadata file, etc. through the maintenance system. The metadata in the metadata file includes the restoration policy information, and the restoration policy information includes the restoration time and the object to be restored.
[0156] Then, in the UEFI stage, first in the boot information judgment module, the electronic device determines whether there is currently boot information through bootmgr. If there is no boot information, then in the generation module, the user instruction is received to generate boot information, and the above boot information includes a restore flag, a metadata file path, and a target restore point. The above restore flag is used to indicate whether to restore, and the metadata file path is used to read the metadata file, so that the target VM to be started can be determined according to the metadata in the metadata file; if there is boot information, the boot information is directly parsed in the parsing module to determine the target VM to be started;
[0157] After the startup information is generated by the generation module or parsed by the parsing module, in the first mounting module, the restore policy information in the metadata is read. If the object to be restored in the restore policy information includes the system disk, the system disk path in the metadata is read, and then according to the system disk path and the restore identifier in the startup information, the system disk in the target VM is mounted as a disk recognizable by UEFI;
[0158] Secondly, start the Loader in the above system disk, which means entering the GuestOS stage;
[0159] In the GuestOS stage, the electronic device reads the startup information generated in the generation module, and then inputs the restoration identifier in the startup information into the restoration judgment module;
[0160] In the restore judgment module, if the received restore identifier indicates restoration, then in the restore operation module, the restore policy information and the target restore point in the metadata are read to obtain the object to be restored in the restore policy information, and then based on the writable advanced file system driver existing in the GuestOS, the data in the object to be restored is restored to the data corresponding to the target restore point, and then in the second mounting module, each virtual disk in the target VM is mounted as a disk recognizable by the GuestOS;
[0161] In the restoration judgment module, if the received restoration identifier indicates not to perform restoration, then in the second mounting module, each virtual disk in the target VM is directly mounted as a disk recognizable by the GuestOS.
[0162] Through the above method, based on the restore judgment module in the GuestOS stage, it is determined whether the restore identifier in the startup information indicates restoration or not; if the restore identifier indicates restoration, then in the restore operation module, the data in the object to be restored is restored to the data corresponding to the target restore point according to the restore policy information in the metadata, and then the virtual disk is mounted in the second mounting module. Thus, based on the restore identifier and the restore policy information, the restore operation of the VM is configured to the GuestOS stage. Because there is a writable advanced file system driver in the GuestOS, the data in the object to be restored can be restored to the data corresponding to the target restore point according to the restore policy information based on the writable advanced file system driver in the GuestOS stage, so that a complete writable advanced file system driver is avoided in the UEFI stage, and serious consequences such as data loss caused by the defects of the writable advanced file system driver itself when the writable advanced file system driver is run in the UEFI stage are avoided.
[0163] In addition, by adding a restore identifier and a metadata file path to the startup information when generating the startup information in the generation module, and adding restore policy information including the restore time and the object to be restored to the metadata when generating the metadata, it is further ensured that the restore operation is delayed to the GuestOS stage, avoiding the limitation that UEFI does not have a writable advanced file system driver, thereby further ensuring that the electronic device can perform the restore operation.
[0164] In addition, by saving the restore identifier in the startup information, the content in the restore identifier can be dynamically adjusted, so that the restore identifier can be modified in real time each time the VM is started; the target VM to be started can be determined based on the metadata file path in the startup information, so that when there are multiple VMs, the electronic device can determine the VM to be operated; based on the object to be restored in the restore policy information, the electronic device can clearly identify the object of the restore operation when performing the restore operation.
[0165] Based on the same inventive concept, the present application also provides a virtual machine restoration device, such as Figure 4 The figure is a schematic diagram of the structure of a virtual machine restoration device provided by the present application, the device comprising:
[0166] The reading module 401 is used to read the startup information from the specified storage area in response to starting the guest operating system GuestOS in the target virtual machine, where the startup information includes a restore flag, and the restore flag is used to indicate whether to restore the data in the object to be restored to the data corresponding to the target restore point;
[0167] Processing module 402 is used to restore the data in the object to be restored to the data corresponding to the target restore point according to the restoration policy information corresponding to the target virtual machine if the restoration identifier indicates restoration, and mount each virtual disk in the target virtual machine as a disk recognizable by GuestOS, wherein the restoration policy information indicates the object to be restored.
[0168] In a possible implementation, the reading module 401 is specifically configured to generate startup information in a unified extensible firmware interface UEFI stage or in a maintenance system, and save the startup information to a designated storage area.
[0169] In a possible implementation, the reading module 401 is specifically used to obtain a metadata file path, where the metadata file path corresponds to a target virtual machine to be started;
[0170] Generate startup information based on the restore identifier and metadata file path.
[0171] In a possible implementation, the reading module 401 is specifically configured to receive a restore instruction generated based on a user operation or a restore instruction generated based on restore policy information;
[0172] Update the restore flag according to the restore instruction.
[0173] In a possible implementation, the reading module 401 is specifically configured to obtain the restoration time corresponding to the target virtual machine and the object to be restored in the target virtual machine;
[0174] Generate restoration policy information based on the restoration time and the object to be restored.
[0175] In a possible implementation, the reading module 401 is specifically configured to receive an instruction indicating a target restore point;
[0176] Based on the instruction, in the startup information, the initial restore point is modified to the target restore point.
[0177] In a possible implementation, the processing module 402 is specifically configured to mount each virtual disk in the target virtual machine as a disk recognizable by the GuestOS if the restoration flag indicates not to perform restoration.
[0178] In a possible implementation, the processing module 402 is specifically configured to save data in the change information generated by the target virtual machine to the created differential file when the target virtual machine is running;
[0179] The new path in the change information is updated to the metadata file corresponding to the metadata file path or the created temporary file, wherein the new path is the path after the path corresponding to the file in the target virtual machine is changed.
[0180] In a possible implementation, the processing module 402 is specifically configured to obtain the restoration time in the restoration policy information or receive a new restoration instruction generated based on a user operation;
[0181] Generate a new restore identifier according to the restore time or new restore instruction;
[0182] Generate new startup information according to the new restore identifier and the obtained new metadata file path, and save the new startup information to a designated storage area that is readable, writable and persistent, wherein the new metadata file path corresponds to the target virtual machine to be started;
[0183] The target virtual machine is restarted according to the new startup information.
[0184] Based on the same inventive concept, an electronic device is also provided in the embodiment of the present application. The electronic device can realize the function of the virtual machine restoration device. Figure 5 , the electronic equipment includes:
[0185] At least one processor 501, and a memory 502 connected to the at least one processor 501. The specific connection medium between the processor 501 and the memory 502 is not limited in the embodiment of the present application. Figure 5 In the example, the processor 501 and the memory 502 are connected via a bus 500. The bus 500 is Figure 5 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 500 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 501 can also be called a controller, and there is no limitation on the name.
[0186] In the embodiment of the present application, the memory 502 stores instructions that can be executed by at least one processor 501. The at least one processor 501 can execute the virtual machine restoration method discussed above by executing the instructions stored in the memory 502. The processor 501 can implement Figure 4 The functions of each module in the device shown.
[0187] Among them, the processor 501 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 502 and calling data stored in the memory 502, the various functions of the device and processing data, the device can be monitored as a whole.
[0188] In one possible design, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 501. In some embodiments, the processor 501 and the memory 502 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.
[0189] Processor 501 can be a general-purpose processor, such as a CPU, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the virtual machine restoration method disclosed in the embodiments of the present application can be directly embodied as a hardware processor execution, or a combination of hardware and software modules in the processor.
[0190] The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 502 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (English: Random Access Memory, abbreviated as RAM), a static random access memory (English: Static Random Access Memory, abbreviated as SRAM), a programmable read-only memory (English: Programmable Read Only Memory, abbreviated as PROM), a read-only memory (English: Read Only Memory, abbreviated as ROM), an electrically erasable programmable read-only memory (English: Electrically Erasable Programmable Read-Only Memory, abbreviated as EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 502 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0191] By programming the processor 501, the code corresponding to the virtual machine restoration method described in the above embodiment can be fixed into the chip, so that the chip can execute the code when running. Figure 1 The steps of the virtual machine restoration method in the illustrated embodiment are as follows: How to design and program the processor 501 is a technique known to those skilled in the art and will not be described in detail here.
[0192] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the virtual machine restoration method discussed above.
[0193] In some possible implementations, various aspects of the virtual machine restoration method provided in the present application can also be implemented in the form of a program product, which includes a program code. When the program product is run on an apparatus, the program code is used to enable the control device to execute the steps of the virtual machine restoration method according to various exemplary embodiments of the present application described above in this specification.
[0194] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0195] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0196] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0197] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0198] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for restoring a virtual machine, characterized in that: The method comprises: In response to starting the guest operating system GuestOS in the target virtual machine, reading the startup information from the designated storage area, the startup information including a restore flag, the restore flag being used to indicate whether to restore the data in the object to be restored to the data corresponding to the target restore point; If the restore identifier indicates restoration, the data in the object to be restored is restored to the data corresponding to the target restore point according to the restoration policy information corresponding to the target virtual machine, and each virtual disk in the target virtual machine is mounted as a disk recognizable by the GuestOS, wherein the restoration policy information indicates the object to be restored.
2. The method according to claim 1, characterized in that Before reading the startup information from the designated storage area, the method further includes: In the Unified Extensible Firmware Interface (UEFI) stage or in the maintenance system, the startup information is generated and saved in the designated storage area.
3. The method according to claim 2, characterized in that The generating the startup information comprises: Obtain a metadata file path, where the metadata file path corresponds to the target virtual machine to be started; The startup information is generated according to the restoration identifier and the metadata file path.
4. The method according to claim 3, characterized in that Before generating the startup information according to the restoration identifier and the metadata file path, the method further includes: Receiving a restore instruction generated based on a user operation or a restore instruction generated based on the restore policy information; According to the restoration instruction, the restoration flag is updated.
5. The method according to claim 1, characterized in that Before reading the startup information from the designated storage area, the method further includes: Obtaining the restoration time corresponding to the target virtual machine and the object to be restored in the target virtual machine; The restoration policy information is generated according to the restoration time and the object to be restored.
6. The method according to claim 1, characterized in that Before reading the startup information from the designated storage area, the method further includes: receiving an instruction indicating the target restore point; Based on the instruction, in the startup information, the initial restore point is modified to the target restore point.
7. The method according to claim 1, characterized in that After reading the startup information from the designated storage area, the method further includes: If the restore flag indicates not to restore, each virtual disk in the target virtual machine is mounted as a disk recognizable by the GuestOS.
8. The method according to claim 1 or 7, characterized in that After mounting each virtual disk in the target virtual machine as a disk recognizable by the GuestOS, the method further includes: When the target virtual machine is running, saving data in the change information generated by the target virtual machine to the created differential file; The new path in the change information is updated to the metadata file corresponding to the metadata file path or the created temporary file, wherein the new path is the path after the path corresponding to the file in the target virtual machine has changed.
9. The method according to claim 1 or 7, characterized in that: The startup information is stored in the designated storage area which is readable and persistent. After mounting each virtual disk in the target virtual machine as a disk recognizable by the GuestOS, the method further includes: Obtaining the restoration time in the restoration policy information or receiving a new restoration instruction generated based on a user operation; Generate a new restoration identifier according to the restoration time or the new restoration instruction; Generate new startup information according to the new restore identifier and the acquired new metadata file path, and save the new startup information to the designated storage area that is readable, writable and persistent, wherein the new metadata file path corresponds to the target virtual machine to be started; According to the new startup information, a restart operation of the target virtual machine is performed.
10. A virtual machine restoration device, characterized in that: The device comprises: A reading module, configured to read startup information from a specified storage area in response to starting a guest operating system GuestOS in a target virtual machine, wherein the startup information includes a restore flag, and the restore flag is used to indicate whether to restore data in the object to be restored to data corresponding to a target restore point; A processing module is used to restore the data in the object to be restored to the data corresponding to the target restore point according to the restoration policy information corresponding to the target virtual machine if the restoration identifier indicates restoration, and to mount each virtual disk in the target virtual machine as a disk recognizable by the GuestOS, wherein the restoration policy information indicates the object to be restored.
11. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method steps of any one of claims 1 to 9 when executing a computer program stored in the memory.
12. 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 method steps described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Automatic reduction method for virtual machine
CN103207817A
System and method for consumption based tagging of resources
CN111352696A
Virtual machine migration method and device, computing equipment and storage medium
CN115390996A
Presenting virtual machine backup files for block and file level restore
US10114705B1
Method and apparatus for scheduling computing resource
WO2018040845A1