Virtual machine management method and device, computer equipment and storage medium

By deploying computing nodes and management nodes in the cloud computing platform, using the virtual machine directory to lock and unlock, the abnormal problems caused by lock operations in virtual machine management are solved, automatic update and failure recovery of virtual machines are realized, and the improvement of the improvement of the virtual machine is improved. System stability and efficiency.

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

Patent Information

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

AI Technical Summary

Technical Problem

Traditional virtual machine management is prone to causing lock operation exceptions when hot editing disks, increasing system complexity and operation and maintenance costs, and difficult to meet the complex needs of modern users.

Method used

Deploy computing nodes and management nodes in the cloud computing platform, lock and unlock through the virtual machine directory, and use the distributed lock manager to manage lock information to realize automatic update and failure recovery of the virtual machine to avoid exceptions caused by lock operations.

Benefits of technology

It reduces the probability of abnormal occurrence, simplifies the processing process, ensures the continuity of virtual machine business, and reduces the subsequent R&D and testing workload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201347A_ABST
    Figure CN119201347A_ABST
Patent Text Reader

Abstract

The invention relates to a virtual machine management method and device, computer equipment and a storage medium. The method comprises the steps that computing nodes and management nodes are deployed in a current cloud computing platform, virtual machines are located on the computing nodes, and the management nodes are used for managing the computing nodes of the same version and / or the last version; acquiring a locked disk of the virtual machine and a storage pool corresponding to the locked disk; creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory; and in response to the situation that the virtual machine is in the startup state, locking the directory of the virtual machine through the lock information, and performing lock release and lock removal on the locked disk. By adopting the method, the directory of the virtual machine can be locked, the locked disk is released, and the updating of the virtual machine is realized, so that the workload of subsequent research and development and testing is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtual machine technology, and in particular to a virtual machine management method, apparatus, computer equipment and storage medium. Background Art

[0002] With the advancement of information technology, the utilization and efficiency of physical resources have become increasingly prominent. In the traditional computing model, each application or service usually needs to run on a separate physical server, which not only leads to a serious waste of resources, but also increases the complexity and cost of data center operation and maintenance. The emergence of virtualization technology has greatly improved the utilization and flexibility of hardware resources by creating multiple independent virtual environments on a single physical host, allowing each virtual environment to run different operating systems and applications, while also simplifying system management and maintenance.

[0003] However, with the continuous advancement of technology and the increasing complexity of application scenarios, the original virtualization design can no longer meet the needs of modern users. For example, in the management and use of virtual machines, frequent lock operations increase the complexity of the system, especially when hot editing disks involves locking disks, which will trigger the release and lock operations, which may cause various abnormal problems. Summary of the invention

[0004] Based on this, it is necessary to provide a virtual machine management method, apparatus, computer device and storage medium that can lock the virtual machine directory in order to solve the above technical problems.

[0005] In one aspect, a virtual machine management method is provided, the method comprising:

[0006] Deploy computing nodes and management nodes in the current cloud computing platform respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0007] Obtaining a locked disk of the virtual machine and a storage pool corresponding to the locked disk;

[0008] Creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory;

[0009] In response to the virtual machine being in a powered-on state, the virtual machine directory is locked using the lock information, and the locked disk is released and removed.

[0010] In one embodiment, the deploying of computing nodes and management nodes in the current cloud computing platform respectively includes:

[0011] Adding a virtual machine interface in the computing node;

[0012] In response to the existence of computing nodes of different versions in the cloud computing platform, unifying interface support of computing nodes of different versions for the updated virtual machine through the virtual machine interface;

[0013] After the deployment of the computing nodes is completed, the database table structure of the management node is updated.

[0014] In one embodiment, the database table includes a virtual machine configuration table, and updating the database table structure of the management node includes:

[0015] Adding a storage pool field where the virtual machine directory is located and a lock information field in the virtual machine configuration table;

[0016] A controller table is added to the database, and an association relationship between the controller table and the virtual machine configuration table is established.

[0017] In one embodiment, creating a virtual machine directory corresponding to the virtual machine in the storage pool, and obtaining lock information according to the virtual machine directory includes:

[0018] In response to completing the deployment of the computing node and the management node, determining whether the virtual machine is currently executing a virtual machine task;

[0019] In response to the virtual machine not currently executing a virtual machine task and the virtual machine is in a steady state, triggering a virtual machine update process, wherein the steady state includes a power-on state and a power-off state;

[0020] Creating a virtual machine directory corresponding to the virtual machine under the mount path of the storage pool;

[0021] Acquire configuration information of the virtual machine from the database, and generate a configuration file of the virtual machine based on the configuration information;

[0022] Copying the configuration file and firmware configuration file of the virtual machine to the virtual machine directory;

[0023] Sending a lock request to a distributed lock manager corresponding to the storage pool where the virtual machine directory is located, wherein the lock request is used to lock the virtual machine directory;

[0024] The lock information returned by the distributed lock manager in response to the lock request is obtained.

[0025] In one embodiment, in response to the virtual machine being in a powered-on state, locking the virtual machine directory through the lock information, and releasing and removing the lock from the locked disk include:

