Virtual machine exception recovery method and device, electronic equipment and readable storage medium

By performing consistency checksum integrity checks and integrity checks on the underlying actual configuration and upper configuration records of the virtual machine, abnormal virtual machines are identified and restored, the problem of virtual machine data loss in the virtualization platform is solved and the security of virtual machine data is achieved recover.

CN119127558APending Publication Date: 2024-12-13JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411345656.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In virtualization platforms, virtual machines may cause data loss in abnormal scenarios such as network disconnection and power outage, and it is difficult for the existing technology to effectively detect and restore virtual machine data.

Method used

By determining the underlying actual configuration and upper configuration records of the virtual machine to be tested, consistency checksum integrity checks, identify abnormal virtual machines, and use preset exception recovery rules for automatic recovery to ensure the integrity of virtual machine data and consistency.

Benefits of technology

It effectively avoids the loss of virtual machine data, realizes abnormal detection and recovery of virtual machines in the virtualization platform, and ensures the accuracy and completeness of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127558A_ABST
    Figure CN119127558A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual machine exception recovery method and device, electronic equipment and a readable storage medium, and the method comprises the steps: determining a to-be-tested virtual machine and a target disk corresponding to the to-be-tested virtual machine, and obtaining bottom layer actual configuration and upper layer configuration records of the to-be-tested virtual machine; performing consistency verification on the bottom-layer actual configuration record and the upper-layer configuration record, and performing integrity verification on disk data in the target disk; when the consistency verification is not passed and / or the integrity verification is not passed, determining that the to-be-tested virtual machine is an abnormal virtual machine; determining an abnormal item of the abnormal virtual machine and item abnormal information corresponding to the abnormal item; and determining an exception recovery rule corresponding to the abnormal item, and performing exception recovery on the abnormal item by using the exception recovery rule and the item exception information so as to realize exception recovery of the abnormal virtual machine. By applying the technical scheme provided by the invention, anomaly detection and anomaly recovery can be carried out on the virtual machine in the virtualization platform, and the problem of data loss of the virtual machine is effectively avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtualization technology, and in particular to a method for recovering a virtual machine from an abnormality, and also to a device for recovering a virtual machine from an abnormality, an electronic device, and a computer-readable storage medium. Background Art

[0002] For virtualization platform users, especially enterprise users, virtual machines may contain a large amount of sensitive data and key business applications. The loss or leakage of this data may cause huge losses to the enterprise or organization. When operating a large number of virtual machines, users of virtualization platforms will inevitably delete virtual machines by mistake due to human negligence. At this time, the usual way to deal with it is not to delete the virtual machine directly, but to put the virtual machine into the recycle bin. When the accidental deletion is found, the virtual machine can be retrieved through the virtual machine recycle bin, thus avoiding the loss of important business data.

[0003] However, when the virtual machine itself is performing various functional operations, if it encounters abnormal scenarios such as network disconnection and power outage, it may also cause the loss of virtual machine data. For example, when migrating a virtual machine across storage, if the management network of the virtualization platform and the management network of the host where the virtual machine is located are disconnected during the migration process, the underlying virtual machine is normally migrated to the target storage and reads and writes data normally. After running for a period of time, the host loses power. The task can no longer determine whether the data disk that the virtual machine normally reads and writes is in the source storage pool or the target storage pool. The upper-level virtualization task fails. At this time, the virtual disk data of the target storage pool is rolled back, which is likely to cause disk data loss.

[0004] Therefore, how to perform abnormality detection and abnormality recovery on virtual machines in a virtualization platform to avoid the loss of virtual machine data is an urgent problem to be solved by those skilled in the art. Summary of the invention

[0005] The purpose of the present application is to provide a virtual machine abnormal recovery method, which can perform abnormal detection and abnormal recovery on virtual machines in a virtualization platform, effectively avoiding the problem of virtual machine data loss; another purpose of the present application is to provide a virtual machine abnormal recovery device, electronic device, computer-readable storage medium and computer program product, all of which have the above-mentioned beneficial effects.

[0006] In a first aspect, the present application provides a method for recovering a virtual machine from an abnormality, comprising:

[0007] Determine the virtual machine to be tested and the target disk corresponding to the virtual machine to be tested, and obtain the underlying actual configuration and upper layer configuration records of the virtual machine to be tested;

[0008] Performing consistency check on the bottom layer actual configuration and the upper layer configuration record, and performing integrity check on the disk data in the target disk;

[0009] When the consistency check fails and / or the integrity check fails, determining that the virtual machine to be tested is an abnormal virtual machine;

[0010] Determine the abnormal project of the abnormal virtual machine and the project abnormality information corresponding to the abnormal project;

[0011] An abnormal recovery rule corresponding to the abnormal project is determined, and the abnormal recovery rule and the project abnormal information are used to perform abnormal recovery on the abnormal project, so as to achieve abnormal recovery of the abnormal virtual machine.

[0012] Optionally, performing consistency check on the bottom layer actual configuration and the upper layer configuration record includes:

[0013] Obtaining the underlying actual original configuration and the upper layer configuration original record of the virtual machine to be tested before executing the target business operation, and performing consistency verification on the underlying actual original configuration and the upper layer configuration original record;

[0014] Obtaining the actual current configuration of the bottom layer and the current record of the upper layer configuration of the virtual machine to be tested after executing the target business operation, and performing consistency check on the actual current configuration of the bottom layer and the current record of the upper layer configuration;

[0015] Obtaining the underlying change configuration of the virtual machine to be tested after executing the target business operation and the business execution record corresponding to the target business operation, and performing consistency check on the underlying change configuration and the business execution record;

[0016] When the consistency check between the bottom layer actual original configuration and the upper layer configuration original record passes, and the consistency check between the bottom layer actual current configuration and the upper layer configuration current record passes, and the consistency check between the bottom layer change configuration and the business execution record passes, it is determined that the consistency check between the bottom layer actual configuration and the upper layer configuration record passes;

[0017] When the consistency check between the underlying actual original configuration and the upper-layer configuration original record fails, and / or the consistency check between the underlying actual current configuration and the upper-layer configuration current record fails, and / or the consistency check between the underlying change configuration and the business execution record fails, it is determined that the consistency check between the underlying actual configuration and the upper-layer configuration record fails.

[0018] Optionally, obtaining the underlying changed configuration of the virtual machine to be tested after executing the target business operation includes:

[0019] Exporting the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration by using the virtual machine management interface;

[0020] A comparison and analysis is performed on the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration to determine the underlying changed configuration of the virtual machine to be tested after executing the target business operation.

[0021] Optionally, when the disk format of the target disk is a preset format, the method further includes:

[0022] Determine a disk tree composed of the target disk and the snapshot disk corresponding to the target disk, and determine all disk snapshot chains in the disk tree;

[0023] A deep optimization traversal technique is used to perform consistency check on each of the disk snapshot chains.

[0024] Optionally, performing abnormal recovery on the abnormal project by using the abnormal recovery rule and the project abnormal information to achieve abnormal recovery of the abnormal virtual machine includes:

[0025] If the basic disk information in the service execution record is inconsistent with the basic disk information in the actual current configuration of the bottom layer, but is consistent with the basic disk information in the current record of the upper layer configuration, then synchronizing the actual current configuration of the bottom layer using the service execution record;

[0026] If the basic disk information in the service execution record is inconsistent with the basic disk information in the upper layer configuration current record, but consistent with the basic disk information in the actual current configuration of the bottom layer, then the upper layer configuration current record is synchronized using the service execution record;

[0027] If the number of disks in the actual current configuration of the bottom layer is less than the number of disks in the current record of the upper layer configuration, hot adding disks to the virtual machine to be tested;

