Cloud virtual machine recovery method and device
By providing cloud virtual machine recovery methods and devices in a cloud computing environment, the problem of inability to recover after deletion is solved, efficient recovery of cloud virtual machines is achieved, and data security is improved.
Patent Information
- Application Number
- CN202410500823.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-24
- Publication Date
- 2025-05-27
AI Technical Summary
In a cloud computing environment, the deleted cloud virtual machines cannot be recovered, resulting in user data being unable to be retrieved and business losses.
Provides a cloud virtual machine recovery method and device, which obtains target configuration information and cloud hard disk by receiving recovery requests, and completes the recovery operation of the virtual machine using the virtual machine recovery instruction template.
It realizes efficient and reliable recovery of cloud virtual machines, improves the security of user data, and reduces business losses.
Smart Images

Figure CN120045272A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and in particular, to a method and device for restoring cloud virtual machines. Background Art
[0002] In the field of cloud computing, a cloud virtual machine (also known as an elastic cloud server) is not a real entity. Through virtualization technology, a large number of physical servers can be virtualized into multiple cloud virtual machines, and the number of CPUs, memory size, hard disk size, bandwidth resources, IP resources, etc. required by the virtual machine can be freely customized according to needs.
[0003] In a cloud computing environment, a tenant will create and use a cloud virtual machine according to usage requirements. After use or when a project ends, the cloud virtual machine is often deleted. When forced deletion is selected, or when the cloud platform does not have a function similar to a recycle bin, the virtual machine cannot be restored. In this case, the cloud platform usually does not support the restoration operation, and user data cannot be retrieved, which is likely to cause certain business losses. Summary of the Invention
[0004] In view of at least one problem in the prior art, this application proposes a method and device for restoring cloud virtual machines, which can realize the restoration of cloud virtual machines, and the restoration process is efficient and reliable, thereby improving the security of user data.
[0005] To solve the above technical problems, this application provides the following technical solutions:
[0006] In a first aspect, this application provides a method for restoring a cloud virtual machine, including:
[0007] Receiving a restoration request corresponding to a cloud virtual machine to be restored, where the cloud virtual machine to be restored has been deleted, and the cloud hard disk corresponding to the cloud virtual machine to be restored is stored in a specified directory;
[0008] Obtaining target configuration information of the cloud virtual machine to be restored according to a preset configuration information table and the restoration request, where the preset configuration information table includes: configuration information of multiple cloud virtual machines;
[0009] Completing the restoration operation of the cloud virtual machine to be restored according to a preset virtual machine restoration instruction template, the target configuration information, and the cloud hard disk.
[0010] In one embodiment, the step of completing the restoration operation of the cloud virtual machine to be restored according to a preset virtual machine restoration instruction template, the target configuration information, and the cloud hard disk includes:
[0011] Filling the target configuration information into the preset virtual machine restoration instruction template to obtain a virtual machine restoration instruction corresponding to the cloud virtual machine to be restored;
[0012] Execute the virtual machine recovery instruction, create a new virtual machine, and bind both the configuration information and the cloud hard disk to the new virtual machine to complete the recovery operation of the cloud virtual machine to be recovered.
[0013] In one embodiment, before receiving the recovery request corresponding to the cloud virtual machine to be recovered, it further includes:
[0014] Receive the deletion request of the cloud virtual machine to be recovered;
[0015] According to the deletion request, delete the cloud virtual machine to be recovered and retain the cloud hard disk corresponding to the cloud virtual machine to be recovered.
[0016] In one embodiment, before deleting the cloud virtual machine to be recovered and retaining the cloud hard disk corresponding to the cloud virtual machine to be recovered according to the deletion request, it further includes:
[0017] Regularly obtain the target configuration information of the cloud virtual machine to be recovered and store the target configuration information in the preset configuration information table;
[0018] Wherein, the target configuration information includes: the unique identifier of the cloud virtual machine, virtual machine name, specification, subnet, Internet protocol address, and cloud hard disk information.
[0019] In one embodiment, the cloud virtual machine recovery method further includes:
[0020] Receive a cloud hard disk setting request;
[0021] According to the cloud hard disk setting request, set the retention duration of the cloud hard disk.
[0022] In one embodiment, receiving the recovery request corresponding to the cloud virtual machine to be recovered includes:
[0023] Receive the recovery request sent by the user through the front end, and the recovery request is a virtual machine restoration command including the unique identifier of the cloud virtual machine to be recovered.
[0024] In one embodiment, after completing the recovery operation of the cloud virtual machine to be recovered, it further includes:
[0025] Obtain the current unique identifier of the cloud virtual machine to be recovered, and according to the current unique identifier of the cloud virtual machine to be recovered, query whether the current state of the cloud virtual machine to be recovered is the active state. If so, determine that the recovery verification of the cloud virtual machine to be recovered passes.
[0026] In a second aspect, the present application provides a cloud virtual machine recovery device, including:
[0027] A first receiving module, configured to receive a recovery request corresponding to a cloud virtual machine to be recovered, where the cloud virtual machine to be recovered has been deleted, and the cloud hard disk corresponding to the cloud virtual machine to be recovered is stored in a specified directory;
[0028] An obtaining module, configured to obtain target configuration information of the cloud virtual machine to be recovered according to a preset configuration information table and the recovery request, where the preset configuration information table includes: configuration information of multiple cloud virtual machines;
[0029] A recovery module, configured to complete the recovery operation of the cloud virtual machine to be recovered according to a preset virtual machine recovery instruction template, the target configuration information, and the cloud hard disk.
[0030] In one embodiment, the recovery module includes:
[0031] An adding unit, configured to fill the target configuration information into the preset virtual machine recovery instruction template to obtain a virtual machine recovery instruction corresponding to the cloud virtual machine to be recovered;
[0032] An executing unit, configured to execute the virtual machine recovery instruction, create a new virtual machine, and bind both the configuration information and the cloud hard disk to the new virtual machine to complete the recovery operation of the cloud virtual machine to be recovered.
[0033] In one embodiment, the cloud virtual machine recovery device further includes:
[0034] A second receiving module, configured to receive a deletion request for the cloud virtual machine to be recovered;
[0035] A deletion module, configured to delete the cloud virtual machine to be recovered according to the deletion request and retain the cloud hard disk corresponding to the cloud virtual machine to be recovered.
[0036] In one embodiment, the cloud virtual machine recovery device further includes:
[0037] A timing module, configured to periodically obtain the target configuration information of the cloud virtual machine to be recovered and store the target configuration information in the preset configuration information table;
[0038] Wherein, the target configuration information includes: a unique identifier of the cloud virtual machine, a virtual machine name, a specification, a subnet, an Internet protocol address, and cloud hard disk information.
[0039] In one embodiment, the cloud virtual machine recovery device further includes:
[0040] A third receiving module, configured to receive a cloud hard disk setting request;
[0041] A setting module, configured to set a retention duration of the cloud hard disk according to the cloud hard disk setting request.
[0042] In one embodiment, the first receiving module includes:
[0043] A receiving unit, configured to receive the restoration request sent by the user through the front end, where the restoration request is a virtual machine restoration command including the unique identifier of the cloud virtual machine to be restored.
[0044] In one embodiment, the cloud virtual machine restoration device further includes:
[0045] A verification module, configured to obtain the current unique identifier of the cloud virtual machine to be restored, and query whether the current state of the cloud virtual machine to be restored is an active state according to the current unique identifier of the cloud virtual machine to be restored. If so, it is determined that the restoration verification of the cloud virtual machine to be restored passes.
[0046] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the cloud virtual machine restoration method is implemented.
[0047] In a fourth aspect, the present application provides a computer-readable storage medium, on which computer instructions are stored. When the instructions are executed by a processor, the cloud virtual machine restoration method is implemented.
[0048] As can be seen from the above technical solutions, the present application provides a method and apparatus for restoring a cloud virtual machine. Among them, the method includes: receiving a restoration request corresponding to the cloud virtual machine to be restored, where the cloud virtual machine to be restored has been deleted, and the cloud hard disk corresponding to the cloud virtual machine to be restored is stored in a specified directory; obtaining target configuration information of the cloud virtual machine to be restored according to a preset configuration information table and the restoration request, where the preset configuration information table includes configuration information of multiple cloud virtual machines; completing the restoration operation of the cloud virtual machine to be restored according to a preset virtual machine restoration instruction template, the target configuration information, and the cloud hard disk, which can realize the restoration of the cloud virtual machine, and the restoration process is efficient and reliable, thereby improving the security of user data; specifically, this solution can solve the problem that the virtual machine cannot be restored after being accidentally deleted under the cloud platform. Existing cloud platforms do not provide a recoverable function after forced recycling, and the virtual machine can be quickly restored through a simple method; two methods of page operation and manual restoration can be adopted, which are applicable to different scenarios; an automatic restoration tool can be formed, and the configuration files of all virtual machines can be regularly backed up through a scheduled task, and the restoration operation of the virtual machine can be realized by executing a command; by analyzing the composition of the cloud virtual machine and using the technical characteristics that the cloud hard disk can be retrieved, the virtual CPU, virtual memory, and virtual network card are rebuilt, and the virtual machine configuration file is reconstructed to gather the required configuration information; there is no need to invade and modify the source open-source products, such as open-source cloud platforms, and the command-line interface of the open-source products can be called to realize the encapsulation and combination of a series of command operations, achieving the purpose of rebuilding the accidentally deleted virtual machine and ensuring the reliability of the cloud platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0050] Figure 1 is the first flowchart of the cloud virtual machine restoration method in the embodiment of the present application;
[0051] Figure 2 is a schematic diagram of the composition of a cloud virtual machine in the prior art;
[0052] Figure 3 is the second flowchart of the cloud virtual machine restoration method in the embodiment of the present application;
[0053] Figure 4 is the third flowchart of the cloud virtual machine restoration method in the embodiment of the present application;
[0054] Figure 5It is a schematic structural diagram of the cloud virtual machine recovery device in the embodiments of the present application;
[0055] Figure 6 It is a schematic block diagram of the system composition of the electronic device in the embodiments of the present application. Specific embodiments
[0056] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0057] The information collected in the technical solutions of the present application is information and data authorized by the user or fully authorized by all parties. And the processing of relevant data such as collection, storage, use, processing, transmission, provision, disclosure and application complies with the relevant laws, regulations and standards of relevant countries and regions, takes necessary confidentiality measures, does not violate public order and good customs, and provides corresponding operation entrances for users to choose to authorize or refuse. The present application provides corresponding operation entrances for users to choose to agree or refuse the automated decision-making results; if the user chooses to refuse, the expert decision-making process will be entered.
[0058] Currently, in the actual deletion operation, there will be some misoperation situations, where virtual machines that should not be deleted are cleared, resulting in business losses. In some products at the cloud computing level, a recycle bin mechanism is provided. Generally, virtual machines deleted within a certain period can be restored in the recycle bin, similar to the regret mechanism of the Windows Recycle Bin. Some cloud products do not provide this function. In actual operation, it is also possible to configure not to use the recycle bin mechanism, or the user chooses to force deletion, resulting in the inability to restore the virtual machine.
[0059] Considering that in the existing cloud platforms, it is possible to configure not to delete the cloud hard disk when deleting the cloud virtual machine, or configure a retention period for the cloud hard disk after deletion in the storage cluster, so that the cloud hard disk will not be directly deleted immediately, which can provide a technical premise for the recovery of the cloud virtual machine. The embodiments of the present application provide a cloud virtual machine recovery method and device, which can, on the premise that the cloud hard disk storing business data is not actually deleted, re-associate the configuration associations of various virtual devices by reconstructing the virtual machine configuration, and realize the function of reconstructing and restoring the cloud virtual machine after deletion. Retrieving business data can reduce the losses of enterprises and save the cost of reconstructing relevant data.
[0060] It should be noted that the cloud virtual machine recovery method and apparatus disclosed in this application can be used in the financial technology field, and can also be used in any field other than the financial technology field. The application field of the cloud virtual machine recovery method and apparatus disclosed in this application is not limited.
[0061] Specifically, it will be described through the following various embodiments.
[0062] In order to implement the recovery of the cloud virtual machine, and the recovery process is efficient and reliable, and thus the security of user data can be improved. This embodiment provides a cloud virtual machine recovery method whose execution subject is a cloud virtual machine recovery apparatus. The cloud virtual machine recovery apparatus includes but is not limited to a server, such as Figure 1 As shown, the method specifically includes the following content:
[0063] Step 100: Receive a recovery request corresponding to the cloud virtual machine to be recovered. The cloud virtual machine to be recovered has been deleted, and the cloud hard disk corresponding to the cloud virtual machine to be recovered is stored in a specified directory.
[0064] Specifically, the recovery request may include: the unique identifier of the cloud virtual machine to be recovered, such as, virtual machine IP or virtual machine ID; the specified directory can be set according to actual needs. The cloud hard disk can be pre-stored at a specified location. When deleting the cloud virtual machine to be recovered, the cloud hard disk is retained.
[0065] Specifically, such as Figure 2 As shown, a cloud virtual machine can be composed of a virtual machine configuration file, a virtualized CPU, a virtualized memory, a cloud hard disk, and a virtualized network card, etc. Among them, the cloud hard disk is often provided by a distributed block storage cluster. It is a part of the storage space logically constructed in the cluster and is used to install the system or store data for the virtual machine. The cloud hard disk can be retrieved; the virtualized CPU, virtualized memory, and virtualized network card can be rebuilt; the virtual machine configuration file can be reconfigured.
[0066] Step 200: Obtain the target configuration information of the cloud virtual machine to be recovered according to a preset configuration information table and the recovery request. The preset configuration information table includes: the configuration information of multiple cloud virtual machines.
[0067] Specifically, the preset configuration information table includes: multiple records, each record including: the configuration information of the cloud virtual machine; the unique identifiers of the cloud virtual machines corresponding to each record are different. The record corresponding to the unique identifier of the cloud virtual machine to be restored in the recovery request can be obtained from the preset configuration information table, and the configuration information in this record is determined as the target configuration information. The configuration information may include: the unique identifier of the cloud virtual machine, the virtual machine name "name", the specification "flavor", the subnet "network", the IP address, and the cloud disk "volume" information. The preset configuration information table can be stored locally in the cloud virtual machine recovery device.
[0068] Step 300: According to the preset virtual machine recovery instruction template for the application, the target configuration information, and the cloud disk, complete the recovery operation of the cloud virtual machine to be restored.
[0069] Specifically, the preset virtual machine recovery instruction template can be as shown in Table 1:
[0070] Table 1
[0071]
[0072] Among them, "nova boot" can represent creating a virtual machine, the "flavor" parameter specifies the specification ID of the virtual machine, the "nic" parameter specifies the subnet ID and IP address of the virtual machine, the "block-device" parameter specifies the cloud disk ID of the virtual machine, and the "name" parameter specifies the virtual machine name.
[0073] Furthermore, the recovery request may further include: the configuration information of the cloud virtual machine to be restored; after step 100, it further includes: creating a new cloud virtual machine, binding the new cloud virtual machine to the host name, operating system version, IP address, etc. in the configuration information, and binding a new cloud disk to the new cloud virtual machine; after the old cloud disk of the cloud virtual machine to be restored is restored, replacing the new cloud disk with the old cloud disk and re-specifying the cloud disk name.
[0074] To improve the automation level and efficiency of virtual machine recovery, as Figure 3 shown, in one embodiment, step 300 includes:
[0075] Step 301: Fill the target configuration information into the preset virtual machine recovery instruction template to obtain the virtual machine recovery instruction corresponding to the cloud virtual machine to be restored.
[0076] For example, assume that the specification id in the target configuration information is "7ff11a07-c9f3-46a2-90ae-14189625ea8d", the subnet id is "e4071f52-4483-4f27-bbe7-d312cde17a5*", the IP address is "83.236.81.23*", the cloud disk ids are "61b82cab-4972-429a-85a1-79e6d63c56dc" and "99ef2ad2-45bf-40de-b6bb-f7bcf7d164f7", and the virtual machine name is "paas180515l15". Then, filling the target configuration information into the preset virtual machine recovery instruction template can obtain the virtual machine recovery instruction shown in Table 2.
[0077] Table 2
[0078]
[0079] Step 302: Execute the virtual machine recovery instruction, create a new virtual machine, and bind both the configuration information and the cloud disk to the new virtual machine to complete the recovery operation of the cloud virtual machine to be recovered.
[0080] Specifically, the new virtual machine after binding is the cloud virtual machine to be recovered after recovery. This solution can encapsulate and combine a series of command operations by calling the command-line interface of the open-source cloud platform to achieve the purpose of reconstructing a mistakenly deleted virtual machine. Without making invasive modifications to the original open-source cloud platform, it can support reconstruction regardless of whether the original virtual machine has only one boot volume or multiple data volumes.
[0081] To ensure the recovery of the cloud virtual machine and improve the reliability of cloud virtual machine recovery, in one embodiment, before step 100, it further includes:
[0082] Step 001: Receive the deletion request of the cloud virtual machine to be recovered.
[0083] Step 002: According to the deletion request, delete the cloud virtual machine to be recovered and retain the cloud disk corresponding to the cloud virtual machine to be recovered.
[0084] To improve the reliability of obtaining the target configuration information, in one embodiment, before step 002, it further includes: regularly obtaining the target configuration information of the cloud virtual machine to be recovered and storing the target configuration information in the preset configuration information table; where the target configuration information includes: the unique identifier of the cloud virtual machine, the virtual machine name, the specification, the subnet, the Internet protocol address, and the cloud disk information.
[0085] Specifically, the target configuration information may be the configuration information of the cloud virtual machine to be restored; after obtaining the latest target configuration information of the cloud virtual machine to be restored, the target configuration information in the preset configuration information table may be logically deleted, and the latest target configuration information may be added to the preset configuration information table. After receiving the restoration request corresponding to the cloud virtual machine to be restored, the latest target configuration information may be determined as the target configuration information of the cloud virtual machine to be restored; further, the configuration files of all virtual machines may be regularly backed up and stored in the specified directory, that is, the above-mentioned specified directory, and the configuration files of the deleted virtual machines may also be saved in this directory.
[0086] In order to improve the reliability of setting the retention duration of the cloud disk, in one embodiment, step 002 further includes:
[0087] Step 021: Receive a cloud disk setting request.
[0088] Specifically, the cloud disk setting request may include: the duration that the cloud disk is expected to be retained. The deletion time limit of the cloud disk may be configured in the cloud storage management cluster or the cloud platform management page.
[0089] Step 022: Set the retention duration of the cloud disk according to the cloud disk setting request.
[0090] Specifically, the retention duration is set to the duration that the cloud disk is expected to be retained in the cloud disk setting request. Preferably, the retention duration is 1-7 days, and the retention duration does not exceed 30 days.
[0091] In order to improve the convenience of virtual machine restoration, as Figure 4 shown, in one embodiment, step 100 includes:
[0092] Step 101: Receive the restoration request sent by the user through the front end. The restoration request is a virtual machine restoration command containing the unique identifier of the cloud virtual machine to be restored.
[0093] Specifically, by encapsulating the logic of configuration information backup and virtual machine retrieval, the user only needs to execute a simple command restoreVM.sh plus a virtual machine IP or virtual machine ID at the front end to regenerate the entity of the virtual machine. More than a dozen operation steps are combined into one, and the user does not need to understand the relevant system architecture and principles. The virtual machine restoration command containing the unique identifier of the cloud virtual machine to be restored may be: restoreVM.sh83.236.81.23*.
[0094] In order to improve the reliability of virtual machine restoration, in one embodiment, after step 300, it further includes:
[0095] Obtain the current unique identifier of the cloud virtual machine to be restored. According to the current unique identifier of the cloud virtual machine to be restored, query whether the current state of the cloud virtual machine to be restored is the active state. If so, determine that the restoration verification of the cloud virtual machine to be restored passes.
[0096] Specifically, the ID of the restored cloud virtual machine to be restored has changed. For example, d6f9b655-a4ca-4bd1-b04b-b0ae85cc21d*. At the beginning, the state is building. After waiting for 1-3 minutes, the creation is completed. Use the query command nova show d6f9b655-a4ca-4bd1-b04b-b0ae85cc21d9 to query the current state of the cloud virtual machine to be restored. If it changes to the active state, that is, the active state, it is determined that the restoration verification of the cloud virtual machine to be restored passes. The cloud virtual machine to be restored can be used normally, and the data on the system is still the original data.
[0097] To further illustrate this solution, the present application provides an application example of a cloud virtual machine restoration method. In this application example, on an open-source cloud computing platform or a secondary development platform based on this, by operating on the underlying control node and using the command line method, the virtual machine is restored and rebuilt. Various configuration information of the deleted virtual machine is recorded in advance, and the specific description is as follows:
[0098] Step 1: Back up the configuration information of the cloud virtual machine.
[0099] Specifically, the command nova show a75dd686-7a8c-433f-8f27-7195cef9a000 can be executed to view the configuration information of the cloud virtual machine. The ID of the cloud virtual machine is a75dd686-7a8c-433f-8f27-7195cef9a000. The configuration information includes: the hostname of the virtual machine, the IP address, the name of the physical machine to which it belongs, the virtual machine ID, and the associated cloud disk information, etc. Only the cloud disk retains the real business information, and the rest of the configuration information can be rebuilt. The unique identifier of the virtual machine is the virtual machine ID, which is used for various operations at the bottom layer. After restoration and reconstruction, this ID will change, but it does not affect the business use. The information of the virtual machine name name, specification flavor, subnet network, IP address, and cloud disk volume is formed into parameter group 1. Among them, there may be multiple IDs for the cloud disk volume corresponding to multiple cloud disks. Generally, the first one is the system disk, and the others are data disks. In an example, parameter group 1 is shown in Table 3 below:
[0100] Table 3
[0101]
[0102] It is possible to perform a full backup of the cloud virtual machine configuration. Execute the command: nova list--all_te|grep instance|awk'{print$2}'to obtain the virtual machine IDs of all full - volume virtual machines, that is, the IDs of all cloud virtual machines on the cloud platform currently can be obtained. The storage command can be executed to save this output information to the local configuration file / tmp / vm.list, and then by traversing and querying the configuration files of each virtual machine ID one by one, the configuration files of all virtual machines can be obtained and saved to the specified directory. This configuration file can be equivalent to the above - mentioned configuration information. The storage command is shown in Table 4:
[0103] Table 4
[0104]
[0105] The specified directory stores the configuration information of each virtual machine file. By executing it regularly, the configuration information can be refreshed in a timely manner. The configuration of virtual machines that have been deleted will also be saved in this directory. Since the configuration information is all text, the configuration file of a single virtual machine is approximately 2KB - 3KB, and the storage capacity requirement is not large. For an environment with tens of thousands of virtual machine nodes, the storage capacity of the configuration information can be controlled within 1GB, and the overhead is very small. Through the regular local backup of the configuration information, when a virtual machine is accidentally deleted and needs to be restored, the virtual machine can be restored by simply executing the tool command restoreVM.sh with the parameter of the virtual machine IP or virtual machine ID, and the original virtual machine can be restored and accessed again within a few minutes.
[0106] By the command: cinder list--all_te|grep a75dd686 - 7a8c - 433f - 8f27 - 7195cef9a000, check the disk information mapped by this virtual machine. It can be found that there are two cloud hard disks with IDs 61b82cab - 4972 - 429a - 85a1 - 79e6d63c56dc and 99ef2ad2 - 45bf - 40de - b6bb - f7bcf7d164f7. When the virtual machine is in a normal state, the cloud hard disks are in the in - use state.
[0107] Step 2: Execute the deletion operation of the cloud virtual machine.
[0108] Specifically, after the deletion operation occurs, it can be checked through the nova show command that the virtual machine ID no longer exists. The nova show command is as follows:
[0109] [root@tdccbap01ctl004~]#nova show a75dd686 - 7a8c - 433f - 8f27 - 7195cef9a000
[0110] ERROR(CommandError): No server with a name or ID of 'a75dd686-7a8c-433f-8f27-7195cef9a000' exists.
[0111] Check the mapping relationship of the cloud disk. The cloud disk volume still exists, and its status has changed from the in-use state to the available state. However, the mapping relationship with the cloud virtual machine no longer exists. At this time, the virtual machine has been deleted, but the cloud disk still exists and the data is still there, which is the prerequisite for virtual machine recovery.
[0112] Step 3: Recover the cloud virtual machine.
[0113] Specifically, creating a virtual machine requires information such as the virtual machine name name, specification id, subnet id, ip, hard disk id, etc.; the virtual machine name corresponds to the name in parameter group 1, the specification id corresponds to the id value after flavor in parameter group 1. The subnet needs to use the network in parameter group 1 to query the subnet id. The ip corresponds to the ip in parameter group 1, and the cloud disk corresponds to the voluems information in parameter group 1, which may be a string or an array of strings. Use the neutron net-list command to query the subnet id and record the first returned id value e4071f52-4483-4f27-bbe7-d312cde17a** as the subnet id.
[0114] Using the nova boot method and adding certain parameter information, the cloud virtual machine can be rebuilt. The virtual machine recovery instruction template is shown in Table 1. Use the information collected in the previous check to fill in the command parameters. After filling, the virtual machine recovery instruction shown in Table 2 is obtained. After execution, a new virtual machine will be created, using the original hard disk, and the configuration will also be the same as before.
[0115] The id of the rebuilt cloud virtual machine has become d6f9b655-a4ca-4bd1-b04b-b0ae85cc21d9. At the beginning, the status is building. After 1 - 3 minutes, the creation is completed. Use the command: nova show d6f9b655-a4ca-4bd1-b04b-b0ae85cc21d9 to query. If the query shows that it has become the normal active state, the recovery operation is completed at this time, and the cloud virtual machine can be used normally, and the data on the system is still the original data.
[0116] After step 2, an empty virtual machine can also be created on the cloud platform. For the newly created virtual machine, the system configuration (hostname, operating system version, IP address, etc.) needs to be the same as that of the original virtual machine. For the cloud hard disk, a new one is selected (for temporary use and will be replaced by the old hard disk later). After the old cloud hard disk (volume) is restored through the storage cluster, a new name for the cloud hard disk is re-specified. This name can be different from the name of the original cloud hard disk. Just record the name or uuid information of the new cloud hard disk. After the new cloud virtual machine is created, it can be directly shut down, and then the cloud hard disk replacement operation is carried out. Unmount and delete the cloud hard disk of the new cloud virtual machine, mount the original old cloud hard disk to the new virtual machine, and then restart the cloud virtual machine. Then it can be accessed using the original IP address, and the original user data and directory structure still exist.
[0117] As can be seen from the above description, this application example can achieve the recovery after the deletion of the cloud virtual machine, quickly retrieve the original data simply, and reduce the losses of enterprises. The configuration information of all virtual machines can be collected regularly in the form of a scheduled task, saved in the form of static text or a database, forming a meta-database of virtual machine configuration information, and updated and completed through a regular mechanism. When it is necessary to quickly retrieve after the virtual machine deletion operation occurs, the key parameters are extracted using the saved configuration information, and then a quick recovery is implemented.
[0118] At the software level, in order to achieve the recovery of the cloud virtual machine, and the recovery process is efficient and reliable, and further improve the security of user data, this application provides an embodiment of a cloud virtual machine recovery device for implementing all or part of the content in the cloud virtual machine recovery method. See Figure 5 , the cloud virtual machine recovery device specifically includes the following content:
[0119] The first receiving module 01 is used to receive a recovery request corresponding to the cloud virtual machine to be recovered. The cloud virtual machine to be recovered has been deleted, and the cloud hard disk corresponding to the cloud virtual machine to be recovered is stored in a specified directory;
[0120] The obtaining module 02 is used to obtain the target configuration information of the cloud virtual machine to be recovered according to a preset configuration information table and the recovery request. The preset configuration information table includes: the configuration information of multiple cloud virtual machines;
[0121] The recovery module 03 is used to complete the recovery operation of the cloud virtual machine to be recovered according to a preset virtual machine recovery instruction template, the target configuration information, and the cloud hard disk.
[0122] In one embodiment, the recovery module includes:
[0123] An adding unit, configured to fill the target configuration information into the preset virtual machine recovery instruction template to obtain a virtual machine recovery instruction corresponding to the cloud virtual machine to be recovered;
[0124] An execution unit, configured to execute the virtual machine recovery instruction, create a new virtual machine, and bind both the configuration information and the cloud hard disk to the new virtual machine, so as to complete the recovery operation of the cloud virtual machine to be recovered.
[0125] In one embodiment, the cloud virtual machine recovery device further includes:
[0126] A second receiving module, configured to receive a deletion request of the cloud virtual machine to be recovered;
[0127] A deletion module, configured to delete the cloud virtual machine to be recovered according to the deletion request and retain the cloud hard disk corresponding to the cloud virtual machine to be recovered.
[0128] In one embodiment, the cloud virtual machine recovery device further includes:
[0129] A timing module, configured to periodically obtain the target configuration information of the cloud virtual machine to be recovered and store the target configuration information into the preset configuration information table;
[0130] Wherein, the target configuration information includes: the unique identifier of the cloud virtual machine, the virtual machine name, the specification, the subnet, the Internet protocol address, and the cloud hard disk information.
[0131] In one embodiment, the cloud virtual machine recovery device further includes:
[0132] A third receiving module, configured to receive a cloud hard disk setting request;
[0133] A setting module, configured to set the retention duration of the cloud hard disk according to the cloud hard disk setting request.
[0134] In one embodiment, the first receiving module includes:
[0135] A receiving unit, configured to receive the recovery request sent by the user through the front end, where the recovery request is a virtual machine restoration command including the unique identifier of the cloud virtual machine to be recovered.
[0136] In one embodiment, the cloud virtual machine recovery device further includes:
[0137] A verification module, configured to obtain the current unique identifier of the cloud virtual machine to be recovered, and query whether the current state of the cloud virtual machine to be recovered is an active state according to the current unique identifier of the cloud virtual machine to be recovered. If so, it is determined that the recovery verification of the cloud virtual machine to be recovered passes.
[0138] The embodiments of the cloud virtual machine recovery device provided in this specification can be specifically used to execute the processing procedures of the embodiments of the above cloud virtual machine recovery method. The functions thereof will not be elaborated herein, and reference can be made to the detailed description of the embodiments of the above cloud virtual machine recovery method.
[0139] Figure 6 FIG. is a schematic structural diagram of an electronic device entity provided by an embodiment of the present invention. As Figure 6 shown, the electronic device includes: a memory 601, a processor 602, and a computer program stored on the memory 601 and executable on the processor 602. When the processor 602 executes the computer program, the following method is implemented:
[0140] Receiving a recovery request corresponding to a cloud virtual machine to be recovered, where the cloud virtual machine to be recovered has been deleted, and the cloud hard disk corresponding to the cloud virtual machine to be recovered is stored in a specified directory;
[0141] Obtaining target configuration information of the cloud virtual machine to be recovered according to a preset configuration information table and the recovery request, where the preset configuration information table includes: configuration information of multiple cloud virtual machines;
[0142] Completing the recovery operation of the cloud virtual machine to be recovered according to a preset virtual machine recovery instruction template, the target configuration information, and the cloud hard disk.
[0143] This embodiment provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the following method is implemented:
[0144] Receiving a recovery request corresponding to a cloud virtual machine to be recovered, where the cloud virtual machine to be recovered has been deleted, and the cloud hard disk corresponding to the cloud virtual machine to be recovered is stored in a specified directory;
[0145] Obtaining target configuration information of the cloud virtual machine to be recovered according to a preset configuration information table and the recovery request, where the preset configuration information table includes: configuration information of multiple cloud virtual machines;
[0146] Completing the recovery operation of the cloud virtual machine to be recovered according to a preset virtual machine recovery instruction template, the target configuration information, and the cloud hard disk.
[0147] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0148] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in one Figure 1 flow or multiple flows and / or blocks Figure 1 block or multiple blocks.
[0149] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufacture including instruction means that implement the functions specified in one Figure 1 flow or multiple flows and / or blocks Figure 1 block or multiple blocks.
[0150] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 flow or multiple flows and / or blocks Figure 1 block or multiple blocks.
[0151] In the description of this specification, the description with reference to terms such as "one embodiment", "a specific embodiment", "some embodiments", "for example", "example", "specific example", or "some examples", etc. means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0152] The specific embodiments described above further elaborate on the object, technical solution, and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A cloud virtual machine recovery method, characterized in that: include: Receiving a recovery request corresponding to a cloud virtual machine to be recovered, the cloud virtual machine to be recovered has been deleted, and a cloud hard disk corresponding to the cloud virtual machine to be recovered is stored in a specified directory; According to a preset configuration information table and the recovery request, target configuration information of the cloud virtual machine to be recovered is obtained, wherein the preset configuration information table includes: configuration information of multiple cloud virtual machines; The recovery operation of the cloud virtual machine to be restored is completed according to the virtual machine recovery instruction template preset by the application, the target configuration information and the cloud hard disk.
2. The cloud virtual machine recovery method according to claim 1, characterized in that: The step of completing the recovery operation of the cloud virtual machine to be recovered according to the preset virtual machine recovery instruction template, the target configuration information and the cloud hard disk includes: Filling the target configuration information into the preset virtual machine recovery instruction template to obtain the virtual machine recovery instruction corresponding to the cloud virtual machine to be recovered; The virtual machine recovery instruction is executed to create a new virtual machine and bind the configuration information and the cloud hard disk to the new virtual machine, thereby completing the recovery operation of the cloud virtual machine to be restored.
3. The cloud virtual machine recovery method according to claim 1, characterized in that: Before receiving the recovery request corresponding to the cloud virtual machine to be recovered, the method further includes: Receiving a deletion request for the cloud virtual machine to be restored; According to the deletion request, the cloud virtual machine to be restored is deleted and the cloud hard disk corresponding to the cloud virtual machine to be restored is retained.
4. The cloud virtual machine recovery method according to claim 3, characterized in that: Before deleting the cloud virtual machine to be restored according to the deletion request and retaining the cloud hard disk corresponding to the cloud virtual machine to be restored, the method further includes: Periodically obtaining target configuration information of the cloud virtual machine to be restored and storing the target configuration information in the preset configuration information table; The target configuration information includes: a unique identifier of the cloud virtual machine, a virtual machine name, specifications, a subnet, an Internet Protocol address, and cloud hard disk information.
5. The cloud virtual machine recovery method according to claim 1, characterized in that: Also includes: Receive a cloud disk configuration request; According to the cloud hard disk setting request, a retention period of the cloud hard disk is set.
6. The cloud virtual machine recovery method according to claim 1, characterized in that: The receiving a recovery request corresponding to the cloud virtual machine to be recovered includes: The recovery request sent by the user through the front end is received, where the recovery request is a virtual machine recovery command including a unique identifier of the cloud virtual machine to be recovered.
7. The cloud virtual machine recovery method according to claim 1, characterized in that: After the recovery operation of the cloud virtual machine to be recovered is completed, the method further includes: Obtain the current unique identifier of the cloud virtual machine to be restored, and query whether the current state of the cloud virtual machine to be restored is active based on the current unique identifier of the cloud virtual machine to be restored. If so, determine that the recovery verification of the cloud virtual machine to be restored has passed.
8. A cloud virtual machine recovery device, characterized in that: include: A receiving module, configured to receive a recovery request corresponding to a cloud virtual machine to be recovered, where the cloud virtual machine to be recovered has been deleted and a cloud hard disk corresponding to the cloud virtual machine to be recovered is stored in a specified directory; An acquisition module, configured to acquire target configuration information of the cloud virtual machine to be restored according to a preset configuration information table and the restoration request, wherein the preset configuration information table includes: configuration information of multiple cloud virtual machines; The recovery module is used to complete the recovery operation of the cloud virtual machine to be recovered according to the virtual machine recovery instruction template preset by the application, the target configuration information and the cloud hard disk.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the cloud virtual machine recovery method described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instructions are executed by the processor, the cloud virtual machine recovery method described in any one of claims 1 to 7 is implemented.