[0026] In response to a hot edit request for the virtual machine, determining a current state of the virtual machine;

[0027] In response to the virtual machine being in a powered-on state, calling the virtual machine interface, and locking the virtual machine directory through the lock information, wherein the lock information includes offset information;

[0028] Release the lock on the locked disk, and remove the lock after the lock is released successfully;

[0029] The storage pool information where the virtual machine directory is located and the offset information are updated to the storage pool field and the lock information field of the virtual machine configuration table respectively;

[0030] Deleting the original configuration file and the original firmware configuration file of the virtual machine;

[0031] Performing consistency detection on the virtual machine;

[0032] In response to the consistency detection result being consistent, determining that the virtual machine is updated successfully;

[0033] In response to the consistency detection result being inconsistent, marking the virtual machine state as a data abnormal state, and determining that the virtual machine update fails;

[0034] In response to an exception occurring during the update process of the virtual machine, marking the virtual machine as being in an update exception state, and determining that the update of the virtual machine has failed, wherein the exception includes a failure to lock the virtual machine directory, a failure to release the lock on the locked disk, a failure to remove the lock on the locked disk, and a failure to update the virtual machine configuration table;

[0035] The virtual machine directory is locked and removed, the virtual machine directory is cleared, and the locked disk is locked again to restore the normal operation of the virtual machine.

[0036] In one embodiment, the method further comprises:

[0037] In response to the virtual machine being in a shutdown state, directly removing the lock from the locked disk;

[0038] After the virtual machine is powered on, the virtual machine directory is locked using the lock information.

[0039] In one embodiment, the method further comprises:

[0040] In response to the virtual machine update failure, an alarm is issued, and the virtual machine is restricted to only perform a recovery operation;

[0041] Determining a cause of the failure of the virtual machine and determining a virtual machine recovery strategy based on the cause of the failure;

[0042] A recovery operation is performed on the virtual machine according to the virtual machine recovery policy, and a virtual machine update process is re-executed on the virtual machine.

[0043] In another aspect, a virtual machine management device is provided, the device comprising:

[0044] A deployment module, used to deploy computing nodes and management nodes in the current cloud computing platform, respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0045] An acquisition module, used to acquire a locking disk of the virtual machine and a storage pool corresponding to the locking disk;

[0046] A creation module, used to create a virtual machine directory corresponding to the virtual machine in the storage pool, and obtain lock information according to the virtual machine directory;

[0047] The execution module is used for locking the virtual machine directory through the lock information in response to the virtual machine being in the power-on state, and releasing and removing the lock from the locked disk.

[0048] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0049] Deploy computing nodes and management nodes in the current cloud computing platform respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0050] Obtaining a locked disk of the virtual machine and a storage pool corresponding to the locked disk;

[0051] Creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory;

[0052] In response to the virtual machine being in a powered-on state, the virtual machine directory is locked using the lock information, and the locked disk is released and removed.

[0053] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0054] Deploy computing nodes and management nodes in the current cloud computing platform respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0055] Obtaining a locked disk of the virtual machine and a storage pool corresponding to the locked disk;

[0056] Creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory;

[0057] In response to the virtual machine being in a powered-on state, the virtual machine directory is locked using the lock information, and the locked disk is released and removed.

[0058] The above-mentioned virtual machine management method, apparatus, computer equipment and storage medium respectively update the computing nodes and management nodes in the cloud computing platform, so that different versions of computing nodes can provide functional support for the updated virtual machines. After the cloud computing platform is updated, the virtual machine update process is automatically triggered. By locking the virtual machine directory and releasing the locked disk, the lock operation will not be triggered when the disk is hot edited, which reduces the probability of abnormalities and simplifies the processing flow. In addition, updating the virtual machine instead of adding a new version of the virtual machine reduces the workload of subsequent research and development and testing by half. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 A flowchart of a virtual machine management method in one embodiment;

[0060] Figure 2 A flowchart of a virtual machine update step in one embodiment;

[0061] Figure 3 A flowchart of abnormal recovery steps of a virtual machine in one embodiment;

[0062] Figure 4 is a structural block diagram of a virtual machine management device in an embodiment;

[0063] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0065] In one embodiment, Figure 1 As shown, a virtual machine management method is provided, comprising the following steps:

[0066] Step S1, respectively deploying computing nodes and management nodes in the current cloud computing platform, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version.

[0067] Among them, there are two roles in the cloud computing platform: computing nodes and management nodes. Management nodes provide management functions, and computing nodes provide computing functions.

[0068] In one embodiment, the specific steps of respectively deploying computing nodes and management nodes in the current cloud computing platform include: adding a virtual machine interface in the computing node; in response to the existence of different versions of computing nodes in the cloud computing platform, unifying the interface support of each version of computing nodes for the updated virtual machine through the virtual machine interface; after completing the deployment of the computing node, updating the database table structure of the management node.

