Virtual disk processing method and device, equipment and storage medium

By saving the virtual disk in the recycling bin during the virtual machine migration process and deleting it after data consistency detection, the problem of virtual disk loss or error deletion is solved to ensure data security and business stability.

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

Patent Information

Application Number
CN202411237910.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

During the virtual machine migration process, power outage or network disconnection leads to loss or error deletion of virtual disks, resulting in inconsistent data of virtual machines, affecting data security and business continuity.

Method used

During the execution of the main task of the virtual machine, the target virtual disk that needs to be deleted is saved in the recycling bin, and after the main task is completed, the virtualization platform data and the underlying disk tree data are obtained to determine the data consistency. If it is inconsistent, restore the target virtual disk from the Recycle Bin and use the underlying disk tree data to update the virtualization platform data; when the data is consistent, the virtual disk in the Recycle Bin will be deleted.

Benefits of technology

Prevent virtual disk data from being deleted by mistake, ensure data security, enhance the data security and integrity of the virtualization platform, and ensure business continuity and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088316A_ABST
    Figure CN119088316A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data management, and discloses a virtual disk processing method, device and equipment and a storage medium, the method comprises the following steps: in a main task execution process of a virtual machine, storing a target virtual disk needing to be deleted in a recycle bin; after the main task is finished, acquiring virtualization platform data and bottom disk tree data, and judging whether data values are consistent or not; under the condition that the virtualization platform data is inconsistent with the underlying disk tree data, recovering the target virtual disk from the recycle bin, and updating the virtualization platform data by utilizing the underlying disk tree data; and under the condition that the virtualization platform data is consistent with the underlying disk tree data, deleting the target virtual disk in the recycle bin. The virtual disk data can be prevented from being mistakenly deleted, and the data security is protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a virtual disk processing method, device, equipment and storage medium. Background Art

[0002] The related operations of the virtualization platform will involve some operations on the disk. Under normal circumstances, the modification, addition, and deletion of the disk will proceed normally, and the disk data of the upper and lower layers of the virtual machine will be consistent. However, problems will arise in abnormal scenarios, such as: when migrating a virtual machine, the virtual machine has multiple disks, and the migration process is to migrate from the source storage pool to the destination storage pool, serial migration, and continue to migrate the next disk after the migration is completed. When a disk is in the middle of the migration, if the host is disconnected from the network or the power is cut off, the migration task will be terminated. The rollback operation requires the deletion of the destination disk. The current operation is to directly delete it after the rollback, but it cannot be deleted after the host is powered off or disconnected from the network.

[0003] In the case of inconsistent virtual machine data, some of them are caused by disk loss or accidental deletion. For example, some business logic errors, power outages in the business system, network outages and other failures will cause disk loss or accidental deletion, which will affect data security and subsequent business. Summary of the invention

[0004] In view of this, the present invention provides a virtual disk processing method, device, equipment and storage medium to solve the problem of virtual disk loss or accidental deletion.

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

[0006] During the execution of the main task of the virtual machine, the target virtual disk to be deleted is saved in the recycle bin;

[0007] After the main task is completed, the virtualization platform data and the underlying disk tree data are obtained, and it is determined whether the data values ​​are consistent;

[0008] In the case where the virtualization platform data is inconsistent with the underlying disk tree data, recovering the target virtual disk from the recycle bin, and updating the virtualization platform data using the underlying disk tree data;

[0009] When the virtualization platform data is consistent with the underlying disk tree data, the target virtual disk in the recycle bin is deleted.

[0010] In an optional implementation, when the virtualization platform data is inconsistent with the underlying disk tree data, restoring the target virtual disk from the recycle bin and updating the virtualization platform data using the underlying disk tree data includes:

[0011] If the number of disk trees of the virtualization platform data is greater than the number of disk trees of the underlying disk tree data, pausing the virtual machine;

[0012] If the number of disk trees of the virtualization platform data is less than the number of disk trees of the underlying disk tree data, recovering the target virtual disk from the recycle bin, and updating the virtualization platform data using the underlying disk tree data;

[0013] If the number of disk trees of the virtualization platform data is equal to the number of disk trees of the underlying disk tree data, then determine whether the data value of each disk tree is consistent. If inconsistent, use the underlying disk tree data to update the virtualization platform data.

[0014] In an optional implementation, the acquiring of virtualization platform data and underlying disk tree data, and determining whether the data values ​​are consistent, includes:

[0015] For the virtualization platform data and the underlying disk tree data, determining whether the data value of each disk tree is consistent;

