Virtual machine management method, device, equipment and storage medium

By using key-value databases and directed graph splitting task execution mechanisms in virtual machine management, the message accumulation problem caused by the concurrency in requests in virtual machine management is solved, efficiency and reliability are improved, and management process is simplified.

CN114510317BActive Publication Date: 2024-11-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111598340.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2024-11-26
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

When managing virtual machines, the use of existing computing modules (nova) leads to an increase in the amount of request concurrency, resulting in a large number of messages accumulated, and reduces the efficiency of virtual machine management.

Method used

Receive virtual machine management requests through the application programming interface API, generate corresponding virtual machine management tasks, and store them in the key-value database in the form of key-value. The application engine splits tasks into jobs, builds directed graphs, and executes the machine. Execute tasks based on graph node information, and the results are stored in key-value mode to ensure parallel execution and status updates.

Benefits of technology

Improve the efficiency and reliability of virtual machine management, reduce complexity, and realize a simple virtual machine management process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114510317B_ABST
    Figure CN114510317B_ABST
Patent Text Reader

Abstract

The present invention discloses a virtual machine management method, device, equipment and storage medium, the method comprising: an API receives a virtual machine management request, generates a corresponding virtual machine management task, and stores the virtual machine management task in a key-value database in a key-value manner; when an application engine monitors a virtual machine management task from a key-value database, the virtual machine management task is split into one or more jobs according to a set configuration file, a directed graph is constructed according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and the directed graph node information is stored in the key-value database in a key-value manner; when an application executor monitors a first job that needs to be executed by itself in the directed graph node information from the key-value database, the first job is executed to obtain a first execution result, and the first execution result is stored in the key-value database in a key-value manner. Therefore, the present invention improves the efficiency of virtual machine management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing technology, and in particular to a virtual machine management method, device, equipment and storage medium. Background Art

[0002] With the continuous development of cloud computing business scenarios and business scale, the scale of cloud computing data centers is getting larger and larger, and the requirements for cloud platform system performance are getting higher and higher. Among them, the computing module (nova), as the most important module of the cloud platform, generally includes application programming interface (Application Programming Interface, API), computing (Compute), scheduling (Scheduler), conductor (management), database and other sub-modules.

[0003] Currently, the various sub-modules in the computing module (nova) need to rely on databases and message queues for communication. At the same time, when each request is executed, the computing sub-module may also need to interact with other external modules for data, also through message queues.

[0004] However, when managing virtual machines, if the above computing module (nova) is used, the number of concurrent requests will increase, resulting in a large amount of message accumulation, which reduces the efficiency of virtual machine management. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a virtual machine management method, apparatus, device and storage medium to solve the problem that when managing virtual machines, if a computing module (nova) in the prior art is used, the request concurrency will increase, a large amount of messages will accumulate, and the efficiency of virtual machine management will be reduced.

[0006] According to a first aspect, an embodiment of the present invention provides a virtual machine management method, including:

[0007] The application programming interface API receives a virtual machine management request, generates a corresponding virtual machine management task according to the virtual machine management request, and stores the virtual machine management task in a key-value database in a key-value manner;

[0008] When the application engine monitors the virtual machine management task from the key-value database, the application engine splits the virtual machine management task into one or more jobs according to the set configuration file, builds a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and stores the directed graph node information in the key-value database in a key-value manner;

[0009] If the application executor monitors the first job that needs to be executed by itself in the directed graph node information from the key-value database, it executes the first job, obtains a first execution result, and stores the first execution result in the key-value database in a key-value manner.

[0010] In the implementation manner of the present application, when managing virtual machines, an application engine is used to split the virtual machine management task into one or more jobs, and a directed graph is constructed according to the dependency relationship between the jobs. Each node in the directed graph corresponds to a job, and the directed graph node information is stored in a key-value database in a key-value manner. In this way, for the executor, it does not care which API request the job (job) it executes belongs to, but only cares about the job (job) sent to itself by the engine. It can execute one or even multiple tasks (task) jobs in parallel, thereby improving the efficiency of virtual machine management.

[0011] In combination with the first aspect, in a first implementation of the first aspect, the virtual machine management request includes one or more of a virtual machine creation request, a virtual machine deletion request, a virtual machine migration request, a virtual machine evacuation request, and a virtual machine power on / off request.

