Virtual machine management method and device based on zstack virtualization environment, equipment and medium

By creating mirrored virtual machines in the ZStack virtualization environment and performing full and incremental backups, the problem of long-term failure recovery process of business system is solved, and the virtual machine is quickly restored, improving business stability and reliability.

CN118885262AInactive Publication Date: 2024-11-01WUHAN STONE INFORMATION SERVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411355790.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2024-11-01
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The recovery process of the prior art in the event of a business system failure takes a long time, affecting business stability and low recovery efficiency.

Method used

Create a mirrored virtual machine in the ZStack virtualization environment for initialization, implement full and incremental backups, and state backing by recovering data during failover to quickly restore the virtual machine.

Benefits of technology

Reduces downtime, improves business stability and reliability, and reduces the impact of business recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885262A_ABST
    Figure CN118885262A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual machine management method and device based on a zstack virtualization environment, electronic equipment and a medium, and the method comprises the steps: creating a mirror image virtual machine corresponding to a virtual machine in the zstack virtualization environment when it is detected that the creation of the virtual machine is completed, and carrying out the initialization processing of the mirror image virtual machine; when a backup instruction for performing data backup on the first virtual machine is received, performing incremental backup processing on the first virtual machine; when a failover instruction for the second virtual machine is received, acquiring recovery data for failover processing, and performing failover processing on the second mirror virtual machine according to the recovery data; and starting the second virtual machine and closing the second mirroring virtual machine, and performing fault recovery processing on the second virtual machine according to the second mirroring virtual machine after data recovery. According to the invention, when data loss or a system fault occurs, rapid recovery processing is carried out, downtime and business influence are reduced, and stability and reliability of business are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtual machine management and control technology, and in particular to a virtual machine management method, device, electronic device and medium based on a zstack virtualization environment. Background Art

[0002] With the development of virtualization and cloud computing technologies, more and more physical machines are virtualized, which can achieve efficient use of physical machine hardware resources. However, once a business system fails, the losses caused by business interruption are also increasing. Therefore, when a business system fails, it is particularly important that the business system can work again within seconds and start the recovery work of the business system immediately.

[0003] In the prior art, when performing business recovery, the processing process includes: repairing the fault of the source business server, restoring business data and restarting the source business server. However, this process is not only time-consuming, but also has a great impact on the business, and the workload of business recovery is also very large.

[0004] Therefore, there is an urgent need for a management method that can improve business stability and recovery speed. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a virtual machine management method, device, electronic device and medium based on the zstack virtualization environment to solve the technical problems of low business stability and low business fault recovery efficiency in related technologies.

[0006] In a first aspect, an embodiment of the present application provides a virtual machine management method based on a zstack virtualization environment, comprising: When it is detected that the virtual machine creation is completed, a mirror virtual machine corresponding to the virtual machine is created in the zstack virtualization environment, and the mirror virtual machine is initialized; When receiving a backup instruction for backing up data of the first virtual machine, performing incremental backup processing on the first virtual machine; When receiving a failover instruction for the second virtual machine, obtaining recovery data for failover processing, and performing failover processing on the second mirror virtual machine according to the recovery data; The second virtual machine is started and the second mirror virtual machine is shut down, and a fault recovery process is performed on the second virtual machine according to the second mirror virtual machine after data recovery.

[0007] In a second aspect, an embodiment of the present application provides a virtual machine management device based on a zstack virtualization environment, including: An initial processing module, for creating a mirror virtual machine corresponding to the virtual machine in a zstack virtualization environment when it is detected that the creation of the virtual machine is completed, and initializing the mirror virtual machine; The incremental backup module is used to perform incremental backup processing on the first virtual machine when receiving a backup instruction to back up data on the first virtual machine; A failover module, configured to, when receiving a failover instruction for a second virtual machine, obtain recovery data for failover processing, and perform failover processing on the second mirror virtual machine according to the recovery data; The fault recovery module is used to start the second virtual machine and shut down the second mirror virtual machine, and perform fault recovery processing on the second virtual machine according to the second mirror virtual machine after data recovery.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the steps in the virtual machine management method based on the zstack virtualization environment described above when executing the computer program.

[0009] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of any of the above-mentioned virtual machine management methods based on the zstack virtualization environment.

[0010] The embodiment of the present application provides a virtual machine management method, device, electronic device and storage medium based on the zstack virtualization environment. For the virtual machine created at the production end, a corresponding mirror virtual machine is created in the zstack virtualization environment. The full data backup process is completed by initializing the mirror virtual machine. Then, during the application process, when the first mirror virtual machine is backed up, the backup data for the backup process is obtained to back up the first mirror virtual machine. When the failover instruction for the second mirror virtual machine is received, the recovery data for the failover is obtained to complete the failover process of the second mirror virtual machine by performing state rollback processing on the second mirror virtual machine. Finally, the second virtual machine is restored to the fault recovery process according to the second mirror virtual machine after data recovery. The method realizes that the security and consistency of the data are ensured by using a full backup and multiple incremental backups for the virtual machine, and restoring to the mirror virtual machine after the backup. Then, in the event of data loss or system failure, the recovery process can be quickly performed, reducing downtime and business impact, and improving business stability and reliability. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is a flow chart of a virtual machine management method based on a zstack virtualization environment provided in an embodiment of the present application; Figure 2 This is an interactive schematic diagram of a virtual machine management system provided by an embodiment of the present application; Figure 3 It is a flowchart of the steps of performing incremental backup of a first mirror virtual machine provided in an embodiment of the present application; Figure 4 It is a flowchart of the steps of performing failover processing on the second mirror virtual machine provided in an embodiment of the present application; Figure 5 This is a structural diagram of a virtual machine management device based on the zstack virtualization environment provided in an embodiment of the present application. Figure 6 is a structural schematic diagram of an electronic device provided in an embodiment of the present application; Figure 7 This is another structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0012] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are 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 creative work are within the scope of protection of this application.