[0016] When the virtualization platform data is inconsistent with the underlying disk tree data, the target virtual disk is restored from the recycle bin, and the virtualization platform data is updated using the underlying disk tree data, including:

[0017] In the case where there is a disk tree inconsistency between the virtualization platform data and the underlying disk tree data, a data inconsistency alarm is generated;

[0018] In a case where the virtualization platform data has a first disk tree and the underlying disk tree data does not have the first disk tree, pausing the virtual machine;

[0019] In the case that the second disk tree does not exist in the virtualization platform data and the second disk tree exists in the underlying disk tree data, retrieving the second disk tree from the recycle bin, and updating the second disk tree of the virtualization platform data by using the second disk tree in the underlying disk tree data retrieved from the recycle bin;

[0020] If the second disk tree is not successfully retrieved from the recycle bin, the virtual machine is forcibly restarted.

[0021] In an optional implementation manner, deleting the target virtual disk in the recycle bin includes:

[0022] Parsing the data storage identifier of the target virtual disk and the logical unit identifier of the storage space of the target virtual disk in the recycle bin;

[0023] Using the data storage identifier and the logical unit identifier, querying at the bottom layer whether the target virtual disk is allowed to be deleted;

[0024] Using the data storage identifier and the logical unit identifier, querying in a virtualization platform database whether the target virtual disk is being used;

[0025] If the target virtual disk is allowed to be deleted at the bottom layer and is not being used by the virtualization platform database, the target virtual disk is deleted from the recycle bin.

[0026] In an optional implementation manner, deleting the target virtual disk in the recycle bin further includes:

[0027] If the target virtual disk is not allowed to be deleted at the bottom layer, or is being used by the virtualization platform database, then at the next scheduled recycling time, the data storage identifier and the logical unit identifier are used again to query at the bottom layer whether the target virtual disk is allowed to be deleted; and the data storage identifier and the logical unit identifier are used again to query in the virtualization platform database whether the target virtual disk is being used.

[0028] In an optional implementation, before obtaining the virtualization platform data and the underlying disk tree data and determining whether the data values ​​are consistent, the process further includes:

[0029] After the main task is completed, if the actual running state of the virtual machine on the host is a shutdown state, and the state of the virtual machine recorded in the virtualization platform database is a startup state, the virtual machine is added to a message queue with high availability characteristics and started;

[0030] If the actual running state of the virtual machine on the host is the power-on state, and the state of the virtual machine recorded in the virtualization platform database is the power-off state, the state of the virtual machine recorded in the virtualization platform database is updated to the power-on state.

[0031] In an optional implementation, before obtaining the virtualization platform data and the underlying disk tree data and determining whether the data values ​​are consistent, the process further includes:

[0032] After the main task is completed, query the detailed information of the virtual machine according to the virtual machine identifier transmitted in the context;

[0033] If the virtual machine is found, the current state of the virtual machine is recorded as the original state;

[0034] Acquire information about the host according to the detailed information of the virtual machine obtained by querying;

[0035] According to the information of the host, query the status information of the host;

[0036] If the queried status information of the host indicates that the host is unreachable and the original status is that the host is powered on and locked, a data anomaly alarm is generated, and the current status of the virtual machine is changed to a data anomaly status;

[0037] If the queried status information of the host indicates that the host is unreachable and the original status is powered on without holding a lock, adding the virtual machine to a message queue with high availability characteristics, and changing the current status of the virtual machine to a powered off status;

[0038] If the queried status information of the host indicates that the host is reachable, start consistency detection of the virtualization platform data and the underlying disk tree data.

[0039] In a second aspect, the present invention provides a virtual disk processing device, the device comprising:

[0040] A saving module is used to save the target virtual disk to be deleted in a recycle bin during the execution of the main task of the virtual machine;

[0041] A judgment module, used for obtaining virtualization platform data and underlying disk tree data after the main task is completed, and judging whether the data values ​​are consistent;

[0042] A data recovery module, used for recovering the target virtual disk from the recycle bin and updating the virtualization platform data using the underlying disk tree data when the virtualization platform data is inconsistent with the underlying disk tree data;

[0043] The deleting module is used to delete the target virtual disk in the recycle bin when the virtualization platform data is consistent with the underlying disk tree data.

[0044] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the virtual disk processing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0045] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the virtual disk processing method of the first aspect or any corresponding embodiment thereof.

[0046] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the virtual disk processing method of the first aspect or any corresponding embodiment thereof.