[0012] In the implementation manner of the present application, the virtual machine management request may include one management request or multiple management requests, thereby improving the practicality of virtual machine management.

[0013] In combination with the first aspect, in the second implementation of the first aspect, further comprising:

[0014] The application engine monitors the first execution result from the key-value database.

[0015] In the implementation manner of the present application, in addition to issuing jobs, the application engine also needs to monitor the execution status of each executor, thereby ensuring the reliability of virtual machine management.

[0016] In combination with the second implementation of the first aspect, in the third implementation of the first aspect, further comprising:

[0017] If the first execution result is successful execution, the application engine updates the status data corresponding to the first job to successful execution;

[0018] If the first execution result is execution failure, the application engine updates the status data corresponding to the first job to execution failure.

[0019] In the implementation manner of the present application, the application engine updates the status data corresponding to the first job, so that subsequent jobs can use these status data, and during debugging, problems can be located through these status data, thereby improving the efficiency of virtual machine management.

[0020] In combination with the first aspect, in a fourth implementation of the first aspect, the directed graph includes multiple layers of nodes;

[0021] The step of storing the directed graph node information in the key-value database in a key-value manner includes:

[0022] The application engine stores the node information of each layer of nodes in the multi-layer nodes in the key-value database in sequence in a key-value manner according to the node pointing relationship.

[0023] In the implementation manner of the present application, the application engine stores the node information of each layer of nodes in a key-value database in sequence using a key-value format according to the node pointing relationship. In this way, for the executor, it does not care which API request the job it executes belongs to, but only cares about the job sent to itself by the engine. It can execute one or even multiple tasks in parallel, thereby improving the efficiency of virtual machine management.

[0024] In combination with the fourth implementation manner of the first aspect, in the fifth implementation manner of the first aspect, the multi-layer node includes a first-layer node and a second-layer node;

[0025] The step of storing the node information of each layer of nodes in the multi-layer nodes in sequence in the key-value database in a key-value manner according to the node pointing relationship includes:

[0026] The application engine stores the first layer node information in the directed graph in the key-value database in a key-value manner;

[0027] If the second execution result corresponding to the first-layer node information is successful execution, the application engine stores the second-layer node information in the directed graph in the key-value database in a key-value manner;

[0028] If the second execution result is execution failure, the application engine no longer stores the second-layer node information in the key-value database.

[0029] In the implementation manner of the present application, only when the execution is successful can the node information of the next layer of nodes be stored in the key-value database in a key-value manner, thereby improving the reliability of virtual machine management.

[0030] In combination with the first aspect, in the sixth implementation of the first aspect, the key-value database is an Etcd database.

[0031] In the implementation manner of the present application, a lightweight distributed key-value database such as Etcd is used to manage virtual machines, which reduces the complexity of virtual machine management, simplifies implementation, and improves the efficiency of virtual machine management.

[0032] According to a second aspect, an embodiment of the present invention provides a virtual machine management device, including:

[0033] An application programming interface API module is used to receive a virtual machine management request, generate a corresponding virtual machine management task according to the virtual machine management request, and store the virtual machine management task in a key-value database in a key-value manner;

[0034] The application engine module is used for, when the virtual machine management task is monitored from the key-value database, splitting the virtual machine management task into one or more jobs according to the set configuration file, constructing a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and storing the directed graph node information in the key-value database in a key-value manner;

[0035] The application executor module is used to execute the first job that needs to be executed by itself in the directed graph node information monitored from the key-value database, obtain the first execution result, and store the first execution result in the key-value database in a key-value manner.

[0036] In combination with the second aspect, in a first implementation of the second aspect, the virtual machine management request includes one or more of a virtual machine creation request, a virtual machine deletion request, a virtual machine migration request, a virtual machine evacuation request, and a virtual machine power on / off request.

[0037] In conjunction with the second aspect, in a second implementation of the second aspect, the application engine module is further used for:

[0038] The application engine monitors the first execution result from the key-value database.

[0039] In combination with the second implementation of the second aspect, in a third implementation of the second aspect, the application engine module is further used for:

[0040] If the first execution result is successful execution, the application engine updates the status data corresponding to the first job to successful execution;