[0069] It should be noted that in order for the cloud computing platform to recognize and support the updated virtual machine after the update of the virtual machine, it is necessary to update the version of the cloud computing platform, that is, to recover from some problems and support new functions by releasing a new version, including computing nodes and management nodes. After the update is completed, the management node and the computing node should be the same version, but the computing node is also allowed to be one version lower than the management node, so there may be different versions of computing nodes in the cloud computing platform. In order to achieve consistent functional support for the updated virtual machine by computing nodes of different versions, this application updates the cloud computing platform twice, and the code of these two parts is updated into two projects, which are called through the REST API interface. The first update only makes modifications in the computing node code, and the virtual machine interface that needs to be used is developed in advance to align the interface support of computing nodes of different versions for the updated virtual machine. The management node is updated for the second time to complete the support of the database and management node for the updated virtual machine.

[0070] Based on the above steps, by updating the original virtual machine instead of adding a new version of the virtual machine, half of the workload required for subsequent research and development and testing is reduced. The updated virtual machine can use new features to improve user experience. During the update of the cloud computing platform, the virtual machine does not need to be shut down and the server does not need to be restarted, ensuring the continuity of user business.

[0071] In one embodiment, the database table includes a virtual machine configuration table, and the specific steps of updating the database table structure of the management node include: adding a storage pool field and a lock information field corresponding to the virtual machine directory in the virtual machine configuration table; adding a controller table to the database, and establishing an association relationship between the controller table and the virtual machine configuration table.

[0072] After the first upgrade, the computing nodes already have the ability to provide interface support for the updated virtual machines, so the second upgrade only modifies the management node code, mainly modifies the business logic of the updated virtual machines, and makes necessary structural adjustments to the database to provide the cloud computing platform's virtual machine update and recovery functions to support the updated virtual machine features. In addition, by updating the virtual machine business code, only the updated virtual machine is allowed to operate, and the old version of the virtual machine before the update is not allowed to operate.

[0073] Specifically, the SQL script is called to complete the database table structure change and data laying, and the default controller data is inserted into the newly added controller table, where the controller table is associated with the virtual machine configuration table, and records the information of the controller used by the virtual machine, including address, type, alias, etc. Old versions of virtual machines usually solidify the controller into the code, and some controllers are not actually used, resulting in waste of PCI addresses being occupied, and the addresses used by the devices cannot be modified. However, this application provides an entry for controller configuration in the interface, and users can select the controller and address used by the device, which can better support some systems with specific requirements for device addresses, and unused controllers do not need to be configured, saving PCI addresses.

[0074] Based on the above steps, by updating the database table structure, the operation permissions of the virtual machine can be better controlled. In addition, by updating the virtual machine business code, only operations on the updated virtual machine are allowed, and there is no need to pay attention to the old version of the virtual machine. In this way, there is no need to maintain two sets of virtual machine codes, which reduces the workload of subsequent research and development and testing, and improves the overall efficiency and maintainability of the system.

[0075] Step S2, obtaining the locking disk of the virtual machine and the storage pool corresponding to the locking disk.

[0076] It should be noted that in the old version of the virtual machine, all disks will apply for lock information, but at startup, only one disk can be locked. In addition, when hot editing a virtual machine, if the locked disk is changed, you need to lock the new disk first, and then release the lock and remove the lock on the old disk. During hot migration, if the storage pool where the locked disk is located is changed, you also need to lock the locked disk in the destination storage pool, and release the lock and remove the lock on the locked disk in the source storage pool.

[0077] Step S3: Create a virtual machine directory corresponding to the virtual machine in the storage pool, and obtain lock information according to the virtual machine directory.

[0078] The virtual machine directory is named after the internal name of the virtual machine, which is globally unique and cannot be shared. The storage pool to which it belongs can only be changed through migration. When the virtual machine is powered on, the virtual machine directory needs to be locked to ensure a single instance of the virtual machine. When the virtual machine is deleted, the virtual machine directory and the files under it will also be deleted synchronously.

[0079] In one embodiment, the specific steps of creating a virtual machine directory corresponding to the virtual machine in the storage pool and obtaining lock information based on the virtual machine directory include: in response to completing the deployment of the computing node and the management node, determining whether the virtual machine is currently executing a virtual machine task; in response to the virtual machine not currently executing a virtual machine task and the virtual machine is in a steady state, triggering a virtual machine update process, the steady state including a power-on state and a power-off state; creating a virtual machine directory corresponding to the virtual machine under the mount path of the storage pool; obtaining the configuration information of the virtual machine from the database, and generating a configuration file for the virtual machine based on the configuration information; copying the configuration file and the firmware configuration file of the virtual machine to the virtual machine directory; sending a lock request to the distributed lock manager corresponding to the storage pool where the virtual machine directory is located, the lock request being used to lock the virtual machine directory; and obtaining the lock information returned by the distributed lock manager in response to the lock request.