[0028] If the number of disks in the actual current configuration of the bottom layer is greater than the number of disks in the current record of the upper layer configuration, the current record of the upper layer configuration is synchronized using the actual current configuration of the bottom layer.

[0029] Optionally, performing integrity check on the disk data in the target disk includes:

[0030] Obtaining the current operation time of the target disk when the virtual machine to be tested is powered on and the historical operation time of the target disk when the virtual machine to be tested was last powered off, and performing consistency check on the current operation time and the historical operation time;

[0031] Obtaining a current disk bitmap of the target disk when the virtual machine to be tested is powered on and a historical disk bitmap of the target disk when the virtual machine to be tested was last powered off, and performing a consistency check on the current disk bitmap and the historical disk bitmap;

[0032] When the consistency check between the current operation time and the historical operation time passes, and the consistency check between the current disk bitmap and the historical disk bitmap passes, it is determined that the integrity check of the disk data passes;

[0033] When the consistency check between the current operation time and the historical operation time fails, and / or the consistency check between the current disk bitmap and the historical disk bitmap fails, it is determined that the integrity check of the disk data fails.

[0034] Optionally, performing abnormal recovery on the abnormal project by using the abnormal recovery rule and the project abnormal information to achieve abnormal recovery of the abnormal virtual machine includes:

[0035] When it is determined that the integrity check of the disk data fails, recovering the data of the target disk using the historical disk bitmap to obtain the recovered disk data;

[0036] Merging the restored disk data of each target disk to obtain merged disk data;

[0037] The virtual machine to be tested is restored using the merged disk data.

[0038] In a second aspect, the present application also discloses a virtual machine abnormality recovery device, comprising:

[0039] An acquisition module is used to determine the virtual machine to be tested and the target disk corresponding to the virtual machine to be tested, and to obtain the underlying actual configuration and upper layer configuration records of the virtual machine to be tested;

[0040] A verification module, used to perform consistency verification on the bottom layer actual configuration and the upper layer configuration record, and to perform integrity verification on the disk data in the target disk;

[0041] A determination module, configured to determine that the virtual machine to be tested is an abnormal virtual machine when the consistency check fails and / or the integrity check fails;

[0042] A determination module, used to determine the abnormal project of the abnormal virtual machine and the project abnormality information corresponding to the abnormal project;

[0043] The recovery module is used to determine the abnormal recovery rule corresponding to the abnormal project, and perform abnormal recovery on the abnormal project by using the abnormal recovery rule and the project abnormal information, so as to realize abnormal recovery of the abnormal virtual machine.

[0044] In a third aspect, the present application further discloses an electronic device, comprising:

[0045] Memory for storing computer programs;

[0046] A processor is used to implement the steps of any one of the above-mentioned virtual machine abnormality recovery methods when executing the computer program.

[0047] In a fourth aspect, the present application further discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the virtual machine abnormality recovery methods described above are implemented.

[0048] In a fifth aspect, the present invention further discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of any one of the virtual machine abnormality recovery methods described above.

[0049] The present application provides a method for abnormal recovery of a virtual machine, comprising: determining a virtual machine to be tested and a target disk corresponding to the virtual machine to be tested, and obtaining the underlying actual configuration and upper-layer configuration records of the virtual machine to be tested; performing consistency check on the underlying actual configuration and the upper-layer configuration records, and performing integrity check on the disk data in the target disk; when the consistency check fails and / or the integrity check fails, determining that the virtual machine to be tested is an abnormal virtual machine; determining abnormal items of the abnormal virtual machine and item abnormal information corresponding to the abnormal items; determining abnormal recovery rules corresponding to the abnormal items, and performing abnormal recovery on the abnormal items using the abnormal recovery rules and the item abnormal information, so as to achieve abnormal recovery of the abnormal virtual machine.

[0050] By applying the technical solution provided by the present application, for any virtual machine to be tested in the virtualization platform, the consistency check of the virtual machine configuration and the integrity check of the disk used by the virtual machine can be respectively performed to determine whether the virtual machine to be tested has an abnormality, wherein the consistency check of the virtual machine configuration can be achieved by comparing the underlying actual configuration of the virtual machine to be tested with the upper-layer configuration records, and the integrity check of the disk used by the virtual machine refers to checking the integrity of the disk data in the disk used by the virtual machine; on this basis, different abnormal recovery rules are pre-set for different types of abnormal items, so as to realize the automatic recovery of abnormal items in abnormal virtual machines. It can be seen that the present technical solution can perform abnormal detection and abnormal recovery on virtual machines in the virtualization platform, effectively avoiding the problem of virtual machine data loss.

[0051] In one embodiment of the present application, when performing a disk data integrity check on a target disk used by a virtual machine to be tested, the disk operation time and disk bitmap at the current startup are compared and analyzed with the disk operation time and disk bitmap at the most recent shutdown. If the disk operation time and / or disk bitmap are inconsistent, it means that other operations have been performed on the target disk during the shutdown of the virtual machine to be tested, and it can be determined that the integrity of the disk data in the target disk has been destroyed. Conversely, if the disk operation time and disk bitmap are consistent, it can be considered that the integrity of the disk data in the target disk has not been destroyed. As a result, a relatively accurate integrity check is achieved on the disk data in the target disk, which helps to achieve more accurate virtual machine anomaly detection and recovery.

[0052] The virtual machine abnormality recovery device, electronic device, computer-readable storage medium and computer program product provided in this application also have the above-mentioned technical effects, and this application will not repeat them here. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.

[0054] Figure 1 A flowchart of a method for recovering a virtual machine from an abnormality provided by the present application;

[0055] Figure 2 A schematic diagram of the structure of a disk tree provided for this application;

[0056] Figure 3 A schematic diagram of another disk tree structure provided for this application;

[0057] Figure 4 A schematic diagram of the structure of a virtual machine abnormality recovery device provided in this application;

[0058] Figure 5 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0059] The core of the present application is to provide a virtual machine abnormal recovery method, which can perform abnormal detection and abnormal recovery on virtual machines in a virtualization platform, effectively avoiding the problem of virtual machine data loss; another core of the present application is to provide a virtual machine abnormal recovery device, electronic device, computer-readable storage medium and computer program product, all of which have the above-mentioned beneficial effects.

[0060] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 making creative work are within the scope of protection of this application.

[0061] An embodiment of the present application provides a method for recovering from a virtual machine abnormality.

[0062] Please refer to Figure 1 , Figure 1 This is a flow chart of a virtual machine abnormality recovery method provided in the present application. The virtual machine abnormality recovery method may include the following S101 to S105.

[0063] S101: Determine a virtual machine to be tested and a target disk corresponding to the virtual machine to be tested, and obtain the underlying actual configuration and upper layer configuration records of the virtual machine to be tested.

[0064] This step aims to determine the virtual machine to be tested and its target disk, as well as obtain the relevant configuration information of the virtual machine to be tested. The virtual machine to be tested is the virtual machine on the virtualization platform that needs to be detected and recovered for anomalies; the target disk corresponding to the virtual machine to be tested is the disk file used by the virtual machine to be tested, which may include one or more disk files; the relevant configuration information of the virtual machine to be tested may include the underlying actual configuration and the upper-layer configuration record, wherein the underlying actual configuration is the current real configuration information of the virtual machine to be tested, and the upper-layer configuration record is the configuration information actually recorded by the virtual machine to be tested in the upper-layer file, and the combination of the two is used to achieve consistency verification of the basic configuration of the virtual machine to be tested.