[0013] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0014] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0015] In the related art, when performing business recovery, the processing process includes: repairing the fault of the source business server, restoring business data and restarting the source business server. However, this process is time-consuming, has a great impact on the business, and the workload of business recovery is also very large.

[0016] In order to solve the technical problems existing in the related art, the embodiment of the present application provides a virtual machine management method based on the zstack virtualization environment, see Figure 1 , Figure 1 It is a flow chart of a virtual machine management method based on a zstack virtualization environment provided in an embodiment of the present application, and the method includes steps 101 to 104.

[0017] Step 101: Create a mirror virtual machine corresponding to the virtual machine in the zstack virtualization environment, and initialize the mirror virtual machine.

[0018] In one embodiment, after detecting that the production end has created a corresponding virtual machine, in order to protect the data security of the virtual machine and avoid operational abnormalities caused by data loss, etc., during the application process, a corresponding mirror virtual machine is first created in the zstack virtualization environment, and the data consistency of the virtual machine and the mirror virtual machine is ensured by backing up the data of the virtual machine and the mirror virtual machine. Then, when a fault occurs, timely recovery processing can be performed based on the relevant data of the mirror virtual machine, so that the virtual machine can be quickly restored to an appropriate time point.

[0019] Therefore, when it is determined that a virtual machine exists, a mirror virtual machine corresponding to the virtual machine is created in the zstack virtual environment, and the created mirror virtual machine is initialized, wherein the initialization process specifically involves backing up the full data of the created mirror virtual machine based on the virtual machine. At the same time, in the actual application process, the number of mirror virtual machines created can be multiple to adapt to different usage requirements.

[0020] For example, in the process of managing virtual machines in the zstack virtualization environment, data synchronization between the virtual machine and the mirror virtual machine is achieved through interactive processing between the client and the backup server. At the same time, when a virtual machine fails, the virtual machine can be promptly restored based on the mirror virtual machine, reducing the downtime caused by the failure. Figure 2 , Figure 2 This is an interactive schematic diagram of a virtual machine management system provided in an embodiment of the present application, wherein the system includes a production end, a backup server and a virtual environment, and a number of virtual machines are configured on the production end, and a mirror virtual machine corresponding to the virtual machine is created in the virtual environment. The backup server interacts with the virtual environment by receiving backup requests and / or recovery requests sent by the production end, so as to realize backup and / or recovery processing of the mirror virtual machine in the virtual environment or the virtual machine in the production end.

[0021] In the actual interaction process, the virtual machine created by the user on the production side will complete the creation of the mirror virtual machine in the virtual machine environment through interaction with the backup server. Then, during the use of the virtual machine, the production side will periodically send backup requests to the backup server so that the backup server can back up the data on the virtual machine and store it in the virtual machine environment. For example, the backup process can be performed periodically to perform incremental backup processing on the incremental data of the virtual machine, so that the mirror virtual machine in the virtual machine environment maintains data consistency with the virtual machine. At the same time, during use, if the virtual machine fails, the virtual machine will be shut down. In this case, the production side can obtain the corresponding data in the virtual environment through the backup server for failover, that is, fault repair. By controlling the failover, the virtual machine can be regressed to a certain point in time, thereby reducing the downtime of the virtual machine and reducing the impact on the business.

[0022] Furthermore, when initializing the mirror virtual machine corresponding to the created virtual machine, it includes: obtaining the data storage type of the virtual machine, wherein the data storage type includes: distributed storage, local storage and shared block storage; determining the processing rules for processing the mirror virtual machine according to the data storage type; and initializing the mirror virtual machine according to the processing rules.

[0023] Specifically, during the initialization process, the data storage type of the virtual machine corresponding to the mirror virtual machine currently being processed is determined, and then the processing rules and methods for processing the mirror virtual machine are determined according to the data storage type of the virtual machine, and then the mirror virtual machine is initialized according to the determined processing rules.

[0024] Exemplarily, the storage types used by the virtual machine include distributed storage (such as Ceph distributed storage), local storage and shared block storage. Different storage types use different methods when performing data backup and recovery and other processing. Therefore, when performing initialization processing, by obtaining the data storage type used by the virtual machine, the processing rules that need to be used currently are accurately determined, and then the determined processing rules are used for backup and / or recovery processing.