[0080] Among them, the virtual machine directory is named after the internal name of the virtual machine, which is globally unique and cannot be shared. The storage pool to which it belongs can only be changed through migration. In addition to the virtual machine configuration file and firmware configuration file, other virtual machine-related Xiao Wenjie can also be stored in the virtual machine directory. When the virtual machine is turned on, the virtual machine directory needs to be locked to ensure a single instance of the virtual machine, and when the virtual machine is deleted, the virtual machine directory and the files under it will also be deleted synchronously. There is a distributed lock manager under each storage pool, which has the functions of applying for locks, locking, releasing locks, and removing locks. A distributed lock manager can apply for up to 2048 locks, so the old version of the virtual machine before the update supports a maximum of 2048 disks in a single storage pool. After the disk is not locked, the maximum number of disks that can be created in a single storage pool is no longer 2048.

[0081] Based on the above steps, by placing the virtual machine's configuration file and firmware configuration file in the virtual machine directory, and locking the virtual machine directory instead of locking the disk, the lock operation will not be triggered when hot editing the disk, reducing the probability of abnormalities. The interface does not need to provide a lock switch for the disk, exposing technical details. At the same time, because the disk is not locked, there is no need to lock and release the lock when hot adding or deleting the disk, which simplifies the processing logic. In addition, during the virtual machine update process, the virtual machine does not need to be in the shutdown state, and the host does not need to be shut down or restarted, ensuring the continuity of the virtual machine business.

[0082] Step S4, in response to the virtual machine being in a powered-on state, locking the virtual machine directory through the lock information, and releasing and removing the lock from the locked disk.

[0083] In one embodiment, in response to the virtual machine being in a powered-on state, the virtual machine directory is locked through the lock information, and the specific steps of releasing and removing the lock of the locked disk include: in response to a hot edit request for the virtual machine, determining the current state of the virtual machine; in response to the virtual machine being in a powered-on state, calling the virtual machine interface, locking the virtual machine directory through the lock information, the lock information including offset information; releasing the lock of the locked disk, and removing the lock after the lock is successfully released; updating the storage pool information of the virtual machine directory and the offset information to the storage pool field and the lock information field of the virtual machine configuration table respectively; deleting the original configuration file and original firmware configuration of the virtual machine file; perform a consistency check on the virtual machine; in response to the consistency check result being consistent, determine that the virtual machine update is successful; in response to the consistency check result being inconsistent, mark the virtual machine state as a data abnormal state, and determine that the virtual machine update has failed; in response to an abnormality occurring during the update process of the virtual machine, mark the virtual machine as an update abnormal state, and determine that the virtual machine update has failed, wherein the abnormality includes a failure to lock the virtual machine directory, a failure to release the lock on the locking disk, a failure to remove the lock on the locking disk, and a failure to update the virtual machine configuration table; release and remove the lock on the virtual machine directory, clear the virtual machine directory, and re-lock the locking disk to restore the normal operation of the virtual machine.

[0084] In one implementation, in response to the virtual machine being in a shutdown state, the lock on the locked disk is directly removed; after the virtual machine is powered on, the virtual machine directory is locked using the lock information.

[0085] Based on the above steps, after the cloud computing platform is updated, the virtual machine update process is automatically triggered without manual operation, reducing the operation and maintenance workload. During the update process, the virtual machine does not need to be shut down, and the host does not need to be shut down or restarted, ensuring the continuity of the virtual machine business. In addition, by updating the original virtual machine instead of adding a new version of the virtual machine, the workload of subsequent R&D and testing is reduced by half.

[0086] In one embodiment, in response to the failure of the virtual machine update, an alarm is issued, and the virtual machine is restricted to only perform recovery operations; the cause of the failure of the virtual machine is determined, and a virtual machine recovery strategy is determined based on the failure cause; a recovery operation is performed on the virtual machine according to the virtual machine recovery strategy, and the virtual machine update process is re-executed on the virtual machine.

[0087] During the virtual machine update process, if the update fails due to network or storage failures, the virtual machine status will be changed to an abnormal update status, and an alarm will be generated to notify the user. In this status, the virtual machine is restricted to recovery and error reporting to prevent other user operations from affecting virtual machine recovery. In this way, the test only needs to test the virtual machine recovery function, without the need to maintain a set of codes for the update failure virtual machine function, reducing the maintenance workload.

[0088] Specifically, when an abnormality is detected during the virtual machine update process, such as a lock application failure, a lock failure, a database update failure, etc., or when the consistency detection result is inconsistent, the abnormal information is recorded; the cause of the failure is identified based on the abnormal information, and the abnormal recovery process is entered; virtual machine metadata is created, and lock information is obtained based on the virtual machine metadata, and the virtual machine metadata includes the virtual machine ID, current status, cause of failure, etc.; the operation and maintenance personnel can restore the virtual machine according to the alarm information. If the transformation fails due to network, storage, etc. failures, a rollback will be triggered. After the user solves the network or storage failure, click Restore. If the virtual machine is in an abnormal state, the virtual machine update process is re-executed. After the update is successful, the virtual machine state is restored to power on or off, the alarm is eliminated, and the virtual machine function can be used normally.