[0041] If the first execution result is execution failure, the application engine updates the status data corresponding to the first job to execution failure.

[0042] In combination with the second aspect, in a fourth implementation of the second aspect, the directed graph includes multiple layers of nodes; and the application engine module is further used for:

[0043] The step of storing the directed graph node information in the key-value database in a key-value manner includes:

[0044] The application engine stores the node information of each layer of nodes in the multi-layer nodes in the key-value database in sequence in a key-value manner according to the node pointing relationship.

[0045] In combination with the fourth implementation manner of the second aspect, in the fifth implementation manner of the second aspect, the multi-layer node includes a first-layer node and a second-layer node; and the application engine module is specifically used for:

[0046] The application engine stores the first layer node information in the directed graph in the key-value database in a key-value manner;

[0047] If the second execution result corresponding to the first-layer node information is successful execution, the application engine stores the second-layer node information in the directed graph in the key-value database in a key-value manner;

[0048] If the second execution result is execution failure, the application engine no longer stores the second-layer node information in the key-value database.

[0049] In combination with the second aspect, in the sixth implementation of the second aspect, the key-value database is an Etcd database.

[0050] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the virtual machine management method described in the first aspect or any one of the embodiments of the first aspect by executing the computer instructions.

[0051] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the virtual machine management method described in the first aspect or any one of the embodiments of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present invention in any way. In the accompanying drawings:

[0053] Figure 1 A method flow chart of a virtual machine management method is shown.

[0054] Figure 2 A schematic diagram of an application scenario of a virtual machine management method is shown.

[0055] Figure 3 Another method schematic diagram of a virtual machine management method is shown.

[0056] Figure 4 A structural schematic diagram of a virtual machine management device is shown.

[0057] Figure 5 A structural schematic diagram of an electronic device is shown. DETAILED DESCRIPTION

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

[0059] Figure 1 A method flow chart of a virtual machine management method is shown, and the virtual machine management method can be used on an electronic device managed by a virtual machine, and the electronic device can be located in a host machine. Figure 1 As shown, the virtual machine management method may include:

[0060] Step 101: The API receives a virtual machine management request, generates a corresponding virtual machine management task according to the virtual machine management request, and stores the virtual machine management task in a key-value database (eg, Etcd) in a key-value manner.

[0061] Specifically, Figure 2 As shown, the API 11 receives a virtual machine management request, generates a corresponding virtual machine management task according to the virtual machine management request, and stores the virtual machine management task in the key-value database 12 in a key-value manner.

[0062] After the API receives the user's virtual machine management request command, it can write a key / task into Etcd, and the value is a structure, including: task status (for example: create), task name is the specific task name to be executed (for example: CreateInstance), and it will also include some parameter information necessary to execute this task (for example: virtual machine specifications, image information, etc.).

[0063] Step 102: When the application engine (Engine) monitors a virtual machine management task from the key-value database, it splits the virtual machine management task into one or more jobs according to the set configuration file, and constructs a directed graph according to the dependency relationship between the jobs. Each node in the directed graph corresponds to a job, and the directed graph node information is stored in the key-value database in the form of key values.

[0064] Specifically, Figure 2 As shown, when the engine 13 monitors the virtual machine management task from the key-value database 12, it splits the virtual machine management task into one or more jobs according to the set configuration file, and builds a directed graph according to the dependency relationship between each job. Each node in the directed graph corresponds to a job, and the directed graph node information is stored in the key-value database 12 in the form of key values.

[0065] Among them, the set configuration file may refer to a file in which all API requests are pre-written in a fixed format, so that the application engine can split the task into one or more jobs according to the configuration file, form a directed graph according to the dependency relationship between the jobs, and each node corresponds to a job, and the jobs are issued in batches according to the node pointing relationship.

[0066] Step 103: When the application executor monitors the directed graph node information from the key-value database and needs to execute the first job itself, it executes the first job, obtains the first execution result, and stores the first execution result in the key-value database in a key-value manner.

[0067] Specifically, Figure 2 As shown, when the scheduling module 14 monitors the first job that needs to be executed by itself in the directed graph node information from the key-value database, it executes the first job, obtains the first execution result, and stores the first execution result in the key-value database 12 in the form of key value. Or