[0047] The virtual disk processing method, device, equipment and storage medium provided in this embodiment do not perform real deletion operations on virtual disks that need to be deleted in the business process, but save the virtual disks that need to be deleted in the recycle bin table first, and save them in the task context. After the main task is completed, it is uniformly scheduled to the consistency detection process between the virtualization platform data and the underlying disk tree data. After the consistency detection is confirmed, the virtual disk that needs to be deleted is deleted from the recycle bin to complete the real deletion, thereby preventing accidental deletion of virtual disk data and protecting data security.

[0048] In addition, the present invention can enhance the functions of the virtualization platform, not only ensuring the security and integrity of data in the virtual machine and preventing data loss or illegal tampering, but also quickly recovering data in the event of system failure or unexpected situation, thus ensuring business continuity and stability. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0050] Figure 1 is a flow chart of a virtual disk processing method according to an embodiment of the present invention;

[0051] Figure 2 is a flow chart of another virtual disk processing method according to an embodiment of the present invention;

[0052] Figure 3 is a structural block diagram of a virtual disk processing device according to an embodiment of the present invention;

[0053] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0055] According to an embodiment of the present invention, a virtual disk processing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of executable computer instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0056] In this embodiment, a virtual disk processing method is provided. Figure 1 is a flow chart of a virtual disk processing method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0057] Step S101: during the execution of the main task of the virtual machine, the target virtual disk to be deleted is saved in a recycle bin.

[0058] In an embodiment of the present invention, when the business logic needs to delete a virtual disk, a real deletion operation is not performed, but it is moved to a recycle bin instead, and a pseudo-deletion process is performed. Specifically, it is first necessary to create a new recycle bin table in the virtualization platform database (DB), and all virtual disks that need to be deleted are all moved into the recycle bin table, and the status is set to an unrecyclable state. Records can be made in the virtualization platform database (DB) for virtual disks to be recycled (i.e., pseudo-deleted virtual disks), where recycle_volume (storage volume associated with the virtual machine recycle bin) is used to record the records in the recycle bin. In addition, after recording the virtual disk, the recycle_volume of the relevant recycle bin needs to be saved to the relevant task context for transfer. After the entire main task is completed, the consistency detection task of the upper and lower disk data of the virtual machine is started.

[0059] Step S102, after the main task is completed, obtain the virtualization platform data and the underlying disk tree data, and determine whether the data values ​​are consistent.

[0060] In the embodiment of the present invention, the main task includes but is not limited to tasks such as migration and snapshot operations, and the output of the main task is task information and virtual disk information to be recycled. After each main task is completed, a consistency check task will be executed, and the task status of the main task can be success, failure, cancellation, etc.

[0061] To obtain the underlying disk tree data, it is necessary to call the underlying (IVA side) interface, and to obtain the virtualization platform data, it is necessary to call the platform side interface.

[0062] Step S103 , when the virtualization platform data is inconsistent with the underlying disk tree data, the target virtual disk is restored from the recycle bin, and the virtualization platform data is updated using the underlying disk tree data.

[0063] After the virtualization platform data is updated using the underlying disk tree data, the virtualization platform data becomes consistent with the underlying disk tree data.

[0064] Step S104, when the virtualization platform data is consistent with the underlying disk tree data, the target virtual disk in the recycle bin is deleted. Here, the situation where the virtualization platform data is consistent with the underlying disk tree data includes the situation where the two are originally consistent after the main task is completed, and also includes the situation where the virtualization platform data becomes consistent with the underlying disk tree data after the virtualization platform data is updated using the underlying disk tree data.

[0065] The virtual disk processing method provided in this embodiment does not perform a real deletion operation on the virtual disk that needs to be deleted in the business process, but saves the virtual disk that needs to be deleted in the recycle bin table first, and saves it in the task context. After the main task is completed, it is uniformly scheduled to the consistency detection process between the virtualization platform data and the underlying disk tree data. After the consistency detection is confirmed, the virtual disk that needs to be deleted is deleted from the recycle bin to complete the real deletion, thereby preventing the virtual disk data from being accidentally deleted and protecting data security.

[0066] In addition, the present invention can enhance the functions of the virtualization platform, not only ensuring the security and integrity of data in the virtual machine and preventing data loss or illegal tampering, but also quickly recovering data in the event of system failure or unexpected situation, thus ensuring business continuity and stability.