[0089] Furthermore, before the virtual machine update process is performed, a target virtual machine snapshot creation operation instruction is issued through the cloud computing platform, the running status data of the virtual machine stored in the cache is read, and a memory snapshot is generated based on the running status data, and the memory snapshot is stored in the virtual machine directory; if the memory snapshot is not detected within a preset time period, the system operation log information from the moment when the cloud computing platform sends the target virtual machine snapshot creation operation instruction to the current moment is packaged and sent to the virtual machine directory; if it is detected that the running status data in the memory snapshot has changed in the cache, the current running status data in the cache is obtained, and the memory snapshot is updated according to the current running status data, the running status data includes the memory data and hardware status data of the virtual machine, and the cache includes memory and registers; in response to the failure of the virtual machine update, a rollback operation is performed by loading the memory snapshot.

[0090] Preferably, the computing node periodically sends heartbeat packets to the distributed lock manager to perform heartbeat detection; in response to the distributed lock manager not receiving the heartbeat packet of the computing node within a preset time, the computing node is deemed to be offline, and the lock of the virtual machine directory of the computing node is automatically released.

[0091] Based on the above steps, in the event of a virtual machine update failure, the virtual machine status is automatically marked as abnormal and an alarm is issued. Combined with fault diagnosis and recovery strategies, the system's robustness and fault handling efficiency are improved. At the same time, the user experience is improved through real-time alarms and automated recovery processes.

[0092] It should be understood that although Figure 1-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0093] In one embodiment, Figure 4 As shown, a virtual machine management device is provided, including: a deployment module, an acquisition module, a creation module and an execution module, wherein:

[0094] A deployment module, used to deploy computing nodes and management nodes in the current cloud computing platform, respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0095] An acquisition module, used to acquire a locking disk of the virtual machine and a storage pool corresponding to the locking disk;

[0096] A creation module, used to create a virtual machine directory corresponding to the virtual machine in the storage pool, and obtain lock information according to the virtual machine directory;

[0097] The execution module is used for locking the virtual machine directory through the lock information in response to the virtual machine being in the power-on state, and releasing and removing the lock from the locked disk.

[0098] In one embodiment, the deployment module is also used to add a virtual machine interface in the computing node; in response to the existence of different versions of computing nodes in the cloud computing platform, unify the interface support of each version of computing nodes for the updated virtual machine through the virtual machine interface; after completing the deployment of the computing node, update the database table structure of the management node.

[0099] In one embodiment, the deployment module is further used to add a storage pool field and a lock information field where the virtual machine directory is located in the virtual machine configuration table; add a controller table in the database, and establish an association relationship between the controller table and the virtual machine configuration table.

[0100] In one embodiment, the creation module is further used to, in response to completing the deployment of the computing node and the management node, determine whether the virtual machine is currently executing a virtual machine task; in response to the virtual machine not currently executing a virtual machine task and the virtual machine is in a steady state, trigger a virtual machine update process, wherein the steady state includes a power-on state and a power-off state; create a virtual machine directory corresponding to the virtual machine under the mount path of the storage pool; obtain the configuration information of the virtual machine from the database, and generate a configuration file of the virtual machine based on the configuration information;

[0101] Copy the configuration file and firmware configuration file of the virtual machine to the virtual machine directory; send a lock request to the distributed lock manager corresponding to the storage pool where the virtual machine directory is located, and the lock request is used to lock the virtual machine directory; obtain the lock information returned by the distributed lock manager in response to the lock request.

[0102] In one embodiment, the execution module is also used to respond to a hot edit request for the virtual machine to determine the current state of the virtual machine; in response to the virtual machine being in a powered-on state, call the virtual machine interface to lock the virtual machine directory through the lock information, wherein the lock information includes offset information; release the lock on the locked disk, and remove the lock after the lock is released successfully; update the storage pool information where the virtual machine directory is located and the offset information to the storage pool field and the lock information field of the virtual machine configuration table respectively; delete the original configuration file and the original firmware configuration file of the virtual machine; perform a consistency check on the virtual machine; and in response to the consistency check If the result is consistent, the virtual machine is determined to be updated successfully; in response to the consistency check result being inconsistent, the virtual machine state is marked as a data abnormal state, and the virtual machine update is determined to have failed; in response to an abnormality occurring during the update process of the virtual machine, the virtual machine is marked as an update abnormal state, and the virtual machine update is determined to have failed, wherein the abnormality includes a failure to lock the virtual machine directory, a failure to release the lock on the locking disk, a failure to remove the lock on the locking disk, and a failure to update the virtual machine configuration table; the virtual machine directory is locked and removed, the virtual machine directory is cleared, and the locking disk is re-locked to restore the normal operation of the virtual machine.

[0103] In one embodiment, the execution module is further configured to directly remove the lock from the locking disk in response to the virtual machine being in a shutdown state; and after the virtual machine is powered on, lock the virtual machine directory using the lock information.

[0104] In one embodiment, a recovery module is also included, wherein the recovery module is used to issue an alarm in response to the failure of the virtual machine update, and limit the virtual machine to only perform recovery operations; determine the cause of the failure of the virtual machine, and determine the virtual machine recovery strategy based on the failure cause; perform recovery operations on the virtual machine according to the virtual machine recovery strategy, and re-execute the virtual machine update process on the virtual machine.

[0105] For the specific definition of the virtual machine management device, please refer to the definition of the virtual machine management method above, which will not be repeated here. Each module in the above virtual machine management device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0106] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store lock information data of the virtual machine. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a virtual machine management method is implemented.