[0025] Furthermore, when the created mirror virtual machine is initialized according to the determined processing rules, it includes: obtaining the full data of the mirror virtual machine, and obtaining the storage information for storing the full data, wherein the storage information includes the storage path and the storage disk; based on the processing rules and the storage information, generating instruction information for processing the full data; and storing the full data in response to the instruction information to initialize the mirror virtual machine.

[0026] Among them, the initialization process is to perform a full backup process to ensure the data consistency of the virtual machine and the mirror virtual machine. When performing the initialization process, the full data of the mirror virtual machine corresponding to the virtual machine created in the virtual environment is obtained, and the storage information when performing the full backup storage is obtained, including the storage path and the storage disk, and then according to the determined processing rules and the obtained storage information, the instruction information for the backup process of the virtual machine is generated, and then the full data is stored by responding to the instruction information to complete the initialization process of the mirror virtual machine.

[0027] In actual applications, the full data of the specified mirror virtual machine is obtained from the ZStack management interface or API. These data may include the virtual machine's disk image file (such as `.qcow2`, `.raw` and other formats), configuration files and other necessary information. At the same time, the storage information of the full data is obtained, including the storage disk and storage path. Then, due to the differences in the processing methods corresponding to different data storage types, the processing rules of the nitrogen concept when initializing the mirror virtual machine will be determined according to the data storage type of the virtual machine. According to the obtained processing rules and the full data domain storage information, the corresponding instruction information is generated, and then the initialization processing of the mirror virtual machine is realized by responding to the instruction information, that is, the backup processing of the full data.

[0028] For example, when the data storage type of the virtual machine is ceph distributed storage, when the mirror virtual machine is initialized, the block control technology of the RADOS Block Device (rbd) of the ceph database is used to implement it. Specifically, the data block command is generated by using rbd, and then the full backup of the mirror virtual machine is completed by responding to the generated data block command. For example, when the virtual machine is in the shutdown state, the RBD command is used to export the data blocks of the entire mirror virtual machine to NFS storage. At this time, first create a snapshot for a mirror virtual machine, and then use the rbd export-diff command to export the snapshot to a file on the NF, where the command can be as follows: rbd snap create pool_name / image_name@v1 rbd export-diff pool_name / image_name@v1 / nfs / full It should be noted that due to the data storage type of ceph distributed storage, the processing method is the same when the virtual machine is powered on and powered off when performing a full backup, which will not be repeated here.

[0029] For another example, when the data storage type of the virtual machine is local storage, the backup and recovery processing is implemented using the qmp data block reading method and the writing method.

[0030] When performing a full backup while the virtual machine is powered off, use standard file copy commands or tools such as rsync or scp to copy disk files to the backup location.

[0031] Example: rsync -avW –delete / home / image / test.qcow2 / nfs / Among them, / home / image / test.qcow2 is the storage path, and / nfs / is the storage disk (for example: copy to...target location).

[0032] When a full backup is performed while the virtual machine is powered on, the qmp command is used to output the full data to the backup location.

[0033] Example: virsh qemu-monitor-command 57112f0e951a41b4bf429572860875d3 --pretty '{"execute":"transaction","arguments":{"actions":[{"type"drive-backup","data":{"device":"drive-ide0-0-0","target":" / data / test / full", "sync":"top"}}]}}' Among them, 57112f0e951a41b4bf429572860875d3 is the name of the virtual machine, drive-ide0-0-0 is the storage disk, and / data / test / full is the storage path.

[0034] For another example, when the data storage type of the virtual machine is shared block storage, the qmp+dd command is used for processing.

[0035] When performing a full backup when the virtual machine is powered off, use the dd command.

[0036] Example: dd if= / dev / mapper / dm-35 of= / nfs / full When performing a full backup while the virtual machine is powered on, the qmp command is used.

[0037] Example: virsh qemu-monitor-command 57112f0e951a41b4bf429572860875d3 --pretty '{ "execute": "transaction","arguments": {"actions": [{"type": "drive-backup","data": {"device": "drive-ide0-0-0", "target": " / data / test / full", "sync": "top"}}]}}' Among them, 57112f0e951a41b4bf429572860875d3 is the name of the virtual machine, drive-ide0-0-0 is the storage disk, and / data / test / full is the storage path.

[0038] When performing incremental backup while the virtual machine is powered on, qmp is used to send commands to output the changed data (incremental data) to the backup location.

[0039] Example: virsh qemu-monitor-command 57112f0e951a41b4bf429572860875d3'{ "execute" : "drive-backup" , "arguments" : { "device" : "drive-virtio-disk0" , "sync" : "incremental" , "bitmap" : "bitmap0" , "target" : " / data / test / inc.0"}}' Among them, 57112f0e951a41b4bf429572860875d3 is the name of the virtual machine, drive-ide0-0-0 is the storage disk, and / data / test / full is the storage path.

[0040] In summary, when the data storage type of the virtual machine is different, different command methods are used to implement the initialization processing of the mirror virtual machine, that is, the full backup processing.

[0041] Step 102: when a backup instruction for backing up data of a first mirror virtual machine is received, the backup data is acquired to perform incremental backup processing on the first mirror virtual machine.

[0042] In one embodiment, the virtual machine on the production side generates corresponding data during the application process. Therefore, during the application process, when a backup instruction is received to back up data of the first mirror virtual machine, the first mirror virtual machine is incrementally backed up by obtaining the corresponding backup data, wherein the incremental data is the data newly added compared to the previous record.