[0067] In some optional specific implementations, when the virtualization platform data is inconsistent with the underlying disk tree data, restoring the target virtual disk from the recycle bin and updating the virtualization platform data using the underlying disk tree data include:

[0068] If the number of disk trees (centerTreeMap) of the virtualization platform data is greater than the number of disk trees (ivaTreeMap) of the underlying disk tree data, pausing the virtual machine and setting the state of the virtual machine to data abnormality;

[0069] If the number of disk trees of the virtualization platform data is less than the number of disk trees of the underlying disk tree data, the target virtual disk is restored from the recycle bin, and the virtualization platform data is updated using the underlying disk tree data; in addition, if the restoration of the target virtual disk from the recycle bin fails, the state of the virtual machine is set to data abnormality;

[0070] If the number of disk trees of the virtualization platform data is equal to the number of disk trees of the underlying disk tree data, then it is determined whether the data value of each disk tree is consistent. If not, the virtualization platform data is updated using the underlying disk tree data. The data value of each disk tree includes key information such as offset, storage pool identifier, and size.

[0071] For the disk tree of virtualization platform data and the disk tree of underlying disk tree data, it is necessary to determine whether the data values ​​of the two are consistent. Specifically, it is possible to determine whether the data value check values ​​of the two are consistent. The check value is generated in the following way:

[0072] The newly added data in the disk tree is divided into blocks, and SHA-256 (Secure Hash Algorithm 256-bit) is used to perform hash calculation to obtain a SHA-256 hash value. The latest M (M≥1) SHA-256 hash values ​​are saved in chronological order as data value check values. If the data value check values ​​are consistent, the data values ​​of the two disk trees are considered to be consistent. The method for calculating the data value check value in the embodiment of the present invention is simple, has a small amount of calculation, and the amount of calculation required for comparison is also small.

[0073] In some other optional specific implementations, the obtaining of virtualization platform data and underlying disk tree data, and determining whether the data values ​​are consistent, includes:

[0074] For the virtualization platform data and the underlying disk tree data, determining whether the data value of each disk tree is consistent;

[0075] When the virtualization platform data is inconsistent with the underlying disk tree data, the target virtual disk is restored from the recycle bin, and the virtualization platform data is updated using the underlying disk tree data, including:

[0076] In the case where there is a disk tree inconsistency between the virtualization platform data and the underlying disk tree data, a data inconsistency alarm is generated;

[0077] In a case where the virtualization platform data has a first disk tree and the underlying disk tree data does not have the first disk tree, pausing the virtual machine;

[0078] In the case that the second disk tree does not exist in the virtualization platform data and the second disk tree exists in the underlying disk tree data, the second disk tree is retrieved from the recycle bin, and the second disk tree of the virtualization platform data is updated by using the second disk tree in the underlying disk tree data retrieved from the recycle bin; in the case that the second disk tree is successfully retrieved from the recycle bin, a data inconsistency alarm is eliminated;

[0079] In the case that the second disk tree is not successfully retrieved from the recycle bin, the virtual machine is forcibly restarted based on the upper layer.

[0080] In some specific implementations, deleting the target virtual disk in the recycle bin includes:

[0081] Parsing the data storage identifier (datastoreId) of the target virtual disk and the logical unit identifier (volumeUuid) of the storage space of the target virtual disk in the recycle bin;

[0082] Using the data storage identifier and the logical unit identifier, querying at the bottom layer whether the target virtual disk is allowed to be deleted; specifically, the bottom layer uses the variable ivDel to mark whether the target virtual disk is allowed to be deleted;

[0083] Using the data storage identifier and the logical unit identifier, querying in the virtualization platform database whether the target virtual disk is being used; specifically, the virtualization platform database uses the variable centerDel to mark whether the target virtual disk is being used;

[0084] If the target virtual disk is allowed to be deleted at the bottom layer and is not being used by the virtualization platform database, the target virtual disk is deleted from the recycle bin.

[0085] In addition, deleting the target virtual disk in the recycle bin further includes:

[0086] If the target virtual disk is not allowed to be deleted at the bottom layer, or is being used by the virtualization platform database, then at the next scheduled recycling time, the data storage identifier and the logical unit identifier are used again to query at the bottom layer whether the target virtual disk is allowed to be deleted; and the data storage identifier and the logical unit identifier are used again to query in the virtualization platform database whether the target virtual disk is being used.