[0107] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0108] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0109] Deploy computing nodes and management nodes in the current cloud computing platform respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0110] Obtaining a locked disk of the virtual machine and a storage pool corresponding to the locked disk;

[0111] Creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory;

[0112] In response to the virtual machine being in a powered-on state, the virtual machine directory is locked using the lock information, and the locked disk is released and removed.

[0113] In one embodiment, when the processor executes the computer program, the following steps are also implemented: adding a virtual machine interface in the computing node; in response to the existence of computing nodes of different versions in the cloud computing platform, unifying the interface support of each version of computing nodes for the updated virtual machine through the virtual machine interface; after completing the deployment of the computing node, updating the database table structure of the management node.

[0114] In one embodiment, when the processor executes the computer program, the following steps are also implemented: adding a storage pool field and a lock information field where the virtual machine directory is located in the virtual machine configuration table; adding a controller table to the database, and establishing an association relationship between the controller table and the virtual machine configuration table.

[0115] In one embodiment, the processor also implements the following steps when executing the computer program: in response to completing the deployment of the computing node and the management node, determining whether the virtual machine is currently executing a virtual machine task; in response to the virtual machine not currently executing a virtual machine task and the virtual machine is in a steady state, triggering a virtual machine update process, the steady state including a power-on state and a power-off state; creating a virtual machine directory corresponding to the virtual machine under the mount path of the storage pool; obtaining the configuration information of the virtual machine from the database, and generating a configuration file for the virtual machine based on the configuration information; copying the configuration file and the firmware configuration file of the virtual machine to the virtual machine directory; sending a lock request to the distributed lock manager corresponding to the storage pool where the virtual machine directory is located, the lock request being used to lock the virtual machine directory; and obtaining the lock information returned by the distributed lock manager in response to the lock request.

[0116] In one embodiment, the processor further implements the following steps when executing the computer program: in response to a hot edit request for the virtual machine, determining the current state of the virtual machine; in response to the virtual machine being in a powered-on state, calling the virtual machine interface, locking the virtual machine directory through the lock information, wherein the lock information includes offset information; releasing the lock on the locked disk, and removing the lock after the lock is released successfully; updating the storage pool information where the virtual machine directory is located and the offset information to the storage pool field and the lock information field of the virtual machine configuration table respectively; deleting the original configuration file and the original firmware configuration file of the virtual machine; performing consistency detection on the virtual machine; in response to the If the consistency check result is consistent, the virtual machine is determined to be updated successfully; in response to the consistency check result being inconsistent, the virtual machine state is marked as a data abnormal state, and the virtual machine update is determined to have failed; in response to an abnormality occurring during the update process of the virtual machine, the virtual machine is marked as an update abnormal state, and the virtual machine update is determined to have failed, wherein the abnormality includes a failure to lock the virtual machine directory, a failure to release the lock on the locking disk, a failure to remove the lock on the locking disk, and a failure to update the virtual machine configuration table; the virtual machine directory is locked and removed, the virtual machine directory is cleared, and the locking disk is re-locked to restore the normal operation of the virtual machine.

[0117] In one embodiment, when the processor executes the computer program, the following steps are also implemented: in response to the virtual machine being in a shutdown state, directly removing the lock from the locking disk; after the virtual machine is powered on, locking the virtual machine directory using the lock information.

[0118] In one embodiment, when the processor executes the computer program, the following steps are also implemented: in response to the failure of the virtual machine update, an alarm is issued, and the virtual machine is restricted to only perform recovery operations; the cause of the failure of the virtual machine is determined, and a virtual machine recovery strategy is determined based on the cause of the failure; a recovery operation is performed on the virtual machine according to the virtual machine recovery strategy, and the virtual machine update process is re-executed on the virtual machine.

[0119] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0120] Deploy computing nodes and management nodes in the current cloud computing platform respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0121] Obtaining a locked disk of the virtual machine and a storage pool corresponding to the locked disk;

[0122] Creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory;

[0123] In response to the virtual machine being in a powered-on state, the virtual machine directory is locked using the lock information, and the locked disk is released and removed.