[0043] Exemplarily, when determining to perform backup processing, the first virtual machine may receive a backup request triggered by an operation, and then perform data backup processing on the mirror virtual machine in the virtual environment through interactive processing with the backup server. It may also be possible to pre-set the time interval and cycle for regularly backing up the mirror virtual machine, and then when the time for backup arrives, trigger the backup program to perform backup processing on the mirror virtual machine.

[0044] In actual applications, a backup cycle is usually set, and then the backup program is triggered when the backup time is reached to perform a backup process on the corresponding mirror virtual machine. However, since there may be a situation where the data has not changed, when receiving a backup request for the first virtual machine, it can be determined whether there is a data change in the first virtual machine, and then whether to perform a backup process.

[0045] Therefore, when receiving the backup instruction for the first virtual machine, the method includes: when receiving the backup instruction for backing up data for the first virtual machine, determining whether the first virtual machine has incremental data; when determining that the first virtual machine has incremental data, performing incremental backup processing on the first virtual machine. By comparing the data, the data backup processing will be performed only when backup is needed, that is, when incremental data exists.

[0046] Further, when performing incremental backup processing on the first mirror virtual machine, you can refer to Figure 3 , Figure 3 It is a flowchart of the steps of performing incremental backup on the first mirror virtual machine provided in an embodiment of the present application, wherein the steps include steps 301 to 303.

[0047] Step 301, when receiving a backup instruction for backing up data of a first mirror virtual machine, obtaining backup data of the first mirror virtual machine and determining a backup path of the backup data; Step 302, based on the processing rule, generating an incremental backup instruction according to the backup path and the backup data; Step 303: respond to the incremental backup instruction and perform incremental backup processing on the first mirror virtual machine.

[0048] Specifically, when determining to perform data backup processing on the first virtual machine, the backup data of the first mirror virtual machine to be backed up is obtained, and a backup path for backing up the backup data is determined. Then, according to the processing rules obtained based on the data storage type of the first virtual machine, the corresponding incremental backup instructions are generated in combination with the backup path and the backup data. Finally, by responding to the incremental backup instructions, the first mirror virtual machine is incrementally backed up, that is, the determined backup data is stored in the corresponding storage disk according to the obtained backup path. In order to ensure the storage disk required for storage, when determining the backup path of the backup data, the storage disk can be determined at the same time, and the storage pool disk can be manually selected or correspondingly associated according to the identification information of the first mirror virtual machine.

[0049] For example, when performing incremental backup processing, different processing rules correspond to certain differences in processing methods. When the data storage type is ceph distributed storage, when backing up the backup data, the rbd export data block command can be used, and then the incremental backup processing of the backup data can be completed by executing the corresponding command.

[0050] For example, create a new block for the first image virtual machine: rbd snap create pool_name / image_name@v2 Create a new snapshot `v2`.

[0051] Then, determine the difference between the new snapshot and the old snapshot: rbd export-diff pool_name / image_name@v2 --from-snap v1 / nfs / incre.0 Among them, `v1` is the snapshot of the first image virtual machine after the previous backup process, that is, the old snapshot. This command is used to export the difference data between the `v2` snapshot and the `v1` snapshot to the ` / nfs / incre.0` path, which represents the data changes of the first image virtual machine from `v1` to `v2`.

[0052] That is, when performing incremental backup processing on the first mirror virtual machine, it includes: when receiving a backup instruction to back up data of the first mirror virtual machine, creating a first snapshot of the first mirror virtual machine; obtaining a second snapshot created by the first mirror virtual machine when completing the adjacent previous backup, and comparing the first snapshot with the second snapshot to determine whether there is incremental data for the first mirror virtual machine; when it is determined that there is incremental data, obtaining backup data based on the first snapshot and the second snapshot, and determining a backup path for the backup data; if the first snapshot is consistent with the second snapshot, it is determined that there is no incremental data; if the first snapshot is inconsistent with the second snapshot, it is determined that there is incremental data.

[0053] In addition, when the data storage type is local storage or shared block storage, qmp can be used to send commands to output the changed part of the data (incremental data) to the backup location.

[0054] Example: virsh qemu-monitor-command 57112f0e951a41b4bf429572860875d3'{ "execute" : "drive-backup" , "arguments" : { "device" : "drive-virtio-disk0" , "sync" : "incremental" , "bitmap" : "bitmap0" , "target" : " / data / test / inc.0"}}' Among them, 57112f0e951a41b4bf429572860875d3 is the name of the virtual machine, drive-ide0-0-0 is the storage disk, and / data / test / full is the storage path.

[0055] Furthermore, when performing incremental backup processing, due to the differences in processing methods corresponding to different data storage types, when the data storage type is local storage and shared block storage, after completing the backup processing of the incremental data, based on the characteristics of the processing method, further processing is required at this time, specifically, data block merging processing, including: when it is determined that the incremental backup of the first mirror virtual machine is completed, obtaining the previous data block obtained by the adjacent previous backup of the first mirror virtual machine; merging the backup data with the previous data block, and updating the previous data block according to the new data block obtained by the merger.