[0087] In the embodiment of the present invention, if the virtual disk in the recycle bin is not successfully cleared at one time, a timer strategy is used to trigger another clearing operation, that is, when the consistency detection task is completed and the virtualization platform data is consistent with the underlying disk tree data, the virtual disk that needs to be cleared is not successfully cleared, and the virtual disk that remains in the recycle bin can be cleared at a scheduled time, for example, set to 1 a.m. for clearing. That is to say, in the embodiment of the present invention, there are two specific clearing operations for all virtual disks in the virtual disk recycle bin: one is to perform the recycling operation at the end of the task as the consistency detection task is sent, and the other is to use a timer to trigger recycling when the consistency detection task cannot be recycled.

[0088] In some optional specific implementations, before obtaining the virtualization platform data and the underlying disk tree data and determining whether the data values ​​are consistent, the method further includes:

[0089] After the main task is completed, if the actual running state of the virtual machine on the host is a shutdown state, and the state of the virtual machine recorded in the virtualization platform database is a startup state, the virtual machine is added to a message queue with high availability (HA) characteristics to be started;

[0090] If the actual running state of the virtual machine on the host is the power-on state, and the state of the virtual machine recorded in the virtualization platform database is the power-off state, the state of the virtual machine recorded in the virtualization platform database is updated to the power-on state.

[0091] In some optional specific implementations, before obtaining the virtualization platform data and the underlying disk tree data and determining whether the data values ​​are consistent, the method further includes:

[0092] After the main task is completed, query the detailed information of the virtual machine according to the virtual machine identifier transmitted in the context;

[0093] If the virtual machine is found, that is, the virtual machine exists normally, the current state of the virtual machine is recorded as the original state (originStatus), and the task status is changed to consistency check; in addition, if the virtual machine is not found, the consistency check task is skipped and ended directly. The situation where the virtual machine cannot be found may be because the main task is a virtual machine deletion task, or the virtual machine identifier is transmitted incorrectly;

[0094] Acquire information about the host according to the detailed information of the virtual machine obtained by querying;

[0095] According to the information of the host, query the status information of the host;

[0096] If the queried status information of the host indicates that the host is unreachable and the original status is that the host is powered on and locked, a data anomaly alarm is generated, and the current status of the virtual machine is changed to a data anomaly status;

[0097] If the queried status information of the host indicates that the host is unreachable and the original state is powered on without holding a lock, the virtual machine is added to a message queue with high availability characteristics (HA queue), and the current state of the virtual machine is changed to a powered off state;

[0098] If the queried status information of the host indicates that the host is reachable, start consistency detection of the virtualization platform data and the underlying disk tree data.

[0099] In the embodiment of the present invention, the above steps are performed at the beginning of the consistency detection task. Only when the host is reachable, the consistency detection of the virtualization platform data and the underlying disk tree data is actually started.

[0100] The virtual disk processing method provided by the embodiment of the present invention can also detect data (especially disk) anomalies under various abnormal conditions of the virtual machine, and issue an alarm in time when a problem is found, so that the user can take timely strategies to deal with it and prevent the loss of customer key data.

[0101] like Figure 2 As shown, in this embodiment, a virtual disk processing method is provided, and the process includes the following steps:

[0102] Step S1: Execute the main task, such as the migration of the entire virtual machine.

[0103] Step S2: The main task is completed and the consistency detection task is triggered.

[0104] Step S3, query the detailed information of the virtual machine according to the virtual machine identifier passed in the context, if the virtual machine is queried, record the current state of the virtual machine as the original state, obtain the host information according to the detailed information of the virtual machine obtained by the query, and query the status information of the host according to the information of the host. If the status information of the host obtained by the query indicates that the host is unreachable (that is, the host is abnormal), execute step S4, otherwise execute step S7.

[0105] Step S4, determine whether the original state of the virtual machine is the power-on state (also called the running state), if it is the power-on state (also called the running state), execute step S5, otherwise execute step S19.

[0106] Step S5, determine whether the original state of the virtual machine is to start up and hold the lock. If so, set the virtual machine state to a data abnormal state and generate a data abnormality alarm, and then execute step S19; otherwise, execute step S6.

[0107] Step S6: Add the virtual machine to the HA queue, and then execute step S19.

[0108] Step S7, obtain the real running state of the virtual machine on the host, which is recorded as the first state here, and obtain the state of the virtual machine recorded in the virtualization platform database, which is recorded as the second state here. If the real running state of the virtual machine on the host is the shutdown state, and the state of the virtual machine recorded in the virtualization platform database is the power-on state, execute step S6; if the real running state of the virtual machine on the host is the shutdown state, and the state of the virtual machine recorded in the virtualization platform database is the shutdown state, directly execute step S19; if the real running state of the virtual machine on the host is the power-on state, and the state of the virtual machine recorded in the virtualization platform database is the power-on state, directly execute step S9; if the real running state of the virtual machine on the host is the power-on state, and the state of the virtual machine recorded in the virtualization platform database is the power-on state, execute step S8.