[0068] When the computing module 15 monitors the directed graph node information from the key-value database and needs to execute the first job, it executes the first job, obtains a first execution result, and stores the first execution result in the key-value database 12 in a key-value manner.

[0069] Among them, schduler is the executor, which is the specific implementer of the job in the task and is responsible for scheduling to select the most suitable compute. The job that needs to execute the scheduler will be the first job in the task. The scheduler will listen to the key / job / scheduler, select the specific host that meets the conditions, and write the corresponding information to Etcd. Writing to Etcd is done by writing the key / job / scheduler, the value contains the information of the scheduled compute, and the job status is changed to success, indicating that the job execution is completed.

[0070] Compute is also an executor, the specific implementer of the job in task. Each compute will listen to the key / job / $computeId, and get the value when there is a change. When the job status is ready, the corresponding executor will be called according to the job name to perform specific work. Finally, according to the execution result, the value of the key / job / $computeId in Etcd will be modified, and the job status will be changed to success or failed, as well as other data that needs to be returned after the task is completed. Compute only has the permission of the key with the prefix / job in Etcd, and other keys cannot be accessed or modified. In this way, the security of the system can be guaranteed without the conductor module.

[0071] It is worth noting that the scheduling module 14 and the calculation module 15 are both application program executors. Figure 2 It can be seen that: API11, key-value database 12 (ie, Etcd), engine 13, scheduling module 14 and calculation module 15 all establish communication connections with the key-value database 12. Each module communicates and executes corresponding tasks by listening to (watching) a specific key in Etcd and analyzing the obtained value.

[0072] For example: API 11 sends this virtual machine management request as a task, and Engine 13 splits this task into one or more jobs according to the configuration file, and forms a directed graph according to the dependency relationship between jobs. Each node corresponds to a job, and first sends the jobs of the nodes with a layer number of 1, and monitors the execution of the job at the same time. When it is monitored that a job is successfully executed, the jobs of the node pointed to by this job node are sent, and when it is monitored that a job is successfully executed again, the jobs pointed to by this node are sent again... In this way, jobs without dependencies in the task will be executed in parallel in the executor, and jobs with dependencies will be executed serially. Each executor only needs to monitor its own exclusive key in real time, and according to the different values ​​obtained, it can know which job will be executed, make corresponding execution actions, and write the execution results back to Etcd.

[0073] In an embodiment of the present application, when managing a virtual machine, an application engine is used to split the virtual machine management task into one or more jobs, and a directed graph is constructed according to the dependency relationship between the jobs. Each node in the directed graph corresponds to a job, and the directed graph node information is stored in a key-value database in a key-value manner. In this way, for the executor, it does not care which API request the job (job) it executes belongs to, but only cares about the job (job) sent to itself by the engine. It can execute one or even multiple tasks (task) jobs in parallel, thereby improving the efficiency of virtual machine management.

[0074] In an optional embodiment, the virtual machine management request includes one or more of a virtual machine creation request, a virtual machine deletion request, a virtual machine migration request, a virtual machine evacuation request, and a virtual machine power on / off request.

[0075] Specifically, the virtual machine management request may include only one management request, such as a virtual machine creation request; or may include multiple management requests, such as a virtual machine migration request for a first virtual machine and a virtual machine evacuation request for a second virtual machine.

[0076] In the embodiment of the present application, the virtual machine management request may include one management request or multiple management requests, thereby improving the practicality of virtual machine management.

[0077] In an optional embodiment, after executing step 103, the virtual machine management method may further include:

[0078] The application engine listens to the first execution result from the key-value database.

[0079] Specifically, Figure 2 As shown, the engine 13 monitors the first execution result obtained by the scheduling module 14 or the calculation module 15 from the key-value database 12 .

[0080] In the embodiment of the present application, in addition to issuing jobs, the application engine also needs to monitor the execution status of each executor, thereby ensuring the reliability of virtual machine management.

[0081] In an optional embodiment, the virtual machine management method may further include:

[0082] If the first execution result is successful execution, the application engine updates the status data corresponding to the first job to successful execution;

[0083] If the first execution result is execution failure, the application engine updates the status data corresponding to the first job to execution failure.

[0084] Specifically, Figure 2As shown, if the first execution result is execution success, the engine 13 updates the status data corresponding to the first job to execution success; if the first execution result is execution failure, the engine 13 updates the status data corresponding to the first job to execution failure.