[0056] Specifically, the currently acquired data block (incremental data) is merged with the data block before the time point to form a complete data block, which can be processed in a qmp manner.

[0057] example: (1) qemu-img rebase -u -b full inc.0 (2) qemu-img commit inc.0 Among them, full is the data block after the last backup process, inc.0 in (1) is the currently acquired data block, and inc.0 in (2) is the data block after the merge process.

[0058] Step 103: when a failover instruction for the second mirror virtual machine is received, recovery data for performing failover processing is acquired, and failover processing is performed on the second mirror virtual machine according to the recovery data.

[0059] In one embodiment, when a failover instruction for the second mirror virtual machine is received, recovery data for performing a failover process is obtained, and then a failover process is performed on the second mirror virtual machine according to the obtained recovery data.

[0060] For example, when the second mirror virtual machine is subjected to failover processing, the second mirror virtual machine is rolled back to a previous node so that the second virtual machine and the second mirror virtual machine can be used normally. Therefore, when the processing is performed, the corresponding recovery data for the failover processing is obtained, and the second mirror virtual machine is recovered according to the obtained recovery data. When the recovery processing is completed, the failover processing of the second mirror virtual machine is also completed.

[0061] Further, refer to Figure 4 , Figure 4 It is a flowchart of the steps of performing failover processing on the second mirror virtual machine provided in an embodiment of the present application, wherein the steps include steps 401 to 403.

[0062] Step 401, when receiving a failover instruction for a second mirror virtual machine, identifying a rollback time point included in the failover instruction; Step 402, obtaining second storage information of storage data corresponding to the second mirror virtual machine, and determining the recovery data to be restored according to the second storage information and the rollback time point; Step 403: Control the second virtual machine to be in a shutdown state, and perform a failover process on the second mirror virtual machine according to the recovery data.

[0063] Specifically, when a failover instruction for the second mirror virtual machine is received, the rollback time point contained in the failover instruction is identified, and the second storage information of the storage data corresponding to the second mirror virtual machine is obtained, so as to obtain recovery data for recovery processing based on the obtained storage information and the rollback time point, and then when performing a failover, the second virtual machine is controlled to be in a closed state, so as to perform failover processing on the second mirror virtual machine based on the obtained recovery data, that is, perform state rollback processing, so that the state of the second mirror virtual machine is restored to the state corresponding to the rollback time point.

[0064] Exemplarily, the second mirror virtual machine is subjected to failover processing, that is, recovery processing, and when the virtual machine data is recovered, full recovery and incremental recovery are included. At the same time, due to the differences in backup processing methods, there are certain differences in processing methods when performing recovery processing under different data storage types.

[0065] When the data storage type is distributed storage, it is implemented using the rbd command.

[0066] When performing full recovery, the rbd command is: rbd import-diff / nfs / full pool_name / image When performing incremental recovery, the rbd command is: rbd import-diff / nfs / incre.0pool_name / image Among them, / nfs / full and / nfs / incre.0 are storage disks of the restored data before the data recovery process is performed, and pool_name / image is the storage disk of the restored data after the data recovery process is completed.

[0067] When the data storage type is local storage, when performing full recovery, use the standard file copy command from the backup location to overwrite the image virtual machine disk file. For details, refer to the full backup command in the shutdown state. When performing incremental recovery, use the qemu-img merge disk command from the backup location to merge the changed data blocks into the disk of the image virtual machine. For details, refer to the data block merge command.

[0068] When the data storage type is shared block storage, the dd command is used.

[0069] When performing a full restore, the dd command is: dd if= / nfs / full of= / dev / mapper / dm-35 When performing incremental recovery, the dd command is: dd if= / nfs / incre.0 of= / dev / mapper / dm-35 Among them, / nfs / full and / nfs / incre.0 are storage disks of the restored data before the data recovery process is performed, and / dev / mapper / dm-35 is a storage disk of the restored data after the data recovery process is completed.

[0070] Step 104: start the second virtual machine and shut down the second mirror virtual machine, and perform fault recovery processing on the second virtual machine according to the second mirror virtual machine after data recovery.

[0071] In one embodiment, after completing the failover process of the second mirror virtual machine, a failover process needs to be performed, which can be performed by synchronizing the second virtual machine. Specifically, when performing the failover process, the second virtual machine is turned on and the second mirror virtual machine is turned off, and then the failover process of the second virtual machine is performed based on the second mirror virtual machine after data recovery.

[0072] Among them, when the second virtual machine is fault-recovered based on the second mirror virtual machine after data recovery, it can be equivalent to the process of synchronously backing up the incremental data of the second virtual machine. Therefore, the specific processing process can refer to the various embodiments shown in step 102 and will not be repeated here.