[0065] S102: Perform consistency check on the bottom layer actual configuration and the upper layer configuration record, and perform integrity check on the disk data in the target disk.

[0066] This step is intended to achieve consistency verification of the basic configuration of the virtual machine to be tested and integrity verification of the disk data in the target disk corresponding to the virtual machine to be tested. It can be understood that when the underlying actual configuration of the virtual machine to be tested is the same as the upper configuration record, it can be determined that the consistency verification of the basic configuration of the virtual machine to be tested has passed, otherwise it is considered that the consistency verification of the basic configuration of the virtual machine to be tested has not passed; the integrity verification of the disk data in the target disk corresponding to the virtual machine to be tested is performed, that is, the integrity of the disk data is verified. If the disk data is intact and not damaged, it can be considered that the integrity verification of the disk data in the target disk has passed, otherwise it is considered that the integrity verification of the disk data in the target disk has not passed.

[0067] S103: When the consistency check fails and / or the integrity check fails, determining that the virtual machine to be tested is an abnormal virtual machine.

[0068] This step is intended to detect anomalies of the virtual machine under test based on the consistency check and integrity check in S102. Obviously, when both the consistency check and the integrity check pass, the virtual machine under test can be determined to be a normal virtual machine, and when the consistency check and / or the integrity check fail, the virtual machine under test can be determined to be an abnormal virtual machine.

[0069] S104: Determine the abnormal project of the abnormal virtual machine and the project abnormality information corresponding to the abnormal project.

[0070] This step is intended to achieve the determination of abnormal items and their abnormal information in abnormal virtual machines. Specifically, through the consistency check and integrity check in S102, the detection items that failed the check, i.e., abnormal items, can be determined. For example, during the consistency check process, it may be detected that some basic configurations of virtual machines are inconsistent, such as inconsistent disk information and network card information, etc. During the integrity check process, it may be detected that the disk data in the target disk is incomplete, etc. Based on this, the abnormal information of the abnormal items can be further obtained, and the abnormal information of the items can be used as reference information for abnormal recovery to achieve abnormal recovery of abnormal virtual machines.

[0071] S105: Determine an abnormal recovery rule corresponding to the abnormal project, and perform abnormal recovery on the abnormal project using the abnormal recovery rule and the project abnormal information, so as to achieve abnormal recovery of the abnormal virtual machine.

[0072] This step aims to realize abnormal recovery of abnormal virtual machines. Specifically, for different abnormal items in abnormal virtual machines, corresponding abnormal recovery rules can be created in advance. Therefore, after determining the abnormal items in the abnormal virtual machines, the abnormal items can be abnormally recovered by using the corresponding abnormal recovery rules combined with the abnormal information of the items, thereby realizing the automatic recovery of abnormal virtual machines. Among them, each abnormal recovery rule can be pre-stored in the corresponding storage space and can be directly queried when used.

[0073] It can be seen that the virtual machine abnormality recovery method provided in the embodiment of the present application can perform a consistency check of the virtual machine configuration and an integrity check of the disk used by the virtual machine for any virtual machine to be tested in the virtualization platform, so as to determine whether the virtual machine to be tested has an abnormality, wherein the consistency check of the virtual machine configuration can be achieved by comparing the underlying actual configuration of the virtual machine to be tested with the upper-layer configuration record, and the integrity check of the disk used by the virtual machine refers to checking the integrity of the disk data in the disk used by the virtual machine; on this basis, different abnormality recovery rules are pre-set for different types of abnormal items, so as to realize the automatic recovery of abnormal items in abnormal virtual machines. It can be seen that the technical solution can perform abnormality detection and abnormality recovery on virtual machines in the virtualization platform, effectively avoiding the problem of virtual machine data loss.

[0074] Based on the above embodiments:

[0075] In one embodiment of the present application, performing consistency check on the bottom layer actual configuration and the upper layer configuration record may include:

[0076] Obtaining the underlying actual original configuration and the upper layer configuration original record of the virtual machine under test before executing the target business operation, and performing consistency verification on the underlying actual original configuration and the upper layer configuration original record;

[0077] Obtaining the actual current configuration of the bottom layer and the current record of the upper layer configuration of the virtual machine to be tested after executing the target business operation, and performing consistency verification on the actual current configuration of the bottom layer and the current record of the upper layer configuration;

[0078] Obtaining the underlying change configuration of the virtual machine under test after executing the target business operation and the business execution record corresponding to the target business operation, and performing consistency check on the underlying change configuration and the business execution record;

[0079] When the consistency check between the bottom layer actual original configuration and the upper layer configuration original record passes, and the consistency check between the bottom layer actual current configuration and the upper layer configuration current record passes, and the consistency check between the bottom layer changed configuration and the business execution record passes, it is determined that the consistency check between the bottom layer actual configuration and the upper layer configuration record passes;

[0080] When the consistency check between the underlying actual original configuration and the upper-layer configuration original record fails, and / or the consistency check between the underlying actual current configuration and the upper-layer configuration current record fails, and / or the consistency check between the underlying change configuration and the business execution record fails, it is determined that the consistency check between the underlying actual configuration and the upper-layer configuration record fails.

[0081] The embodiment of the present application provides a method for implementing consistency verification of the basic configuration of the virtual machine to be tested. Specifically, the consistency verification of the basic configuration of the virtual machine to be tested may include three aspects, the first is the consistency of the basic configuration before the virtual machine to be tested performs the target business operation, the second is the consistency of the basic configuration after the virtual machine to be tested performs the target business operation, and the third is the consistency of the basic configuration changes generated by the virtual machine to be tested performing the target business operation. The first two can directly compare the actual configuration of the virtual machine to be tested with the upper-layer record, and the latter requires the actual changes in the basic configuration of the virtual machine to be tested (i.e., the above-mentioned underlying change configuration) and the configuration change information recorded in real time in the database (i.e., the above-mentioned business execution record) to be compared. It can be imagined that when all three checks are passed, it can be considered that the consistency verification of the basic configuration of the virtual machine to be tested has passed, and when all three checks are not passed, it can be considered that the consistency verification of the basic configuration of the virtual machine to be tested has not passed.

[0082] It should be noted that the specific content of the target business operation does not affect the implementation of this technical solution. It can be set by technical personnel according to actual needs, or it can be determined by the current actual business. This application does not limit this.

[0083] Among them, obtaining the underlying changed configuration of the virtual machine under test after executing the target business operation can include: using the virtual machine management interface to export the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration; comparing and analyzing the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration to determine the underlying changed configuration of the virtual machine under test after executing the target business operation.

[0084] It is conceivable that the actual changes in the basic configuration of the virtual machine to be tested can be obtained by comparing the underlying actual configuration of the virtual machine to be tested before and after executing the target business operation. Specifically, an XML file of the underlying actual original configuration of the virtual machine to be tested before executing the target business operation and an XML file of the underlying actual current configuration of the virtual machine to be tested after executing the target business operation can be exported respectively. By comparing the two XML files, the underlying changed configuration caused by the virtual machine to be tested executing the target business operation can be obtained. Among them, the XML file can be exported through the virtual machine management interface. In a possible implementation, the virtual machine management interface can be Libvirt (an open source application program interface for managing virtualization platforms).

[0085] In one embodiment of the present application, when the disk format of the target disk is a preset format, the virtual machine abnormality recovery method may further include:

[0086] Determine a disk tree composed of a target disk and a snapshot disk corresponding to the target disk, and determine all disk snapshot chains in the disk tree;

[0087] Use deep optimization traversal technology to perform consistency check on each disk snapshot chain.