[0085] For example: the engine mainly consists of three parts: the first submodule (task_handler), the second submodule (job_handler) and the third submodule (processor).

[0086] The task_handler is mainly responsible for monitoring (watching) the key / task. When an update is found, its value will be analyzed. When the task status is creat, the job of the task is disassembled into a directed graph according to the dependency relationship according to the configuration file, and the job is issued according to the relationship between each node of the directed graph. The specific process of job issuance is as follows: If the task needs to select a host machine, then the scheduler in the agreed configuration file will be the first job of this task. Task_handler writes a key / job / scheduler to Etcd, and the value is the condition that compute needs to meet. When the scheduler monitors the execution of this job request and returns the result, the job_handler will obtain the obtained ComputeId. If it is a task that does not need to be scheduled, the computeId required for operation will be obtained from the value information of the task. After that, task_handler will write a key / job / $computeId to Etcd according to the ID of the compute that each job needs to execute. The value is a structure that includes: the job status (ready at this time), the job name is the specific job name that needs to be executed, and the task status is changed to running.

[0087] The job_handler is mainly responsible for monitoring the execution results of compute and scheduler, and notifying task_handler to issue the next batch of tasks. Specifically, it monitors the key prefixed with / job, analyzes its value when an update is found, and performs corresponding processing according to the status of the job. If the job status is success, the processor corresponding to the job will be called to update the relevant data in Etcd.

[0088] In an embodiment of the present application, the application engine updates the status data corresponding to the first job, so that subsequent jobs can use these status data, and during debugging, problems can be located through these status data, thereby improving the efficiency of virtual machine management.

[0089] In an optional embodiment, the directed graph constructed in the above step 102 may include multiple layers of nodes; in executing step 102, the directed graph node information is stored in a key-value database in a key-value manner, which may include:

[0090] The application engine stores the node information of each layer of nodes in the key-value database in sequence using the key-value method according to the node pointing relationship.

[0091] Specifically, Figure 2 As shown, the engine 13 stores the node information of each layer of nodes in the key-value database 12 in sequence (in batches) using a key-value method according to the node pointing relationship.

[0092] For example: Figure 3 The directed graph in includes: Job 1, Job 2, Job 3, Job 4, and Job 5. Among them, the first-level nodes include Job 1, which is issued as the first batch; the second-level nodes include Job 2, Job 3, and Job 4, which are issued as the second batch; the first-level nodes include Job 5, which is issued as the third batch.

[0093] In an embodiment of the present application, the application engine stores the node information of each layer of nodes in a key-value database in sequence using a key-value format according to the node pointing relationship. In this way, for the executor, it does not care which API request the job it executes belongs to, but only cares about the job sent to itself by the engine. It can execute one or even multiple tasks in parallel, thereby improving the efficiency of virtual machine management.

[0094] In an optional embodiment, the multi-layer nodes include first-layer nodes and second-layer nodes; when the node information of each layer of nodes is sequentially stored in a key-value database in a key-value manner according to the node pointing relationship, the following implementation forms may be adopted but are not limited to:

[0095] The application engine stores the first-layer node information in the directed graph in a key-value database using a key-value method;

[0096] If the second execution result corresponding to the first-layer node information is successful, the application engine stores the second-layer node information in the directed graph in a key-value database in a key-value manner;

[0097] If the second execution result is execution failure, the application engine no longer stores the second-layer node information in the key-value database.

[0098] Specifically, when the multi-layer nodes include the first-layer nodes and the second-layer nodes, if the execution result of the first-layer nodes is successful, the second-layer node information can be continuously sent down; if the execution result of the first-layer nodes is failed, no information will be sent down. Similarly, if the multi-layer nodes also include the third-layer nodes, the third-layer node information can be continuously sent down only when the execution results of the first-layer nodes and the second-layer nodes are both successful.

[0099] for example: Figure 3 In the directed graph, the first-layer node information may be job 1, the second-layer node information may be job 2, job 3, and job 4, and the third-layer node information may be job 5. If the execution result of job 1 is successful, then job 2, job 3, and job 4 can be issued; if the execution result of job 1 is failed, then job 2, job 3, and job 4 will no longer be issued; for job 5, job 5 can only be issued if the execution results of job 1 and the execution results of job 2, job 3, and job 4 are all successful.