[0073] In summary, the present application discloses a virtual machine management method based on the zstack virtualization environment. For the virtual machine created on the production side, a corresponding mirror virtual machine is created in the zstack virtualization environment. The full data backup process is completed by initializing the mirror virtual machine. Then, during the application process, when the first mirror virtual machine is backed up, the backup data for the backup process is obtained to back up the first mirror virtual machine. When the failover instruction for the second mirror virtual machine is received, the recovery data for the failover is obtained to complete the failover process of the second mirror virtual machine by performing state rollback processing on the second mirror virtual machine. Finally, the second virtual machine is restored to the fault recovery process according to the second mirror virtual machine after data recovery. The method realizes the use of a full backup and multiple incremental backups for the virtual machine, and restores to the mirror virtual machine after the backup to ensure the security and consistency of the data. Then, in the event of data loss or system failure, the recovery process can be quickly performed, reducing downtime and business impact, and improving the stability and reliability of the business.

[0074] According to the method described in the above embodiment, this embodiment will be further described from the perspective of a virtual machine management device based on the zstack virtualization environment. The virtual machine management device based on the zstack virtualization environment can be implemented as an independent entity or integrated into an electronic device, such as a terminal. The terminal may include a mobile phone, a tablet computer, etc.

[0075] See also Figure 5 , Figure 5 is a structural diagram of a virtual machine management device based on a zstack virtualization environment provided in an embodiment of the present application, such as Figure 5 As shown, the virtual machine management device 500 based on the zstack virtualization environment provided in the embodiment of the present application includes: The initial processing module 501 is used to create a mirror virtual machine corresponding to the virtual machine in the zstack virtualization environment when it is detected that the virtual machine creation is completed, and initialize the mirror virtual machine; The incremental backup module 502 is used to perform incremental backup processing on the first virtual machine when receiving a backup instruction to back up data on the first virtual machine; The failover module 503 is used to obtain recovery data for failover processing when receiving a failover instruction for the second virtual machine, and perform failover processing on the second mirror virtual machine according to the recovery data; The fault recovery module 504 is used to start the second virtual machine and shut down the second mirror virtual machine, and perform fault recovery processing on the second virtual machine according to the second mirror virtual machine after data recovery.

[0076] In one embodiment, the initial processing module 501 is further used for: Obtaining the data storage type of the virtual machine, where the data storage type includes: distributed storage, local storage, and shared block storage; Determine a processing rule for processing the mirrored virtual machine based on the data storage type; Initialize the image virtual machine according to the processing rules.

[0077] In one embodiment, the initial processing module 501 is further used for: Obtaining the full data of the mirrored virtual machine and the storage information storing the full data, wherein the storage information includes the storage path and the storage disk; Generate instruction information for processing the entire amount of data based on processing rules and storage information; The full amount of data is stored in response to the instruction information to initialize the mirrored virtual machine.

[0078] In one embodiment, the incremental backup module 502 is further configured to: When receiving a backup instruction for backing up data of the first mirror virtual machine, obtaining the backup data of the first mirror virtual machine and determining a backup path of the backup data; Based on the processing rules, an incremental backup instruction is generated according to the backup path and backup data; In response to the incremental backup instruction, incremental backup processing is performed on the first mirror virtual machine.

[0079] In one embodiment, the incremental backup module 502 is further configured to: When receiving a backup instruction for backing up data of the first mirror virtual machine, creating a first snapshot of the first mirror virtual machine; Obtaining a second snapshot created when the first mirror virtual machine completes an adjacent previous backup, and comparing the first snapshot with the second snapshot to determine whether there is incremental data in the first mirror virtual machine; When it is determined that there is incremental data, backup data is obtained according to the first snapshot and the second snapshot, and a backup path of the backup data is determined; If the first snapshot is consistent with the second snapshot, it is determined that there is no incremental data; If the first snapshot is inconsistent with the second snapshot, it is determined that incremental data exists.

[0080] In one embodiment, the failover module 503 is further configured to: When it is determined that the incremental backup of the first mirror virtual machine is completed, obtaining a previous data block of the first mirror virtual machine obtained in the previous backup; The backup data is merged with the previous data block, and the previous data block is updated according to the new data block obtained by the merger.

[0081] In one embodiment, the failover module 503 is further configured to: When receiving a failover instruction for the second mirror virtual machine, identifying a rollback time point included in the failover instruction; Acquire second storage information of storage data corresponding to the second mirror virtual machine, and determine the recovery data to be restored according to the second storage information and the rollback time point; The second virtual machine is controlled to be in a shutdown state, and a failover process is performed on the second mirror virtual machine according to the recovery data.

[0082] Also, see Figure 6 , Figure 6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, and the electronic device may be a mobile terminal such as a smart phone, a tablet computer, or the like. Figure 6 As shown, the electronic device 600 includes a processor 601 and a memory 602. The processor 601 is electrically connected to the memory 602.

[0083] The processor 601 is the control center of the electronic device 600. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device 600 and processes data by running or loading applications stored in the memory 602 and calling data stored in the memory 602, thereby monitoring the electronic device 600 as a whole.

[0084] In this embodiment, the processor 601 in the electronic device 600 will load the instructions corresponding to the processes of one or more applications into the memory 602 according to the following steps, and the processor 601 will run the application stored in the memory 602, thereby implementing any step in the virtual machine management method based on the zstack virtualization environment provided in the above embodiment.

[0085] The electronic device 600 can implement the steps in any embodiment of the virtual machine management method based on the zstack virtualization environment provided in the embodiments of the present application. Therefore, it can achieve the beneficial effects that can be achieved by any virtual machine management method based on the zstack virtualization environment provided in the embodiments of the present application. For details, please refer to the previous embodiments and will not be repeated here.