[0088] In the embodiment of the present application, for a target disk in a preset format (such as QCOW2 format), in addition to the above consistency checks on the three aspects, a consistency check can be further performed on each disk snapshot chain in the corresponding disk tree. The consistency check on the disk snapshot chain can be implemented using a deep optimization traversal technique.

[0089] In one embodiment of the present application, abnormal recovery of abnormal projects using abnormal recovery rules and project abnormal information to achieve abnormal recovery of abnormal virtual machines may include:

[0090] If the basic disk information in the business execution record is inconsistent with the basic disk information in the actual current configuration of the bottom layer, but consistent with the basic disk information in the current record of the upper layer configuration, the business execution record is used to synchronize the actual current configuration of the bottom layer;

[0091] If the basic disk information in the business execution record is inconsistent with the basic disk information in the current record of the upper-layer configuration, but consistent with the basic disk information in the actual current configuration of the bottom layer, the business execution record is used to synchronize the current record of the upper-layer configuration;

[0092] If the number of disks in the actual current configuration of the bottom layer is less than the number of disks in the current record of the upper layer configuration, hot-add disks to the virtual machine to be tested;

[0093] If the number of disks in the actual current configuration of the bottom layer is greater than the number of disks in the current record of the upper layer configuration, the current record of the upper layer configuration is synchronized using the actual current configuration of the bottom layer.

[0094] The embodiment of the present application provides an abnormal recovery method when the consistency check of the basic configuration of the virtual machine to be tested fails. In the embodiment of the present application, the inconsistency of the basic configuration of the virtual machine to be tested mainly includes the inconsistency of the basic information of the disk and the inconsistency of the number of disks. Of course, no matter which inconsistency, the items that need to be synchronized (the actual configuration of the bottom layer or the configuration record of the upper layer) can be determined based on the actual comparison results. It should be noted that the above-mentioned inconsistency of the basic information of the disk and the inconsistency of the number of disks are only one implementation form provided by the embodiment of the present application. There may also be other inconsistencies in the basic configuration, such as inconsistent network card information, inconsistent memory information, etc., and corresponding abnormal recovery rules can be preset to achieve abnormal recovery.

[0095] In one embodiment of the present application, abnormal recovery of abnormal projects using abnormal recovery rules and project abnormal information to achieve abnormal recovery of abnormal virtual machines may include:

[0096] If the network card information in the bottom layer actual configuration is inconsistent with the network card information in the upper layer configuration record, the upper layer configuration record is synchronized using the bottom layer actual configuration;

[0097] If the number of snapshots in the disk snapshot chain in the bottom-level actual configuration is less than the number of snapshots in the corresponding disk snapshot chain in the upper-level configuration record, hot-adding a disk to the virtual machine to be tested;

[0098] If the number of snapshots of the disk snapshot chain in the underlying actual configuration is greater than the number of snapshots of the corresponding disk snapshot chain in the upper configuration record, the upper configuration record is synchronized using the underlying actual configuration.

[0099] In an embodiment of the present application, the inconsistency of the basic configuration of the virtual machine to be tested may also include inconsistency of the network card and inconsistency of the disk snapshot chain. Similarly, no matter which inconsistency occurs, the items that need to be synchronized (the actual configuration of the bottom layer or the configuration record of the upper layer) can be determined based on the actual comparison results.

[0100] The disk used when hot-adding a disk to the virtual machine under test can be a disk file retrieved from the recycle bin. On this basis, when the virtual machine under test is in the process of business operation, if it involves deleting a disk file, the disk file can be set to be moved to the recycle bin, and when it is moved to the recycle bin, the recovery time of the disk file, the virtual machine to which it belongs, the disk ID, the disk format, the disk bitmap, the disk size and other information can also be recorded to facilitate the subsequent abnormal recovery of the virtual machine.

[0101] In one embodiment of the present application, performing integrity check on disk data in the target disk may include:

[0102] Obtain the current operation time of the target disk when the virtual machine to be tested is turned on and the historical operation time of the target disk when the virtual machine to be tested was last shut down, and perform consistency check on the current operation time and the historical operation time;

[0103] Obtaining a current disk bitmap of the target disk when the virtual machine to be tested is powered on and a historical disk bitmap of the target disk when the virtual machine to be tested was last powered off, and performing consistency check on the current disk bitmap and the historical disk bitmap;

[0104] When the consistency check between the current operation time and the historical operation time passes, and the consistency check between the current disk bitmap and the historical disk bitmap passes, it is determined that the integrity check of the disk data passes;

[0105] When the consistency check between the current operation time and the historical operation time fails, and / or the consistency check between the current disk bitmap and the historical disk bitmap fails, it is determined that the integrity check of the disk data fails.

[0106] The embodiment of the present application provides a method for implementing disk data integrity check on a target disk corresponding to a virtual machine to be tested. Specifically, the integrity check of the disk data in the target disk may include two aspects, one is the operation time of the target disk at adjacent power-on and power-off moments (including but not limited to the last access time, the last modification time, the metadata modification time, etc.), and the other is the disk bitmap of the target disk at adjacent power-on and power-off moments. It can be imagined that when both checks are passed, it can be considered that the integrity check of the disk data in the target disk has passed, and when both checks are not fully passed, it can be considered that the integrity check of the disk data in the target disk has not passed.

[0107] It can be seen that in the embodiment of the present application, when the integrity check of the disk data of the target disk used by the virtual machine to be tested is performed, the disk operation time and disk bitmap at the current startup are compared and analyzed with the disk operation time and disk bitmap at the most recent shutdown. If the disk operation time and / or disk bit are inconsistent, it means that other operations have been performed on the target disk during the shutdown of the virtual machine to be tested, and it can be determined that the integrity of the disk data in the target disk has been destroyed. Conversely, if the disk operation time and disk bit are consistent, it can be considered that the integrity of the disk data in the target disk has not been destroyed. As a result, a relatively accurate integrity check of the disk data in the target disk is achieved, which helps to achieve more accurate virtual machine abnormality detection and recovery.

[0108] In one embodiment of the present application, abnormal recovery of abnormal projects using abnormal recovery rules and project abnormal information to achieve abnormal recovery of abnormal virtual machines may include:

[0109] When it is determined that the integrity check of the disk data fails, the target disk is restored using the historical disk bitmap to obtain the restored disk data;

[0110] Merging the recovered disk data of each target disk to obtain merged disk data;

[0111] Use the merged disk data to restore the virtual machine under test.

[0112] The embodiment of the present application provides an abnormal recovery method when the integrity check of the disk data in the target disk corresponding to the virtual machine to be tested fails. As described above, when the integrity check of the disk data in the target disk fails, it means that the target disk has been modified during the shutdown of the virtual machine to be tested. Based on this, the historical disk bitmap of the most recent shutdown time of the virtual machine to be tested can be used to recover the data of the target disk, and when there are multiple target disks, the recovered disk data of all target disks can also be integrated to achieve the recovery of the virtual machine to be tested.

[0113] Based on the above embodiments, an embodiment of the present application provides another method for recovering from virtual machine abnormality.

[0114] In an embodiment of the present application, the virtualization platform includes a data detection module, a disk recovery module, a monitoring alarm and cleaning module, and a disk recovery module, wherein the data detection module is mainly used to detect the consistency between the upper-level record configuration of the virtualization platform and the actual configuration used by the virtual machine and the integrity of the disk data; the disk recovery module is used to put the disk corresponding to the virtual machine into the recycle bin, and record the association between the disk and the virtual machine for disk recovery; the monitoring alarm module is mainly used to generate an alarm message when it detects that the basic configuration of the virtual machine is inconsistent or the disk integrity is damaged; when the alarm message is generated, the recovery module can perform abnormal recovery of the virtual machine according to different alarm methods; the cleaning module is used to clean up useless recycle bin data, abnormal alarms and virtual disks.