[0100] In the embodiment of the present application, only when the execution is successful can the node information of the next layer of nodes be stored in the key-value database in a key-value manner, thereby improving the reliability of virtual machine management.

[0101] In an optional embodiment, the key-value database involved in the above embodiments may be Etcd, which is a lightweight distributed key-value database.

[0102] In the embodiment of the present application, a lightweight distributed key-value database such as Etcd is used to manage virtual machines, which reduces the complexity of virtual machine management, simplifies implementation, and improves the efficiency of virtual machine management.

[0103] The following uses the creation of a virtual machine as an example to illustrate the implementation process of the above virtual machine management.

[0104] 1) Prepare a configuration file in yaml format. The first-level name is the name of the task, the jobs under jobs are the jobs contained in the task, the dependencies are represented by dependencies, name is the name of the task to be executed in the executor, and processor is the name of the processor that will be called when the job_handler in the Engine detects that the job has been successfully executed.

[0105]

[0106] 2) After the API module receives the user's request to create a virtual machine, it randomly generates a taskId, and then writes the key / task / $taskId and the value [status:create, data:[name:xxx, image:xxxx, flavor:xxx, network:xxx, etc.]] to Etcd.

[0107] 3) The Engine module listens for updates to the key prefixed with / task, checks that the status is create, and forms a directed graph of the jobs of this task according to the configuration file. For example, the task of creating a virtual machine is Scheduler->GetImageMeta->AllocateNetWork... Then it randomly generates a jobId and writes the key / job / Scheduler / $jobId and the value [status:ready, data:[flavor:xxx, tag:xxx, etc.]] to Etcd, and changes the status of the task to running.

[0108] 4) Scheduler detects that the key with the prefix / job / Scheduler is updated. Scheduler checks that the status is ready and selects a suitable compute according to the information in the data through the scheduling algorithm. The key / job / Scheduler and the value [status:success, data:[id:$Id, etc.]] are written into Etcd.

[0109] 5) The Engine module listens to the key prefixed with / job / Scheduler, listens to the job with a status of success, and obtains information such as $Id. According to the directed graph node relationship, the GetImageMeta job is issued, a jobId is randomly generated, and the key is written to Etcd as / job / $Id / $jobId, and the value is [status:ready, data[name:GetImageMeta, image:xxx, etc.]].

[0110] 6) Each Compute module listens to the prefix / job / its own ID. When the corresponding Compute listens to the value being updated, it checks that the status is ready and executes the corresponding program according to the name. After execution, it writes the key / job / its own ID / $jobId and the value [status: success, data [data required for subsequent jobs]] to Etcd.

[0111] 7) The Engine listens to the key prefixed with / job. When it finds that the value is updated and the status is success, it will call the processor corresponding to this job to update the data so that subsequent jobs can use this data. At the same time, the Engine will issue a batch of jobs, here AllocateNetWork, in the same way as step 5, and then repeat steps 6-7 until all jobs are completed. Finally, the task status is updated to End. If any of the above steps fails, the status of the job is changed to failed, and the subsequent jobs are no longer executed. At the same time, the status of the task to which it belongs is changed to failed.

[0112] When debugging, first check the task information list to find the failed task, then check the status of each job of this task, find the job with a failed status, and then check the information it returns. You can also retrieve debugging information on the host machine based on taskId and jobId to quickly locate the problem.

[0113] 8) Under the scale of 3000 computing nodes, 1, 100, and 500 concurrent requests for creating / deleting virtual machines were made to test the stability of the system and the execution time of the test cases. It has been guaranteed that the concurrent test can be carried out stably in a large-scale test environment, and the time coefficient for creating / deleting virtual machines is several times higher than that of the previous old solution. The more concurrent the number, the more obvious the improvement. The specific data is shown in Table 1.

[0114] Table 1

[0115]

[0116] It can be seen from the above embodiments that the technical effects that can be achieved by the present invention may include:

[0117] (1) In order to avoid the performance degradation caused by message accumulation under large-scale clusters and high concurrency, the patent solution abandons the traditional database and message queue mechanism, and the communication between modules is changed to the watch mechanism of each module for Etcd. The use of Etcd instead of the traditional database also makes the cloud platform system more lightweight.