[0086] See also Figure 7 , Figure 7 is another structural schematic diagram of an electronic device provided in an embodiment of the present application, such as Figure 7 As shown, Figure 7 The specific structural block diagram of the electronic device provided in the embodiment of the present application is shown, and the electronic device can be used to implement the virtual machine management method based on the zstack virtualization environment provided in the above embodiment. The electronic device 700 can be a mobile terminal such as a smart phone or a laptop computer.

[0087] The RF circuit 710 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices. The RF circuit 710 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity module (SIM) cards, memories, etc. The RF circuit 710 can communicate with various networks such as the Internet, corporate intranets, wireless networks, or communicate with other devices through wireless networks. The above-mentioned wireless networks may include cellular telephone networks, wireless local area networks, or metropolitan area networks. The above-mentioned wireless networks may use various communication standards, protocols and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (WCDMA), Code Division Access (CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wi-Fi) (such as Institute of Electrical and Electronics Engineers standards IEEE 802.11a, IEEE 802.11b, IEEE802.11g and / or IEEE802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access (Wi-Max), other protocols for email, instant messaging and short messages, and any other suitable communication protocols, even those that have not yet been developed.

[0088] The memory 720 can be used to store software programs and modules, such as the program instructions / modules corresponding to the virtual machine management method based on the zstack virtualization environment in the above-mentioned embodiment. The processor 780 executes various functional applications and the virtual machine management method based on the zstack virtualization environment by running the software programs and modules stored in the memory 720.

[0089] The memory 720 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 720 may further include a memory remotely arranged relative to the processor 780, and these remote memories may be connected to the electronic device 700 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.

[0090] The input unit 730 can be used to receive uploaded digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 730 may include a touch-sensitive surface 731 and other input devices 732. The touch-sensitive surface 731, also known as a touch display screen or touchpad, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch-sensitive surface 731), and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface 731 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 780, and can receive and execute commands sent by the processor 780. In addition, the touch-sensitive surface 731 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 731, the input unit 730 may further include other input devices 732. Specifically, the other input devices 732 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.

[0091] The display unit 740 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device 700, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 740 may include a display panel 741, and optionally, the display panel 741 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface 731 may cover the display panel 741, and when the touch-sensitive surface 731 detects a touch operation on or near it, it is transmitted to the processor 780 to determine the type of the touch event, and then the processor 780 provides corresponding visual output on the display panel 741 according to the type of the touch event. Although in the figure, the touch-sensitive surface 731 and the display panel 741 are implemented as two independent components to implement input and output functions, in some embodiments, the touch-sensitive surface 731 and the display panel 741 can be integrated to implement input and output functions.

[0092] The electronic device 700 may also include at least one sensor 750, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 741 according to the brightness of the ambient light, and the proximity sensor may generate an interrupt when the flip cover is closed or closed. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can also be configured in the electronic device 700, they will not be repeated here.

[0093] The audio circuit 760, the speaker 761, and the microphone 762 can provide an audio interface between the user and the electronic device 700. The audio circuit 760 can transmit the electrical signal converted from the received audio data to the speaker 761, which is converted into a sound signal for output; on the other hand, the microphone 762 converts the collected sound signal into an electrical signal, which is received by the audio circuit 760 and converted into audio data, and then the audio data is output to the processor 780 for processing, and then sent to another terminal through the RF circuit 710, or the audio data is output to the memory 720 for further processing. The audio circuit 760 may also include an earplug jack to provide communication between an external headset and the electronic device 700.

[0094] The electronic device 700 can help the user receive requests, send information, etc. through the transmission module 770 (such as a Wi-Fi module), which provides the user with wireless broadband Internet access. Although the transmission module 770 is shown in the figure, it can be understood that it is not a necessary component of the electronic device 700 and can be omitted as needed without changing the essence of the invention.

[0095] The processor 780 is the control center of the electronic device 700. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 720, and calling data stored in the memory 720, it executes various functions of the electronic device 700 and processes data, thereby monitoring the electronic device as a whole. Optionally, the processor 780 may include one or more processing cores; in some embodiments, the processor 780 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It can be understood that the above-mentioned modem processor may not be integrated into the processor 780.

[0096] The electronic device 700 also includes a power supply 790 (such as a battery) for supplying power to various components. In some embodiments, the power supply can be logically connected to the processor 780 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 790 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0097] Although not shown, the electronic device 700 also includes a camera (such as a front camera, a rear camera), a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the display unit of the electronic device is a touch screen display, and the mobile terminal also includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and are configured to be executed by one or more processors to implement any step of the virtual machine management method based on the zstack virtualization environment provided in the above embodiment.

[0098] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined and implemented as the same or several entities. The specific implementation of the above modules can be found in the previous method embodiments, which will not be repeated here.

[0099] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling related hardware through instructions, and the instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. To this end, an embodiment of the present application provides a storage medium, which stores multiple instructions, and the instructions can be executed by the processor to implement any step of the virtual machine management method based on the zstack virtualization environment provided in the above embodiments.