[0115] Based on the functional modules in the virtualization platform, the implementation process of the virtual machine abnormal recovery method provided in the embodiment of the present application is as follows:

[0116] 1. The data detection module is mainly used to detect the consistency between the upper-level record configuration of the virtualization platform and the actual configuration used by the virtual machine and the integrity of the disk data.

[0117] 1. Check the consistency between the upper-layer recorded configuration of the virtualization platform and the actual configuration used by the virtual machine.

[0118] The virtual machine configuration items that need to be detected include:

[0119] Basic configuration of the virtual machine: running host, machine type, startup boot method, clock strategy, etc.;

[0120] CPU: number of cores, number of sockets, CPU mode, CPU reservation, CPU binding, etc.

[0121] Memory: size, memory bubble, memory reservation, huge page memory, etc.

[0122] Disk: storage location, size, quantity, allocation strategy, format, interface, read / write mode, etc.;

[0123] Network card: network, ip, mac, type, etc.;

[0124] Other host devices, GPU, USB, FPGA, etc.

[0125] (1) Before the virtual machine performs business operations, the complete configuration of the underlying running virtual machine is exported through libvirt and recorded in XML format as the original configuration of the virtual machine. At this time, the configuration recorded in the database is compared with the original XML configuration to determine whether the virtual machine configuration is consistent before the business operation;

[0126] (2) Execute business operations on the virtual machine. After the business operations are completed, export the XML current configuration of the virtual machine. After the following comparison, confirm whether the virtual machine configuration meets expectations:

[0127] ① Compare the original XML configuration of the virtual machine with the current XML configuration to obtain the change information of this business operation;

[0128] ② During the execution of business operations, the change information recorded in the virtual machine database should be consistent with the actual updated information of the virtual machine. The change information of the virtual machine in ① is compared with the change information recorded in the virtual machine database to determine the consistency between the two;

[0129] ③Since the virtual machine configuration may be modified successfully but not actually take effect, it can also be compared with the actual usage information of the virtual machine. By querying the virtual machine process or using the qemu command, the actual usage configuration of the virtual machine can be queried and compared with the current XML configuration or database records to further confirm the consistency of the virtual machine platform record and the underlying actual configuration after the business operation.

[0130] The virtual machine XML configuration only saves the disk currently used by the virtual machine. When the virtual machine uses RAW or VMDK format, only the XML configuration is compared; when the virtual machine uses qcow2 format, the consistency of the virtual machine disk chain can be further checked. For example, please refer to Figure 2 , Figure 2 A schematic diagram of the structure of a disk tree provided in this application. Figure 2 S0-S7 are snapshots of the virtual machine disk, forming a snapshot disk tree. Since there is an association between snapshot disks, the data disk currently used by the virtual machine depends on S7, and S7 is the backing file (read-only file) of the current data disk. Figure 2 The snapshot disk tree shown has four disk chains:

[0131] S1→S0;

[0132] S4→S3→S2→S0;

[0133] S6→S5→S0;

[0134] Data disk → S7 → S5 → S0;

[0135] Specifically, you can traverse the disk chain in a depth-first manner to detect the consistency of the backing file.

[0136] 2. Check the integrity of the virtual machine disk data.

[0137] To prevent a third party from tampering with disk data, the integrity of the virtual machine disk data should be checked when the virtual machine is powered on:

[0138] (1) When the virtual machine ends its process, such as shutting down or pausing, the operation time of the virtual machine's disk data is recorded, including the atime, ctime, and mtime of each disk. Atime is the last access time of the disk data, mtime is the last modification time of the disk data, and ctime is the change time of the disk data metadata. When the virtual machine is restored, such as starting up or restoring, the above time is also checked. If the atime, ctime, and mtime of the disk data change, it means that other processes have operated on the virtual machine's disk data when the virtual machine is not working, and the integrity of the disk data is destroyed.

[0139] (2) When the virtual machine is turned on, the current disk bitmap is generated and loaded into the virtual machine memory. Each time the virtual machine disk is read and written, the current disk bitmap information is updated; when the virtual machine is shut down, the disk bitmap is persisted to the storage, and the data change information of the virtual machine disk and the metadata information of the virtual machine are recorded. When the virtual machine is turned on next time, the disk bitmap generated by the virtual machine is compared to determine the integrity of the virtual machine disk information. Among them, the recorded data change information of the virtual machine disk and the recorded metadata information of the virtual machine can be used as the basis for virtual machine backup to back up the virtual machine.

[0140] It should be noted that the above two types of detection can be immediate detection or periodic detection.

[0141] 2. The disk recovery module is used to put the disk corresponding to the virtual machine into the recycle bin and record the association between the disk and the virtual machine for disk recovery.

[0142] When the business operation of a virtual machine involves disk deletion, the original disk information should not be deleted immediately without confirmation and detection module judging the consistency of the virtual machine configuration and the integrity of the virtual machine disk data. Instead, the disk to be deleted should be temporarily placed in the recycle bin.

[0143] When the disk is moved to the recycle bin, the disk's recycling time, the virtual machine to which it belongs, the disk uuid, the disk interface, the disk format, the disk size, the disk bitmap and other information can be recorded at the same time; in addition, since the disk may be in qcow2 format, a chain relationship may be established with other disks during copy-on-write. Therefore, when the disk is moved to the recycle bin, the disk chain associated with the disk should also be recorded.

[0144] 3. The monitoring alarm module is mainly used to generate alarm information when it detects that the basic configuration of the virtual machine is inconsistent or the disk integrity is damaged. According to the detection results, the alarm information can be divided into the following categories:

[0145] 1. Inconsistent basic configuration of virtual machines: The configuration information of the virtual machines, such as the total number of CPUs, number of slots, memory, and CPU mode, is inconsistent.

[0146] 2. Inconsistent disk information: Inconsistent disk configuration information, such as the interface type, disk size, disk format, disk queue, etc. of the virtual machine disk; inconsistent number of disks, such as the virtual machine actually uses 3 disks, but the actual virtualization platform records 4 disks; inconsistent disk paths, that is, the disk path actually used by the virtual machine does not match the recorded disk path; inconsistent disk chain relationships, such as the number of snapshot chains or the snapshot chain disks.

[0147] 3. Inconsistent network card configuration: Inconsistent basic network card configuration, such as network card type, number of queues, MAC, connection status, etc.; inconsistent number of network cards; inconsistent IP configuration, such as inconsistent network card IP, gateway, and mask.

[0148] 4. Incomplete data: The disk information is accessed abnormally, and the disk data may be leaked; the disk data is inconsistent, and the disk may be written abnormally, resulting in incomplete data.

[0149] 5. Virtual machine split brain: The virtual machine disk lock is not effective, resulting in multiple instances of the virtual machine.

[0150] 4. When an alarm message is generated, the recovery module can perform abnormal recovery on the virtual machine according to different alarm methods.

[0151] 1. Inconsistent basic configuration of virtual machines: When the basic configuration information of virtual machines is inconsistent, since many configuration attributes of virtual machines cannot be edited online, the actual running status of the virtual machine shall prevail. When the disk alarm information is detected, the actual configuration information of the virtual machine can be queried and synchronized to the upper layer of the platform. At the same time, the task event is notified to the user, informing which configuration information has been adjusted, so that the user can make adjustments according to the actual situation. In addition, if the final configuration of the virtual machine after adjustment does not meet the user's expectations, the user can adjust the virtual machine configuration according to the task event to meet the requirements.

[0152] 2. Disk information is inconsistent:

[0153] (1) Inconsistency in basic disk information: When the basic disk information is inconsistent, the operation log of the virtual machine can be retrieved. If the operation log of the virtual machine is the same as the upper-level record of the virtual machine, but different from the actual configuration of the virtual machine, the actual configuration of the virtual machine should be synchronized so that the actual configuration of the virtual machine meets customer expectations. At this time, the virtual machine disk can be dynamically copied through blockcopy (which can copy the contents of the source disk image to the target disk image while the virtual machine continues to run) so that the actual configuration of the virtual machine can be modified without shutting down the virtual machine; if the operation log of the virtual machine is the same as the actual configuration of the virtual machine, the upper-level record of the virtualization platform is synchronized.

[0154] (2) Inconsistent number of disks: There may be two situations: one is that the disk used by the underlying virtual machine is not recorded in the upper layer of the virtualization platform; the other is that the disk recorded in the upper layer is not used by the underlying virtual machine.

[0155] ① The situation where the bottom layer does not have the upper layer: If the virtual machine has a disk loss due to an IO error, or the hot-add disk fails, you can hot-add the corresponding disk for the virtual machine. Specifically, you can use the virtual machine to restore the initial configuration. When hot-adding, first find the corresponding disk in the storage pool according to the upper-layer record of the platform and add it. If the corresponding disk is not found in the storage pool, you can find the corresponding disk in the recycle bin, confirm and add it to the virtual machine for use. If the corresponding disk cannot be found, it means that the disk has been deleted, then delete the upper-layer record on the flat head; if the virtual machine hot-deletes the disk, the bottom layer is deleted successfully, and the upper-layer record is not deleted, then the upper-layer record should be deleted.

[0156] ② The situation where the underlying layer has data but the upper layer does not: If the virtual machine disk is being used, the disk cannot be deleted without user confirmation, otherwise data loss may occur. In this scenario, you can add a disk for the virtual machine. First, determine whether there is a disk used by the virtual machine on the storage pool. If the corresponding disk cannot be found, the underlying disk may have been deleted but is being used by the virtual machine process. At this time, the virtual machine disk status is deleted. In order to avoid virtual machine data loss, use blockcopy to copy the disk data to the real data file, and then synchronize the disk information to the upper layer record; if the specific disk information can be queried, directly add the corresponding disk data to the upper layer record of the platform.

[0157] ③ Snapshot disk chain inconsistency: When it is detected that the disk snapshot chain pointing to the disk is inconsistent, if there are more actual chains at the bottom layer and fewer record chains at the upper layer, the extra chain data at the bottom layer will be merged into the parent disk and the disk pointing will be updated, such as Figure 3 As shown, Figure 3A structural diagram of another disk tree provided for this application. Assuming that there are multiple s3s at the bottom layer, the data of s3 should be merged into s2, and then s2 should be pointed to s4, and then s3 should be deleted to maintain the consistency of disk data; if the platform has multiple record chains, the corresponding disk can be found in the disk recycle bin, and the chain relationship can be re-established for the virtual machine.

[0158] 3. Inconsistent network card information: To avoid affecting the virtual machine network, all configurations are based on the actual configuration of the virtual machine. When an inconsistent network card alarm is found, the actual configuration of the underlying layer is synchronized to the upper layer record.

[0159] 4. Incomplete virtual machine data: According to the detection results of the detection module, if the virtual machine disk is accessed abnormally, no operation is required, and the alarm module can generate a corresponding alarm reminder; if the virtual machine disk data is inconsistent, the complete data of the virtual machine can be determined based on the virtual machine's disk bitmap to restore the virtual machine; when multiple disks have valid data, multiple disk data can be merged, and the virtual machine can be paused at this time to wait for manual intervention.

[0160] 5. Multiple instances of virtual machines: Due to some exceptions, multiple processes may use the virtual machine configuration at the same time. At this time, user services are unavailable. You can combine the disk atime, ctime, mtime and the disk bitmap of the virtual machine to determine the latest data of the virtual machine, and kill the redundant virtual machine processes so that the virtual machine can continue to work.

[0161] 5. The cleanup module is used to clean up useless recycle bin data, abnormal alarms and virtual disks.

[0162] When the abnormal recovery module completes the recovery of the virtual machine, or when the detection module detects that the upper and lower layers of the virtual machine are consistent, the virtual machine related alarms can be eliminated and the associated virtual machine disk information can be cleared.

[0163] Based on the above implementation process, the following uses migration as an example to illustrate the abnormality detection and repair process of the virtual machine:

[0164] Assume that the disk configuration of the virtual machine before migration is as follows, where the disk format is raw, the disk read / write mode is none, the disk interface is ide, the storage pool where the virtual machine is located is storage1, and the storage pool mount directory is / datastore / storage1.

[0165] <disk type="file" device="disk">

[0166] <driver name="qemu" type="raw" cache="none" io="native" / >

[0167] <source file=" / datastore / storage1 / file_name" index="3">

[0168] <target dev="hda" bus="ide" / >

[0169] <alias name="ide0-0-0" / >

[0170] <address type="drive" controller="0" bus="0" target="0" unit="0">< / address>

[0171] < / disk>

[0172] The migration task migrates the virtual machine from storage1 to storage2, and the disk format is changed to qcow2. However, the management network is disconnected at this time, and the progress of the migration task cannot be queried. The upper-level task fails. At this time, the storage2 disk "file_name" on the target storage is moved to the recycle bin. After the network is restored, the XML configuration of the virtual machine is queried periodically as follows:

[0173] <disk type="file" device="disk">

[0174] <driver name="qemu" type="raw" cache="none" io="native" / >

[0175] <source file=" / datastore / storage2 / file_name" index="3">

[0176] ……

[0177] < / disk>

[0178] At this time, through comparison, it is found that the virtual machine disk has been migrated to the target storage pool, but the disk format has not been changed, and a virtual machine related alarm is generated.

[0179] To restore the configuration of the virtual machine, first remove the disk in the recycle bin and record it as the existing disk of the virtual machine, and move the disk of storage1 on the original storage pool to the recycle bin. Then, perform block copy on the virtual machine disk and convert the disk format to qcow2. Then, the configuration of the converted virtual machine is:

[0180] <disk type="file" device="disk">

[0181] <driver name="qemu" type="qcow2" cache="none" io="native" / >

[0182] ……

[0183] < / disk>

[0184] By comparison, it is found that the virtual machine configuration is in line with expectations. At this time, the disk information actually used by the virtual machine is queried as follows:

[0185] drive-ide0-0-0-3: / datastore / storage2 / file_name (qcow2)

[0186] Attached to:ide0-0-0

[0187] If consistency is achieved, the upper-layer records of the virtualization platform can be updated and the alarm can be eliminated.

[0188] During the next detection, if the upper and lower layer configurations of the virtual machine are consistent, the related disks of this recycle bin virtual machine can be cleared.

[0189] It can be seen that the virtual machine abnormality recovery method provided in the embodiment of the present application can perform a consistency check of the virtual machine configuration and an integrity check of the disk used by the virtual machine for any virtual machine to be tested in the virtualization platform, so as to determine whether the virtual machine to be tested has an abnormality, wherein the consistency check of the virtual machine configuration can be achieved by comparing the underlying actual configuration of the virtual machine to be tested with the upper-layer configuration record, and the integrity check of the disk used by the virtual machine refers to checking the integrity of the disk data in the disk used by the virtual machine; on this basis, different abnormality recovery rules are pre-set for different types of abnormal items, so as to realize the automatic recovery of abnormal items in abnormal virtual machines. It can be seen that the technical solution can perform abnormality detection and abnormality recovery on virtual machines in the virtualization platform, effectively avoiding the problem of virtual machine data loss.