[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: adding a virtual machine interface in the computing node; in response to the existence of computing nodes of different versions in the cloud computing platform, unifying the interface support of each version of computing nodes for the updated virtual machine through the virtual machine interface; after completing the deployment of the computing node, updating the database table structure of the management node.

[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: adding a storage pool field and a lock information field where the virtual machine directory is located in the virtual machine configuration table; adding a controller table to the database, and establishing an association relationship between the controller table and the virtual machine configuration table.

[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to completing the deployment of the computing node and the management node, determining whether the virtual machine is currently executing a virtual machine task; in response to the virtual machine not currently executing a virtual machine task and the virtual machine is in a steady state, triggering a virtual machine update process, the steady state including a power-on state and a power-off state; creating a virtual machine directory corresponding to the virtual machine under the mount path of the storage pool; obtaining the configuration information of the virtual machine from the database, and generating a configuration file for the virtual machine based on the configuration information; copying the configuration file and the firmware configuration file of the virtual machine to the virtual machine directory; sending a lock request to the distributed lock manager corresponding to the storage pool where the virtual machine directory is located, the lock request being used to lock the virtual machine directory; and obtaining the lock information returned by the distributed lock manager in response to the lock request.

[0127] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a hot edit request for the virtual machine, determining the current state of the virtual machine; in response to the virtual machine being in a powered-on state, calling the virtual machine interface, locking the virtual machine directory through the lock information, wherein the lock information includes offset information; releasing the lock on the locked disk, and removing the lock after the lock is released successfully; updating the storage pool information where the virtual machine directory is located and the offset information to the storage pool field and the lock information field of the virtual machine configuration table respectively; deleting the original configuration file and the original firmware configuration file of the virtual machine; performing consistency check on the virtual machine; in response to the The consistency check result is consistent, and the virtual machine is determined to be updated successfully; in response to the consistency check result being inconsistent, the virtual machine state is marked as a data abnormal state, and the virtual machine update is determined to have failed; in response to an abnormality occurring during the update process of the virtual machine, the virtual machine is marked as an update abnormal state, and the virtual machine update is determined to have failed, wherein the abnormality includes a failure to lock the virtual machine directory, a failure to release the lock on the locking disk, a failure to remove the lock on the locking disk, and a failure to update the virtual machine configuration table; the virtual machine directory is locked and removed, the virtual machine directory is cleared, and the locking disk is re-locked to restore the normal operation of the virtual machine.

[0128] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the virtual machine being in a shutdown state, directly removing the lock from the locking disk; after the virtual machine is powered on, locking the virtual machine directory using the lock information.

[0129] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the failure of the virtual machine update, an alarm is issued, and the virtual machine is restricted to only perform recovery operations; the cause of the failure of the virtual machine is determined, and a virtual machine recovery strategy is determined based on the cause of the failure; a recovery operation is performed on the virtual machine according to the virtual machine recovery strategy, and the virtual machine update process is re-executed on the virtual machine.

[0130] In one embodiment, a computer product is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0131] Deploy computing nodes and management nodes in the current cloud computing platform respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version;

[0132] Obtaining a locked disk of the virtual machine and a storage pool corresponding to the locked disk;

[0133] Creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory;

[0134] In response to the virtual machine being in a powered-on state, the virtual machine directory is locked using the lock information, and the locked disk is released and removed.

[0135] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: adding a virtual machine interface in the computing node; in response to the existence of computing nodes of different versions in the cloud computing platform, unifying the interface support of each version of computing nodes for the updated virtual machine through the virtual machine interface; after completing the deployment of the computing node, updating the database table structure of the management node.

[0136] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: adding a storage pool field and a lock information field where the virtual machine directory is located in the virtual machine configuration table; adding a controller table to the database, and establishing an association relationship between the controller table and the virtual machine configuration table.

[0137] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to completing the deployment of the computing node and the management node, determining whether the virtual machine is currently executing a virtual machine task; in response to the virtual machine not currently executing a virtual machine task and the virtual machine is in a steady state, triggering a virtual machine update process, the steady state including a power-on state and a power-off state; creating a virtual machine directory corresponding to the virtual machine under the mount path of the storage pool; obtaining the configuration information of the virtual machine from the database, and generating a configuration file for the virtual machine based on the configuration information; copying the configuration file and the firmware configuration file of the virtual machine to the virtual machine directory; sending a lock request to the distributed lock manager corresponding to the storage pool where the virtual machine directory is located, the lock request being used to lock the virtual machine directory; and obtaining the lock information returned by the distributed lock manager in response to the lock request.

[0138] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a hot edit request for the virtual machine, determining the current state of the virtual machine; in response to the virtual machine being in a powered-on state, calling the virtual machine interface, locking the virtual machine directory through the lock information, wherein the lock information includes offset information; releasing the lock on the locked disk, and removing the lock after the lock is released successfully; updating the storage pool information where the virtual machine directory is located and the offset information to the storage pool field and the lock information field of the virtual machine configuration table respectively; deleting the original configuration file and the original firmware configuration file of the virtual machine; performing consistency check on the virtual machine; in response to the The consistency check result is consistent, and the virtual machine is determined to be updated successfully; in response to the consistency check result being inconsistent, the virtual machine state is marked as a data abnormal state, and the virtual machine update is determined to have failed; in response to an abnormality occurring during the update process of the virtual machine, the virtual machine is marked as an update abnormal state, and the virtual machine update is determined to have failed, wherein the abnormality includes a failure to lock the virtual machine directory, a failure to release the lock on the locking disk, a failure to remove the lock on the locking disk, and a failure to update the virtual machine configuration table; the virtual machine directory is locked and removed, the virtual machine directory is cleared, and the locking disk is re-locked to restore the normal operation of the virtual machine.

[0139] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the virtual machine being in a shutdown state, directly removing the lock from the locking disk; after the virtual machine is powered on, locking the virtual machine directory using the lock information.

[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to the failure of the virtual machine update, an alarm is issued, and the virtual machine is restricted to only perform recovery operations; the cause of the failure of the virtual machine is determined, and a virtual machine recovery strategy is determined based on the cause of the failure; a recovery operation is performed on the virtual machine according to the virtual machine recovery strategy, and the virtual machine update process is re-executed on the virtual machine.

[0141] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0142] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0143] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A virtual machine management method, characterized in that: include: Deploy computing nodes and management nodes in the current cloud computing platform respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version; Obtaining a locked disk of the virtual machine and a storage pool corresponding to the locked disk; Creating a virtual machine directory corresponding to the virtual machine in the storage pool, and acquiring lock information according to the virtual machine directory; In response to the virtual machine being in a powered-on state, the virtual machine directory is locked using the lock information, and the locked disk is released and removed.

2. The virtual machine management method according to claim 1, characterized in that: The computing nodes and management nodes are deployed separately in the current cloud computing platform, including: Adding a virtual machine interface in the computing node; In response to the existence of computing nodes of different versions in the cloud computing platform, unifying interface support of computing nodes of different versions for the updated virtual machine through the virtual machine interface; After the deployment of the computing nodes is completed, the database table structure of the management node is updated.

3. The virtual machine management method according to claim 2, characterized in that: The database table includes a virtual machine configuration table, and the updating of the database table structure of the management node includes: Adding a storage pool field where the virtual machine directory is located and a lock information field in the virtual machine configuration table; A controller table is added to the database, and an association relationship between the controller table and the virtual machine configuration table is established.

4. The virtual machine management method according to claim 3, characterized in that: The step of creating a virtual machine directory corresponding to the virtual machine in the storage pool and acquiring lock information according to the virtual machine directory includes: In response to completing the deployment of the computing node and the management node, determining whether the virtual machine is currently executing a virtual machine task; In response to the virtual machine not currently executing a virtual machine task and the virtual machine is in a steady state, triggering a virtual machine update process, wherein the steady state includes a power-on state and a power-off state; Creating a virtual machine directory corresponding to the virtual machine under the mount path of the storage pool; Acquire configuration information of the virtual machine from the database, and generate a configuration file of the virtual machine based on the configuration information; Copying the configuration file and firmware configuration file of the virtual machine to the virtual machine directory; Sending a lock request to a distributed lock manager corresponding to the storage pool where the virtual machine directory is located, wherein the lock request is used to lock the virtual machine directory; The lock information returned by the distributed lock manager in response to the lock request is obtained.

5. The virtual machine management method according to claim 3 or 4, characterized in that: In response to the virtual machine being in a powered-on state, locking the virtual machine directory through the lock information, and releasing and removing the lock from the locked disk, including: In response to a hot edit request for the virtual machine, determining a current state of the virtual machine; In response to the virtual machine being in a powered-on state, calling the virtual machine interface, and locking the virtual machine directory through the lock information, wherein the lock information includes offset information; Release the lock on the locked disk, and remove the lock after the lock is released successfully; The storage pool information where the virtual machine directory is located and the offset information are updated to the storage pool field and the lock information field of the virtual machine configuration table respectively; Deleting the original configuration file and the original firmware configuration file of the virtual machine; Performing consistency detection on the virtual machine; In response to the consistency detection result being consistent, determining that the virtual machine is updated successfully; In response to the consistency detection result being inconsistent, marking the virtual machine state as a data abnormal state, and determining that the virtual machine update fails; In response to an exception occurring during the update process of the virtual machine, marking the virtual machine as being in an update exception state, and determining that the update of the virtual machine has failed, wherein the exception includes a failure to lock the virtual machine directory, a failure to release the lock on the locked disk, a failure to remove the lock on the locked disk, and a failure to update the virtual machine configuration table; The virtual machine directory is locked and removed, the virtual machine directory is cleared, and the locked disk is locked again to restore the normal operation of the virtual machine.

6. The virtual machine management method according to claim 1, characterized in that: The method further comprises: In response to the virtual machine being in a shutdown state, directly removing the lock from the locked disk; After the virtual machine is powered on, the virtual machine directory is locked using the lock information.

7. The virtual machine management method according to claim 5, characterized in that: The method further comprises: In response to the virtual machine update failure, an alarm is issued, and the virtual machine is restricted to only perform a recovery operation; Determining a cause of the failure of the virtual machine and determining a virtual machine recovery strategy based on the cause of the failure; A recovery operation is performed on the virtual machine according to the virtual machine recovery policy, and a virtual machine update process is re-executed on the virtual machine.

8. A virtual machine management device, characterized in that: The device comprises: A deployment module, used to deploy computing nodes and management nodes in the current cloud computing platform, respectively, wherein the virtual machine is located in the computing node, and the management node is used to manage computing nodes of the same version and / or the previous version; An acquisition module, used to acquire a locking disk of the virtual machine and a storage pool corresponding to the locking disk; A creation module, used to create a virtual machine directory corresponding to the virtual machine in the storage pool, and obtain lock information according to the virtual machine directory; The execution module is used for locking the virtual machine directory through the lock information in response to the virtual machine being in the power-on state, and releasing and removing the lock from the locked disk.

9. A computer 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 computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.