[0109] Step S8: update the state of the virtual machine recorded in the virtualization platform database to a powered-on state, and then execute step S9.

[0110] Step S9: Acquire virtualization platform data (referred to as the first disk tree here) and underlying disk tree data (referred to as the second disk tree here).

[0111] Step S10, determine whether the number of disk trees of virtualization platform data (referred to as the first disk tree here) and disk trees of underlying disk tree data (referred to as the second disk tree here) are consistent, if not, execute step S11, otherwise execute step S15.

[0112] Step S11, determine the size relationship between the number of disk trees of the virtualization platform data (represented here as the first disk tree) and the number of disk trees of the underlying disk tree data (represented here as the second disk tree). If the number of disk trees of the virtualization platform data is greater than the number of disk trees of the underlying disk tree data, execute step S12, otherwise execute step S13.

[0113] Step S12: Pause the virtual machine and set the state of the virtual machine to data abnormality.

[0114] Step S13, recovering the target virtual disk from the recycle bin, and updating the virtualization platform data using the underlying disk tree data; if data recovery fails, executing step S14, otherwise executing step S16.

[0115] Step S14: setting the state of the virtual machine to data abnormality.

[0116] Step S15: Determine whether the data values ​​of each disk tree are consistent. If they are inconsistent, execute step S13; otherwise, execute step S16.

[0117] Step S16: Get the target virtual disk from the task context and check whether the target virtual disk in the recycle bin can be deleted. For details, see above and will not be repeated here. If it can be deleted, execute step S17, otherwise execute step S18.

[0118] Step S17: Change the state of the virtual disk to a recyclable state, and then perform real deletion. If the deletion is successful, delete the recycle bin record table and end the task.

[0119] Step S18: Change the state of the virtual disk to an unrecyclable state, and execute step S16 when the next scheduled recycling time is reached.

[0120] Step S19, end the consistency detection task.

[0121] In this embodiment, a virtual disk processing device is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0122] This embodiment provides a virtual disk processing device, such as Figure 3 As shown, including:

[0123] The saving module 301 is used to save the target virtual disk to be deleted in the recycle bin during the execution of the main task of the virtual machine;

[0124] The judgment module 302 is used to obtain the virtualization platform data and the underlying disk tree data after the main task is completed, and to judge whether the data values ​​are consistent;

[0125] The data recovery module 303 is used to recover the target virtual disk from the recycle bin and update the virtualization platform data using the underlying disk tree data when the virtualization platform data is inconsistent with the underlying disk tree data;

[0126] The deleting module 304 is configured to delete the target virtual disk in the recycle bin when the virtualization platform data is consistent with the underlying disk tree data.

[0127] In some optional implementations, the data recovery module 303 includes:

[0128] a first pausing unit, configured to suspend the virtual machine if the number of disk trees of the virtualization platform data is greater than the number of disk trees of the underlying disk tree data;

[0129] a first data recovery unit, configured to recover the target virtual disk from the recycle bin if the number of disk trees of the virtualization platform data is less than the number of disk trees of the underlying disk tree data, and to update the virtualization platform data using the underlying disk tree data;

[0130] The second data recovery unit is used to determine whether the data value of each disk tree is consistent if the number of disk trees of the virtualization platform data is equal to the number of disk trees of the underlying disk tree data. If they are inconsistent, the virtualization platform data is updated using the underlying disk tree data.

[0131] In some optional implementations, the determination module 302 includes:

[0132] A judging unit, configured to judge whether the data value of each disk tree is consistent with the virtualization platform data and the underlying disk tree data;

[0133] The data recovery module 303 includes:

[0134] An alarm unit, configured to generate a data inconsistency alarm when there is a disk tree inconsistency between the virtualization platform data and the underlying disk tree data;

[0135] A second pausing unit, configured to suspend the virtual machine when the first disk tree exists in the virtualization platform data and the first disk tree does not exist in the underlying disk tree data;

[0136] A third data recovery unit is used to retrieve the second disk tree from the recycle bin when the second disk tree does not exist in the virtualization platform data and the second disk tree exists in the underlying disk tree data, and update the second disk tree of the virtualization platform data by using the second disk tree in the underlying disk tree data retrieved from the recycle bin;