[0190] An embodiment of the present application provides a device for recovering from virtual machine abnormality.

[0191] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the structure of a virtual machine abnormality recovery device provided in the present application, and the virtual machine abnormality recovery device may include:

[0192] Acquisition module 1, used to determine the virtual machine to be tested and the target disk corresponding to the virtual machine to be tested, and obtain the underlying actual configuration and upper layer configuration records of the virtual machine to be tested;

[0193] Verification module 2, used to perform consistency verification on the underlying actual configuration and the upper configuration record, and to perform integrity verification on the disk data in the target disk;

[0194] Determination module 3, used for determining that the virtual machine to be tested is an abnormal virtual machine when the consistency check fails and / or the integrity check fails;

[0195] Determination module 4, used to determine the abnormal project of the abnormal virtual machine and the project abnormality information corresponding to the abnormal project;

[0196] The recovery module 5 is used to determine the abnormal recovery rule corresponding to the abnormal project, and perform abnormal recovery on the abnormal project by using the abnormal recovery rule and the project abnormal information, so as to realize abnormal recovery of the abnormal virtual machine.

[0197] It can be seen that the virtual machine abnormality recovery device provided in the embodiment of the present application can perform consistency check of the virtual machine configuration and integrity check of the disk used by the virtual machine on any virtual machine to be tested in the virtualization platform, so as to determine whether the virtual machine to be tested has an abnormality, wherein the consistency check of the virtual machine configuration can be achieved by comparing the underlying actual configuration and the upper configuration record of the virtual machine to be tested, and the integrity check of the disk used by the virtual machine refers to checking the integrity of the disk data in the disk used by the virtual machine; on this basis, different abnormality recovery rules are pre-set for different types of abnormal items, so as to realize the automatic recovery of abnormal items in abnormal virtual machines. It can be seen that the technical solution can perform abnormality detection and abnormality recovery on virtual machines in the virtualization platform, effectively avoiding the problem of virtual machine data loss.

[0198] In one embodiment of the present application, the verification module 2 may include:

[0199] The first verification unit is used to obtain the underlying actual original configuration and the upper layer configuration original record of the virtual machine under test before executing the target business operation, and perform consistency verification on the underlying actual original configuration and the upper layer configuration original record;

[0200] The second verification unit is used to obtain the actual current configuration of the bottom layer and the current record of the upper layer configuration of the virtual machine to be tested after executing the target business operation, and perform consistency verification on the actual current configuration of the bottom layer and the current record of the upper layer configuration;

[0201] The third verification unit is used to obtain the underlying change configuration of the virtual machine under test after executing the target business operation and the business execution record corresponding to the target business operation, and perform consistency verification on the underlying change configuration and the business execution record;

[0202] A first determination unit is used to determine that the consistency check between the bottom layer actual original configuration and the upper layer configuration record passes when the consistency check between the bottom layer actual current configuration and the upper layer configuration current record passes, and the consistency check between the bottom layer change configuration and the business execution record passes;

[0203] The second determination unit is used to determine that the consistency check between the underlying actual configuration and the upper-layer configuration record has failed when the consistency check between the underlying actual original configuration and the upper-layer configuration original record has failed, and / or the consistency check between the underlying actual current configuration and the upper-layer configuration current record has failed, and / or the consistency check between the underlying change configuration and the business execution record has failed.

[0204] In one embodiment of the present application, the above-mentioned third verification unit can be specifically used to use the virtual machine management interface to export the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration; compare and analyze the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration to determine the underlying changed configuration of the virtual machine under test after executing the target business operation.

[0205] In one embodiment of the present application, when the disk format of the target disk is a preset format, the above-mentioned verification module 2 may also include a fourth verification unit, which is used to determine the disk tree composed of the target disk and the snapshot disk corresponding to the target disk, and determine all disk snapshot chains in the disk tree; use deep optimization traversal technology to perform consistency verification on each disk snapshot chain.

[0206] In one embodiment of the present application, the above-mentioned recovery module 5 can be specifically used to synchronize the underlying actual current configuration using the business execution record if the basic disk information in the business execution record is inconsistent with the basic disk information in the underlying actual current configuration, but is consistent with the basic disk information in the current record of the upper-layer configuration; if the basic disk information in the business execution record is inconsistent with the basic disk information in the current record of the upper-layer configuration, but is consistent with the basic disk information in the underlying actual current configuration, then synchronize the current record of the upper-layer configuration using the business execution record; if the number of disks in the underlying actual current configuration is less than the number of disks in the current record of the upper-layer configuration, hot-add disks to the virtual machine under test; if the number of disks in the underlying actual current configuration is more than the number of disks in the current record of the upper-layer configuration, then synchronize the current record of the upper-layer configuration using the underlying actual current configuration.

[0207] In one embodiment of the present application, the verification module 2 may include:

[0208] A fifth verification unit is used to obtain the current operation time of the target disk when the virtual machine to be tested is powered on and the historical operation time of the target disk when the virtual machine to be tested was last powered off, and to perform consistency verification on the current operation time and the historical operation time;

[0209] The sixth verification unit is used to obtain the current disk bitmap of the target disk when the virtual machine to be tested is powered on and the historical disk bitmap of the target disk when the virtual machine to be tested was last powered off, and perform consistency verification on the current disk bitmap and the historical disk bitmap;

[0210] A third determination unit, configured to determine that the integrity check of the disk data passes when the consistency check of the current operation time and the historical operation time passes, and the consistency check of the current disk bitmap and the historical disk bitmap passes;

[0211] The fourth determination unit is used to determine that the integrity check of the disk data has failed when the consistency check between the current operation time and the historical operation time has failed and / or the consistency check between the current disk bitmap and the historical disk bitmap has failed.

[0212] In one embodiment of the present application, the above-mentioned recovery module 5 can be specifically used to, when it is determined that the integrity check of the disk data has not passed, use the historical disk bitmap to recover the data of the target disk to obtain the restored disk data; merge the restored disk data of each target disk to obtain the merged disk data; and use the merged disk data to restore the virtual machine to be tested.

[0213] For an introduction to the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.

[0214] An embodiment of the present application provides an electronic device.

[0215] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided in this application, and the electronic device may include:

[0216] A memory 11, used for storing computer programs;

[0217] The processor 10 can implement the steps of any one of the above-mentioned virtual machine abnormality recovery methods when executing a computer program.

[0218] like Figure 5 , which is a schematic diagram of the composition structure of an electronic device, the electronic device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all communicate with each other through the communication bus 13.

[0219] In the embodiment of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.

[0220] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in an embodiment of the method for recovering from an abnormality of a virtual machine.

[0221] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 11 at least stores programs for implementing the following functions:

[0222] Determine the virtual machine to be tested and the target disk corresponding to the virtual machine to be tested, and obtain the underlying actual configuration and upper layer configuration records of the virtual machine to be tested;

[0223] Perform consistency check on the underlying actual configuration and upper-layer configuration records, and perform integrity check on the disk data in the target disk;

[0224] When the consistency check fails and / or the integrity check fails, determining that the virtual machine to be tested is an abnormal virtual machine;

[0225] Determine the abnormal project of the abnormal virtual machine and the project abnormality information corresponding to the abnormal project;

[0226] An abnormal recovery rule corresponding to the abnormal project is determined, and the abnormal recovery rule and the project abnormal information are used to perform abnormal recovery on the abnormal project to achieve abnormal recovery of the abnormal virtual machine.

[0227] In a possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.

[0228] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.

[0229] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.