[0118] (2) Improved the work efficiency of the entire cloud platform system: This solution introduces the Engine module. API requests will generate a directed graph in the Engine based on the dependencies between jobs, and the jobs will be issued in batches based on the node relationships in the directed graph. For the executor, it does not care which API request the job it executes belongs to, but only cares about the job issued to it by the Engine. It can execute one or more tasks in parallel.

[0119] (3) Improved work efficiency of operation and maintenance personnel: Since API requests are broken down into job granularity, the debugging tool can obtain the execution status and return information of each job in the task. During debugging, the specific failed job can be directly located for analysis.

[0120] Figure 4 A schematic diagram of the structure of a virtual machine management device is shown. The virtual machine management device may be a device for virtual machine management, such as a host machine. Figure 4 As shown, the virtual machine management device may include:

[0121] An application programming interface API module 41 is used to receive a virtual machine management request, generate a corresponding virtual machine management task according to the virtual machine management request, and store the virtual machine management task in a key-value database 44 in a key-value manner;

[0122] The application engine module 42 is used for, when the virtual machine management task is monitored from the key-value database, splitting the virtual machine management task into one or more jobs according to the set configuration file, constructing a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and storing the directed graph node information in the key-value database 44 in a key-value manner;

[0123] The application executor module 43 is used to execute the first job that needs to be executed by itself in the directed graph node information monitored from the key-value database, obtain the first execution result, and store the first execution result in the key-value database 44 in a key-value manner.

[0124] In a possible implementation, the virtual machine management request includes one or more of a virtual machine creation request, a virtual machine deletion request, a virtual machine migration request, a virtual machine evacuation request, and a virtual machine power on / off request.

[0125] In a possible implementation, the application engine module 42 is further used for:

[0126] The application engine monitors the first execution result from the key-value database.

[0127] In a possible implementation, the application engine module 42 is further used for:

[0128] If the first execution result is successful execution, the application engine updates the status data corresponding to the first job to successful execution;

[0129] If the first execution result is execution failure, the application engine updates the status data corresponding to the first job to execution failure.

[0130] In a possible implementation, the directed graph includes multiple layers of nodes; the application engine module 42 is further used for:

[0131] The step of storing the directed graph node information in the key-value database in a key-value manner includes:

[0132] The application engine stores the node information of each layer of nodes in the multi-layer nodes in the key-value database in sequence in a key-value manner according to the node pointing relationship.

[0133] In a possible implementation, the multi-layer nodes include first-layer nodes and second-layer nodes; the application engine module 42 is specifically used for:

[0134] The application engine stores the first layer node information in the directed graph in the key-value database in a key-value manner;

[0135] If the second execution result corresponding to the first-layer node information is successful execution, the application engine stores the second-layer node information in the directed graph in the key-value database in a key-value manner;

[0136] If the second execution result is execution failure, the application engine no longer stores the second-layer node information in the key-value database.

[0137] In a possible implementation, the key-value database is an Etcd database.

[0138] It should be noted here that the virtual machine management device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment and can achieve the same technical effect. The parts and beneficial effects of this embodiment that are the same as those in the method embodiment will not be described in detail here.

[0139] Figure 5 FIG. 1 shows a schematic diagram of the structure of an electronic device. Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the virtual machine management method, which includes:

[0140] The application programming interface API receives a virtual machine management request, generates a corresponding virtual machine management task according to the virtual machine management request, and stores the virtual machine management task in a key-value database in a key-value manner;

[0141] When the application engine monitors the virtual machine management task from the key-value database, the application engine splits the virtual machine management task into one or more jobs according to the set configuration file, builds a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and stores the directed graph node information in the key-value database in a key-value manner;

[0142] If the application executor monitors the first job that needs to be executed by itself in the directed graph node information from the key-value database, it executes the first job, obtains a first execution result, and stores the first execution result in the key-value database in a key-value manner.

[0143] If the hot migration estimation result is determined to be suitable for initiating virtual machine management, virtual machine management is initiated.

[0144] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0145] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer can execute the virtual machine management method provided by the above methods, the method comprising:

[0146] The application programming interface API receives a virtual machine management request, generates a corresponding virtual machine management task according to the virtual machine management request, and stores the virtual machine management task in a key-value database in a key-value manner;

[0147] When the application engine monitors the virtual machine management task from the key-value database, the application engine splits the virtual machine management task into one or more jobs according to the set configuration file, builds a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and stores the directed graph node information in the key-value database in a key-value manner;

[0148] If the application executor monitors the first job that needs to be executed by itself in the directed graph node information from the key-value database, it executes the first job, obtains a first execution result, and stores the first execution result in the key-value database in a key-value manner.

[0149] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method for managing a virtual machine provided above is implemented, and the method comprises:

[0150] The application programming interface API receives a virtual machine management request, generates a corresponding virtual machine management task according to the virtual machine management request, and stores the virtual machine management task in a key-value database in a key-value manner;

[0151] When the application engine monitors the virtual machine management task from the key-value database, the application engine splits the virtual machine management task into one or more jobs according to the set configuration file, builds a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and stores the directed graph node information in the key-value database in a key-value manner;

[0152] If the application executor monitors the first job that needs to be executed by itself in the directed graph node information from the key-value database, it executes the first job, obtains a first execution result, and stores the first execution result in the key-value database in a key-value manner.

[0153] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0154] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A virtual machine management method, characterized in that: include: The application programming interface API receives a virtual machine management request, generates a corresponding virtual machine management task according to the virtual machine management request, and stores the virtual machine management task in a key-value database in a key-value manner; When the application engine monitors the virtual machine management task from the key-value database, the application engine splits the virtual machine management task into one or more jobs according to the set configuration file, builds a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and stores the directed graph node information in the key-value database in a key-value manner, wherein the set configuration file is used to indicate a file in which all API requests are pre-written in a fixed format; If the application executor monitors the first job that needs to be executed by itself in the directed graph node information from the key-value database, it executes the first job, obtains a first execution result, and stores the first execution result in the key-value database in a key-value manner.

2. The method according to claim 1, characterized in that The virtual machine management request includes one or more of a virtual machine creation request, a virtual machine deletion request, a virtual machine migration request, a virtual machine evacuation request, and a virtual machine power on / off request.

3. The method according to claim 1, characterized in that Also includes: The application engine monitors the first execution result from the key-value database.

4. The method according to claim 3, characterized in that Also includes: If the first execution result is successful execution, the application engine updates the status data corresponding to the first job to successful execution; If the first execution result is execution failure, the application engine updates the status data corresponding to the first job to execution failure.

5. The method according to claim 1, characterized in that The directed graph includes multiple layers of nodes; The step of storing the directed graph node information in the key-value database in a key-value manner includes: The application engine stores the node information of each layer of nodes in the multi-layer nodes in the key-value database in sequence in a key-value manner according to the node pointing relationship.

6. The method according to claim 5, characterized in that The multi-layer nodes include first-layer nodes and second-layer nodes; The step of storing the node information of each layer of nodes in the multi-layer nodes in sequence in the key-value database in a key-value manner according to the node pointing relationship includes: The application engine stores the first layer node information in the directed graph in the key-value database in a key-value manner; If the second execution result corresponding to the first-layer node information is successful execution, the application engine stores the second-layer node information in the directed graph in the key-value database in a key-value manner; If the second execution result is execution failure, the application engine no longer stores the second-layer node information in the key-value database.

7. The method according to claim 1, characterized in that The key-value database is an Etcd database.

8. A virtual machine management device, characterized in that: include: An application programming interface API module is used to receive a virtual machine management request, generate a corresponding virtual machine management task according to the virtual machine management request, and store the virtual machine management task in a key-value database in a key-value manner; The application engine module is used for, when the virtual machine management task is monitored from the key-value database, splitting the virtual machine management task into one or more jobs according to a set configuration file, constructing a directed graph according to the dependency relationship between the jobs, each node in the directed graph corresponds to a job, and storing the directed graph node information in the key-value database in a key-value manner, wherein the set configuration file is used to indicate a file in which all API requests are pre-written in a fixed format; The application executor module is used to execute the first job that needs to be executed by itself in the directed graph node information monitored from the key-value database, obtain the first execution result, and store the first execution result in the key-value database in a key-value manner.

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

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