[0137] A restart unit is used to forcibly restart the virtual machine when the second disk tree is not successfully retrieved from the recycle bin.

[0138] In some optional implementations, the deletion module 304 includes:

[0139] A parsing unit, used to parse out a data storage identifier of the target virtual disk and a logical unit identifier of the storage space of the target virtual disk in the recycle bin;

[0140] A first query unit, configured to query at a bottom layer whether the target virtual disk is allowed to be deleted by using the data storage identifier and the logical unit identifier;

[0141] A second query unit, configured to query in a virtualization platform database whether the target virtual disk is being used by using the data storage identifier and the logic unit identifier;

[0142] The deleting unit is configured to delete the target virtual disk from the recycle bin if the target virtual disk is allowed to be deleted at the bottom layer and is not being used by the virtualization platform database.

[0143] In some optional embodiments, the deletion module 304 is also used to, if the target virtual disk is not allowed to be deleted at the bottom layer, or is being used by the virtualization platform database, then at the next scheduled recycling time, use the data storage identifier and the logical unit identifier again to query at the bottom layer whether the target virtual disk is allowed to be deleted; and use the data storage identifier and the logical unit identifier again to query in the virtualization platform database whether the target virtual disk is being used.

[0144] In some optional implementations, the virtual disk processing device further includes:

[0145] A first state updating module is used for, after the main task is completed, if the actual running state of the virtual machine on the host is a shutdown state, and the state of the virtual machine recorded in the virtualization platform database is a startup state, adding the virtual machine to a message queue with high availability characteristics to start it up;

[0146] The second status update module is used to update the status of the virtual machine recorded in the virtualization platform database to the power-on state if the actual running status of the virtual machine on the host is the power-on state, and the status of the virtual machine recorded in the virtualization platform database is the power-off state.

[0147] In some optional implementations, the virtual disk processing device further includes:

[0148] A virtual machine information query module, used to query detailed information of the virtual machine according to the virtual machine identifier transmitted in the context after the main task is completed;

[0149] A virtual machine state recording module, for recording the current state of the virtual machine as an original state if the virtual machine is found;

[0150] A host information acquisition module, used to acquire host information according to the detailed information of the virtual machine obtained through query;

[0151] A host status information query module, used to query the status information of the host according to the information of the host;

[0152] An alarm module, for generating a data abnormality alarm and changing the current state of the virtual machine to a data abnormality state if the queried state information of the host indicates that the host is unreachable and the original state is a power-on holding lock;

[0153] A virtual machine status update module, configured to add the virtual machine to a message queue with high availability characteristics and change the current status of the virtual machine to a shutdown state if the queried status information of the host indicates that the host is unreachable and the original state is powered on without holding a lock;

[0154] The consistency detection task starting module is used to start the consistency detection of the virtualization platform data and the underlying disk tree data if the queried status information of the host indicates that the host is reachable.

[0155] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0156] The virtual disk processing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0157] The embodiment of the present invention also provides a computer device having the above Figure 3 The virtual disk processing device shown.

[0158] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 4As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.

[0159] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0160] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0161] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0162] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0163] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.

[0164] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0165] The computer device also includes a communication interface, which is used for the computer device to communicate with other devices or a communication network.

[0166] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0167] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0168] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A virtual disk processing method, characterized in that: The method comprises: During the execution of the main task of the virtual machine, the target virtual disk to be deleted is saved in the recycle bin; After the main task is completed, the virtualization platform data and the underlying disk tree data are obtained, and it is determined whether the data values ​​are consistent; In the case where the virtualization platform data is inconsistent with the underlying disk tree data, recovering the target virtual disk from the recycle bin, and updating the virtualization platform data using the underlying disk tree data; When the virtualization platform data is consistent with the underlying disk tree data, the target virtual disk in the recycle bin is deleted.

2. The method according to claim 1, characterized in that When the virtualization platform data is inconsistent with the underlying disk tree data, the target virtual disk is restored from the recycle bin, and the virtualization platform data is updated using the underlying disk tree data, including: If the number of disk trees of the virtualization platform data is greater than the number of disk trees of the underlying disk tree data, pausing the virtual machine; If the number of disk trees of the virtualization platform data is less than the number of disk trees of the underlying disk tree data, recovering the target virtual disk from the recycle bin, and updating the virtualization platform data using the underlying disk tree data; If the number of disk trees of the virtualization platform data is equal to the number of disk trees of the underlying disk tree data, then determine whether the data value of each disk tree is consistent. If inconsistent, use the underlying disk tree data to update the virtualization platform data.