[0230] Of course, it should be noted that Figure 5 The structure shown does not constitute a limitation on the electronic device in the embodiment of the present application. In actual applications, the electronic device may include Figure 5 More or fewer components than shown, or combinations of certain components.

[0231] An embodiment of the present application provides a computer-readable storage medium.

[0232] The computer-readable storage medium provided in the embodiment of the present application stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned virtual machine abnormality recovery methods can be implemented.

[0233] Among them, the computer-readable storage medium can be any available medium that can be stored in a computer or a data storage device such as a server or data center that includes one or more available media integrated. For example, it can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk) and other media that can store computer program codes.

[0234] For an introduction to the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.

[0235] An embodiment of the present application provides a computer program product.

[0236] The computer program product provided in the embodiment of the present application includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of any one of the above-mentioned virtual machine abnormality recovery methods can be implemented.

[0237] Specifically, in the above embodiments, all or part of them can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of them can be implemented in the form of a computer program product.

[0238] Among them, the computer program product may include one or more computer programs / instructions, and when the computer program / instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application may be generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line, etc.) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0239] For an introduction to the computer program product provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.

[0240] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0241] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may 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.

[0242] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0243] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.

Claims

1. A method for recovering a virtual machine from an abnormality, characterized in that: include: Determine the virtual machine to be tested and the target disk corresponding to the virtual machine to be tested, and obtain the underlying actual configuration and upper layer configuration records of the virtual machine to be tested; Performing consistency check on the bottom layer actual configuration and the upper layer configuration record, and performing integrity check on the disk data in the target disk; When the consistency check fails and / or the integrity check fails, determining that the virtual machine to be tested is an abnormal virtual machine; Determine the abnormal project of the abnormal virtual machine and the project abnormality information corresponding to the abnormal project; An abnormal recovery rule corresponding to the abnormal project is determined, and the abnormal recovery rule and the project abnormal information are used to perform abnormal recovery on the abnormal project, so as to achieve abnormal recovery of the abnormal virtual machine.

2. The method for recovering a virtual machine from an abnormality according to claim 1, characterized in that: Performing consistency check on the bottom layer actual configuration and the upper layer configuration record includes: Obtaining the underlying actual original configuration and the upper layer configuration original record of the virtual machine to be tested before executing the target business operation, and performing consistency verification on the underlying actual original configuration and the upper layer configuration original record; Obtaining the actual current configuration of the bottom layer and the current record of the upper layer configuration of the virtual machine to be tested after executing the target business operation, and performing consistency check on the actual current configuration of the bottom layer and the current record of the upper layer configuration; Obtaining the underlying change configuration of the virtual machine to be tested after executing the target business operation and the business execution record corresponding to the target business operation, and performing consistency check on the underlying change configuration and the business execution record; When the consistency check between the bottom layer actual original configuration and the upper layer configuration original record passes, and the consistency check between the bottom layer actual current configuration and the upper layer configuration current record passes, and the consistency check between the bottom layer change configuration and the business execution record passes, it is determined that the consistency check between the bottom layer actual configuration and the upper layer configuration record passes; When the consistency check between the underlying actual original configuration and the upper-layer configuration original record fails, and / or the consistency check between the underlying actual current configuration and the upper-layer configuration current record fails, and / or the consistency check between the underlying change configuration and the business execution record fails, it is determined that the consistency check between the underlying actual configuration and the upper-layer configuration record fails.

3. The method for recovering a virtual machine from an abnormality according to claim 2, characterized in that: Obtaining the underlying change configuration of the virtual machine to be tested after executing the target business operation includes: Exporting the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration by using the virtual machine management interface; A comparison and analysis is performed on the XML file of the underlying actual original configuration and the XML file of the underlying actual current configuration to determine the underlying changed configuration of the virtual machine to be tested after executing the target business operation.

4. The method for recovering a virtual machine from an abnormality according to claim 2, characterized in that: When the disk format of the target disk is a preset format, the method further includes: Determine a disk tree composed of the target disk and the snapshot disk corresponding to the target disk, and determine all disk snapshot chains in the disk tree; A deep optimization traversal technique is used to perform consistency check on each of the disk snapshot chains.

5. The method for recovering a virtual machine from an abnormality according to claim 4, characterized in that: Performing abnormal recovery on the abnormal project by using the abnormal recovery rule and the project abnormal information to achieve abnormal recovery of the abnormal virtual machine includes: If the basic disk information in the service execution record is inconsistent with the basic disk information in the actual current configuration of the bottom layer, but is consistent with the basic disk information in the current record of the upper layer configuration, then synchronizing the actual current configuration of the bottom layer using the service execution record; If the basic disk information in the service execution record is inconsistent with the basic disk information in the upper layer configuration current record, but consistent with the basic disk information in the actual current configuration of the bottom layer, then the upper layer configuration current record is synchronized using the service execution record; If the number of disks in the actual current configuration of the bottom layer is less than the number of disks in the current record of the upper layer configuration, hot adding disks to the virtual machine to be tested; If the number of disks in the actual current configuration of the bottom layer is greater than the number of disks in the current record of the upper layer configuration, the current record of the upper layer configuration is synchronized using the actual current configuration of the bottom layer.

6. The method for recovering a virtual machine from an abnormality according to claim 1, characterized in that: Performing integrity check on the disk data in the target disk, including: Obtaining the current operation time of the target disk when the virtual machine to be tested is powered on and the historical operation time of the target disk when the virtual machine to be tested was last powered off, and performing consistency check on the current operation time and the historical operation time; Obtaining a current disk bitmap of the target disk when the virtual machine to be tested is powered on and a historical disk bitmap of the target disk when the virtual machine to be tested was last powered off, and performing a consistency check on the current disk bitmap and the historical disk bitmap; When the consistency check between the current operation time and the historical operation time passes, and the consistency check between the current disk bitmap and the historical disk bitmap passes, it is determined that the integrity check of the disk data passes; When the consistency check between the current operation time and the historical operation time fails, and / or the consistency check between the current disk bitmap and the historical disk bitmap fails, it is determined that the integrity check of the disk data fails.

7. The method for recovering a virtual machine from an abnormality according to claim 6, characterized in that: Performing abnormal recovery on the abnormal project by using the abnormal recovery rule and the project abnormal information to achieve abnormal recovery of the abnormal virtual machine includes: When it is determined that the integrity check of the disk data fails, recovering the data of the target disk using the historical disk bitmap to obtain the recovered disk data; Merging the restored disk data of each target disk to obtain merged disk data; The virtual machine to be tested is restored using the merged disk data.

8. A virtual machine abnormality recovery device, characterized in that: include: An acquisition module is used to determine the virtual machine to be tested and the target disk corresponding to the virtual machine to be tested, and to obtain the underlying actual configuration and upper layer configuration records of the virtual machine to be tested; A verification module, used to perform consistency verification on the bottom layer actual configuration and the upper layer configuration record, and to perform integrity verification on the disk data in the target disk; A determination module, configured to determine that the virtual machine to be tested is an abnormal virtual machine when the consistency check fails and / or the integrity check fails; A determination module, used to determine the abnormal project of the abnormal virtual machine and the project abnormality information corresponding to the abnormal project; The recovery module is used to determine the abnormal recovery rule corresponding to the abnormal project, and perform abnormal recovery on the abnormal project by using the abnormal recovery rule and the project abnormal information, so as to realize abnormal recovery of the abnormal virtual machine.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the virtual machine abnormality recovery method according to any one of claims 1 to 7 when executing the computer program.

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 steps of the virtual machine abnormality recovery method according to any one of claims 1 to 7 are implemented.