[0100] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0101] Since the instructions stored in the storage medium can execute the steps in any embodiment of the virtual machine management method based on the zstack virtualization environment provided in the embodiments of the present application, the beneficial effects that can be achieved by any virtual machine management method based on the zstack virtualization environment provided in the embodiments of the present application can be achieved. For details, please refer to the previous embodiments and will not be repeated here.

[0102] The above is a detailed introduction to a virtual machine management method, device, electronic device and storage medium based on a zstack virtualization environment provided by an embodiment of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and its core idea of ​​the present application. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application. Moreover, for those of ordinary skill in the art, without departing from the principles of the present application, several improvements and modifications can be made, and these improvements and modifications are also regarded as the scope of protection of the present application.

Claims

1. A virtual machine management method based on zstack virtualization environment, characterized in that: include: Creating a mirror virtual machine corresponding to the virtual machine in the zstack virtualization environment, and initializing the mirror virtual machine; When receiving a backup instruction for backing up data of the first mirror virtual machine, acquiring the backup data and performing incremental backup processing on the first mirror virtual machine; When receiving a failover instruction for the second mirror virtual machine, obtaining recovery data for failover processing, and performing failover processing on the second mirror virtual machine according to the recovery data; The second virtual machine is started and the second mirror virtual machine is shut down, and a fault recovery process is performed on the second virtual machine according to the second mirror virtual machine after data recovery.

2. The method according to claim 1, characterized in that The initialization process of the mirror virtual machine includes: Obtaining a data storage type of the virtual machine, wherein the data storage type includes: distributed storage, local storage, and shared block storage; Determining a processing rule for processing the mirrored virtual machine according to the data storage type; The mirror virtual machine is initialized according to the processing rule.

3. The method according to claim 2, characterized in that Initializing the mirror virtual machine according to the processing rule includes: Acquire the full data of the mirrored virtual machine, and acquire the storage information storing the full data, wherein the storage information includes a storage path and a storage disk; Based on the processing rule and the storage information, generating instruction information for processing the full amount of data; The full amount of data is stored in response to the instruction information to initialize the mirror virtual machine.

4. The method according to claim 2, characterized in that When receiving a backup instruction for backing up data of the first mirror virtual machine, acquiring backup data and performing incremental backup processing on the first mirror virtual machine includes: When receiving a backup instruction for backing up data of the first mirror virtual machine, acquiring the backup data of the first mirror virtual machine and determining a backup path for the backup data; Based on the processing rule, generating an incremental backup instruction according to the backup path and the backup data; In response to the incremental backup instruction, incremental backup processing is performed on the first mirror virtual machine.

5. The method according to claim 4, characterized in that When the data storage type is distributed storage, the method further includes: When receiving a backup instruction for backing up data of the first mirror virtual machine, creating a first snapshot of the first mirror virtual machine; Obtaining a second snapshot created by the first mirror virtual machine when completing an adjacent previous backup, and comparing the first snapshot with the second snapshot to determine whether there is incremental data in the first mirror virtual machine; When it is determined that there is incremental data, obtaining backup data according to the first snapshot and the second snapshot, and determining a backup path for the backup data; If the first snapshot is consistent with the second snapshot, determining that there is no incremental data; If the first snapshot is inconsistent with the second snapshot, it is determined that incremental data exists.

6. The method according to claim 4, characterized in that When the data storage type is local storage or shared block storage, after responding to the incremental backup instruction and performing incremental backup processing on the first mirror virtual machine, the method further includes: When it is determined that the incremental backup of the first mirror virtual machine is completed, obtaining a previous data block of the first mirror virtual machine obtained in an adjacent previous backup; The backup data is merged with the previous data block, and the previous data block is updated according to a new data block obtained by the merger.

7. The method according to claim 1, characterized in that When receiving a failover instruction for the second mirror virtual machine, obtaining recovery data for failover processing, and performing failover processing on the second mirror virtual machine according to the recovery data, includes: When receiving a failover instruction for the second mirror virtual machine, identifying a rollback time point included in the failover instruction; Acquire second storage information of storage data corresponding to the second mirror virtual machine, and determine the recovery data to be restored according to the second storage information and the rollback time point; The second virtual machine is controlled to be in a shutdown state, and a failover process is performed on the second mirror virtual machine according to the recovery data.

8. A virtual machine management device based on zstack virtualization environment, characterized in that: include: An initial processing module, for creating a mirror virtual machine corresponding to the virtual machine in a zstack virtualization environment when it is detected that the creation of the virtual machine is completed, and initializing the mirror virtual machine; The incremental backup module is used to perform incremental backup processing on the first virtual machine when receiving a backup instruction to back up data on the first virtual machine; A failover module, configured to, when receiving a failover instruction for a second virtual machine, obtain recovery data for failover processing, and perform failover processing on the second mirror virtual machine according to the recovery data; The fault recovery module is used to start the second virtual machine and shut down the second mirror virtual machine, and perform fault recovery processing on the second virtual machine according to the second mirror virtual machine after data recovery.

9. An electronic device, characterized in that: The electronic device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the steps in the 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 in the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Mirror image backup method and device of virtual machine, fault recovery method and device of virtual machine and electronic equipment

    CN110750325A