3. The method according to claim 1, characterized in that The step of obtaining the virtualization platform data and the underlying disk tree data and determining whether the data values ​​are consistent includes: For the virtualization platform data and the underlying disk tree data, determining whether the data value of each disk tree is consistent; When the virtualization platform data is inconsistent with the underlying disk tree data, the target virtual disk is restored from the recycle bin, and the virtualization platform data is updated using the underlying disk tree data, including: In the case where there is a disk tree inconsistency between the virtualization platform data and the underlying disk tree data, a data inconsistency alarm is generated; In a case where the virtualization platform data has a first disk tree and the underlying disk tree data does not have the first disk tree, pausing the virtual machine; In the case that the second disk tree does not exist in the virtualization platform data and the second disk tree exists in the underlying disk tree data, retrieving the second disk tree from the recycle bin, and updating the second disk tree of the virtualization platform data by using the second disk tree in the underlying disk tree data retrieved from the recycle bin; If the second disk tree is not successfully retrieved from the recycle bin, the virtual machine is forcibly restarted.

4. The method according to claim 1, characterized in that: The deleting the target virtual disk in the recycle bin includes: Parsing the data storage identifier of the target virtual disk and the logical unit identifier of the storage space of the target virtual disk in the recycle bin; Using the data storage identifier and the logical unit identifier, querying at the bottom layer whether the target virtual disk is allowed to be deleted; Using the data storage identifier and the logical unit identifier, querying in a virtualization platform database whether the target virtual disk is being used; If the target virtual disk is allowed to be deleted at the bottom layer and is not being used by the virtualization platform database, the target virtual disk is deleted from the recycle bin.

5. The method according to claim 4, characterized in that The deleting the target virtual disk in the recycle bin further includes: If the target virtual disk is not allowed to be deleted at the bottom layer, or is being used by the virtualization platform database, then at the next scheduled recycling time, the data storage identifier and the logical unit identifier are used again to query at the bottom layer whether the target virtual disk is allowed to be deleted; and the data storage identifier and the logical unit identifier are used again to query in the virtualization platform database whether the target virtual disk is being used.

6. The method according to claim 1, characterized in that Before obtaining the virtualization platform data and the underlying disk tree data and determining whether the data values ​​are consistent, the method further includes: After the main task is completed, if the actual running state of the virtual machine on the host is a shutdown state, and the state of the virtual machine recorded in the virtualization platform database is a startup state, the virtual machine is added to a message queue with high availability characteristics and started; If the actual running state of the virtual machine on the host is the power-on state, and the state of the virtual machine recorded in the virtualization platform database is the power-off state, the state of the virtual machine recorded in the virtualization platform database is updated to the power-on state.

7. The method according to claim 1, characterized in that Before obtaining the virtualization platform data and the underlying disk tree data and determining whether the data values ​​are consistent, the method further includes: After the main task is completed, query the detailed information of the virtual machine according to the virtual machine identifier transmitted in the context; If the virtual machine is found, the current state of the virtual machine is recorded as the original state; Acquire information about the host according to the detailed information of the virtual machine obtained by querying; According to the information of the host, query the status information of the host; If the queried status information of the host indicates that the host is unreachable and the original status is that the host is powered on and locked, a data anomaly alarm is generated, and the current status of the virtual machine is changed to a data anomaly status; If the queried status information of the host indicates that the host is unreachable and the original status is powered on and no lock is held, the virtual machine is added to a message queue with high availability characteristics, and the current status of the virtual machine is changed to a powered off status; If the queried status information of the host indicates that the host is reachable, start consistency detection of the virtualization platform data and the underlying disk tree data.

8. A virtual disk processing device, characterized in that: The device comprises: A saving module is used to save the target virtual disk to be deleted in a recycle bin during the execution of the main task of the virtual machine; A judgment module, used for obtaining virtualization platform data and underlying disk tree data after the main task is completed, and judging whether the data values ​​are consistent; A data recovery module, used for recovering the target virtual disk from the recycle bin and updating the virtualization platform data using the underlying disk tree data when the virtualization platform data is inconsistent with the underlying disk tree data; The deleting module is used to delete the target virtual disk in the recycle bin when the virtualization platform data is consistent with the underlying disk tree data.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the virtual disk processing method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the virtual disk processing method according to any one of claims 1 to 7.