WO2022151776A1 - Cloud platform virtual machine recycling method and computer device - Google Patents

Cloud platform virtual machine recycling method and computer device Download PDF

Info

Publication number
WO2022151776A1
WO2022151776A1 PCT/CN2021/123956 CN2021123956W WO2022151776A1 WO 2022151776 A1 WO2022151776 A1 WO 2022151776A1 CN 2021123956 W CN2021123956 W CN 2021123956W WO 2022151776 A1 WO2022151776 A1 WO 2022151776A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
deleted
state
cloud platform
virtual
Prior art date
Application number
PCT/CN2021/123956
Other languages
French (fr)
Chinese (zh)
Inventor
吴玥
包明生
王明星
Original Assignee
华云数据控股集团有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华云数据控股集团有限公司 filed Critical 华云数据控股集团有限公司
Publication of WO2022151776A1 publication Critical patent/WO2022151776A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45587Isolation or security of virtual machine instances

Definitions

  • the invention relates to the technical field of cloud computing, and in particular, to a cloud platform virtual machine recycling method and computer equipment.
  • Performing the recovery operation on the virtual machine in the cloud platform is a function of recovering the virtual machine as needed after the virtual machine deletion operation, so as to effectively recover the virtual machine deletion caused by the user's misoperation during the operation process, and improve the security and stability of the virtual machine. It effectively protects the user's data security and ensures a good user experience.
  • the Chinese invention patent with publication number CN109117251A discloses the prior art of "a method, device and readable storage medium for realizing a virtual machine recycle bin", which is based on the operating environment of the cloud platform of OpenStack.
  • the virtual machine in order to recycle a virtual machine, the virtual machine goes through a pause state and a shutdown state in sequence during the whole recycle operation, and completely deletes the information used by the virtual machine in the recycle bin after staying in the shutdown state for a period of time.
  • the system disk and data disk of the virtual machine are converted into images and stored in the image storage.
  • the system disk data and data disk data information in the recycle bin are deleted.
  • the prior art needs to store the data information of the virtual machine in the memory regardless of the state, so that the resource overhead of the computer forming the cloud platform is too large;
  • the disk and the data disk are saved separately, in fact, not only will the data remain, but also the operation will be cumbersome, and more seriously, the virtual machine will not be able to encapsulate the corresponding system disk and data disk into the original virtual machine when it is restored;
  • the prior art points out that a virtual machine is created by starting an image, a volume is created from a data disk image, and then the data disk is mounted on the virtual machine, so that virtual recovery can be completed.
  • the applicant points out that the technical solution completely deviates from the basic common sense of virtual machines.
  • the purpose of the present invention is to disclose a cloud platform virtual machine recycling method and computer equipment, which are used to solve the problem of performing efficient and safe recycling operations on virtual machines in different current states in the cloud platform, especially to avoid performing recycling operations on virtual machines.
  • resources such as computing resources and memory resources are occupied and wasted.
  • the present invention provides a cloud platform virtual machine recycling method, including:
  • the front-end receives the deletion instruction for the virtual machine, and after placing the virtual machine into the front-end recycle bin deployed on the front-end, the front-end sends a notification to the back-end;
  • the back-end receives the notification from the front-end and performs permission verification on the deletion instruction.
  • the deletion instruction that has passed the permission verification according to the current state of the virtual machine to be deleted, the corresponding virtual machine is put into the back-end deployed on the back-end for recycling.
  • the virtual machine to be deleted placed in the back-end recycling bin does not release the binding relationship between the virtual machine to be deleted and the virtual resource before executing the corresponding recycling thread.
  • the back-end recycle bin periodically checks the virtual machine that fails to release the binding relationship between the virtual machine to be deleted and the virtual resource, and performs forced recycling of the virtual machine.
  • the front end judges the current state of the virtual machine to be deleted, and only executes the recycling thread put into the back-end recycle bin for the virtual machine to be deleted whose current state is the shutdown state, the power-on state, the abnormal state and the unknown state. , returns an alarm message to the deletion command initiated by the virtual machine to be deleted that is not in the shutdown state, power-on state, abnormal state or unknown state, and refuses to put the virtual machine into the recycling thread of the back-end recycle bin deployed in the back-end.
  • the receiving instruction to delete the virtual machine is received in the front-end visual interface
  • the permission verification performed by the backend for the deletion instruction includes at least one of the following verification contents: user id, virtual machine id, virtual machine name, virtual machine state, operating system running the virtual machine, hardware information forming the virtual machine, deploying the virtual machine
  • the back-end When the back-end fails to perform permission verification on the deletion instruction based on the verification content, the back-end sends an instruction to abort the deletion operation to the front-end recycle bin, and the back-end receives the notification from the front-end and performs permission verification on the deletion instruction And after the permission verification of the deletion instruction is successful based on the verification content, the binding relationship between the virtual machine to be deleted and the virtual resource is released for the virtual machine to be deleted placed in the back-end recycle bin.
  • the binding relationship between the virtual machine and the virtual resource includes the binding established between the virtual machine and one or more of the virtual resources in the virtual network, security group, key pair or virtual disk. established relationship.
  • the front end includes at least one cloud platform, the front end is managed by the back end, the front end and the back end are logically independent of each other, and the back end is configured as a hybrid cloud management platform.
  • the availability zone is a virtual digital center, and establish an association relationship between virtual machines and different permissions configured for users in the availability zone, the availability zone is created by the hybrid cloud management platform, and the The availability zone includes at least one cloud platform, and the availability zone is managed by the backend.
  • the front-end is configured with a first database
  • the back-end is configured with a second database
  • the first database is used to record the status data of the virtual machines in the availability zone
  • the second database is used to record The verification content associated with the permission verification performed by the terminal on the deletion instruction, when the virtual machine to be deleted is recycled, the first database is updated through the second database
  • the availability zone stores at least one cloud operating system or virtual machine machine management program.
  • the virtual machine to be deleted when the current state of the virtual machine to be deleted is an unknown state, the virtual machine to be deleted is added to the list of virtual machines to be deleted, and the back-end creates an asynchronous virtual machine deletion thread to delete the virtual machine to be deleted
  • the delete operation is performed immediately after the machine is placed in the back-end recycle bin.
  • the field information retained in the second database of the virtual machine to be deleted is modified, and the modified field information is compared with the virtual machine to be deleted.
  • the mounted disk information and network configuration information are recorded in a log file, and the log file is saved to the second database for visual display to the front end.
  • the back-end when the current state of the virtual machine to be deleted is a power-on state or an abnormal state, the back-end performs the operation of adding the virtual machine in the power-on state and the deleted virtual machine to the list of virtual machines to be shut down, and the back-end Creates an asynchronous shutdown virtual machine thread.
  • the present invention also includes: using a comparison and exchange algorithm to update the virtual machine state data recorded in the first database with the underlying state data stored in the availability zone of at least one cloud operating system or a virtual machine management program; the The hybrid cloud management platform invokes the updated virtual machine state data in the first database, and updates the attributes of the same field in the second database.
  • it also includes: using a comparison and exchange algorithm to update the virtual machine state data recorded in the first database with the underlying state data stored in the availability zone of at least one cloud operating system or a virtual machine management program; the The second database directly calls the updated virtual machine state data in the first database, and updates the attributes of the same field in the second database.
  • the front end is configured as a distributed system architecture.
  • a computer device including:
  • the processor executes the steps in the cloud platform virtual machine recycling method according to any one of the above inventions.
  • the cloud platform virtual machine recycling method disclosed in the present application solves the problem that the cloud platform, especially the virtual machines with different current states including different types of cloud platforms, performs efficient and safe recycling operations, and significantly reduces the need for virtual machines. It reduces the occupation and waste of resources such as computing resources and memory resources during the process of recycling operations by the computer, which reduces the response time of concurrent operations;
  • the virtual machine recycling operation is effectively avoided.
  • the defect of unbinding the various resources previously configured by the virtual machine makes it possible to establish resource binding with the various resources and policies bound to the virtual machine before the virtual machine is executed and deleted after the virtual machine is restored due to the erroneous deletion operation.
  • the fixed relationship shortens the recovery speed of the virtual machines that have been put into the back-end recycle bin and the resources consumed by the recovery process, thereby indirectly improving the user experience.
  • Fig. 1 is the main flow chart of the cloud platform virtual machine recycling method
  • Figure 2 is an example diagram in which the hybrid cloud management platform creates multiple availability zones and each availability zone is composed of multiple cloud platforms of the same type;
  • Figure 3 is an example diagram in which the hybrid cloud management platform creates multiple availability zones and each availability zone is composed of multiple cloud platforms of different types;
  • Fig. 4 is the architecture diagram of realizing the virtual machine recycle bin in the cloud platform
  • FIG. 5 is a detailed flowchart of a method for reclaiming a virtual machine on a cloud platform according to the present invention, which includes the main thread of reclaiming the virtual machine, and, according to whether the state of the virtual machine is a power-on state or an unknown state, respectively starting asynchronously closing the virtual machine thread and asynchronously delete virtual machine threads;
  • FIG. 6 is an example diagram of a virtual machine recycle bin implementation device running a cloud platform virtual machine recycling method of the present invention, performing resource deletion and resource recovery on resources formed by each node in the cloud platform during the virtual machine recycling process;
  • FIG. 7 shows that the availability zone including at least one cloud platform is managed by the hybrid cloud management platform, and the updated virtual machine state data in the first database is called during the recovery operation for the virtual machine, and the same field in the second database is called.
  • FIG. 8 shows that the availability zone including at least one cloud platform is managed by the hybrid cloud management platform, and the updated virtual machine state data in the first database is called during the recovery operation of the virtual machine, and the same field in the second database is called.
  • Fig. 9 is the detailed flow chart of back-end putting virtual machines into the recycle bin in batch operation mode
  • Figure 10 is a detailed flowchart of the back-end putting virtual machines into the recycle bin in batch operation mode and performing verification by the back-end;
  • FIG. 11 is a topology diagram of a computer device running a cloud platform virtual machine recycling method of the present invention.
  • logic includes any physical and tangible function for performing a task.
  • each operation shown in the flowchart corresponds to a logical component for performing that operation.
  • Operations may be performed using, for example, software running on a computer device, hardware (eg, chip-implemented logic functions), etc., and/or any combination thereof.
  • logical components represent electrical components that are physical parts of a computer system, however implemented.
  • phrase “configured to” or the phrase “configured to” includes any manner in which any kind of physical and tangible function can be constructed to perform the identified operation. Functions may be configured to perform operations using, for example, software running on a computer device, hardware (eg, chip-implemented logic functions), etc., and/or any combination thereof.
  • the recycling method disclosed in this embodiment is initiated by the user in the visual operation interface in the first cloud platform 11 and/or the second cloud platform 21 in the availability zone 10 and/or the availability zone 20 .
  • the visual operation interface is embedded to form an operation window for administrators or users to perform recovery operations on virtual machines. Administrators or users can initiate operations on one or more virtual machines or several types of virtual machines of a cloud platform in the visual operation window. One or more virtual machines of the cloud platform perform the recycling operation.
  • the recycling method includes the following steps S1 to S2.
  • Step S1 the front end receives the deletion instruction for the virtual machine, and after placing the virtual machine in the front-end recycle bin deployed in the front-end, the front-end sends a notification to the back-end.
  • the front end includes at least one cloud platform, the front end is managed by the back end, the front end and the back end are logically independent from each other, and the back end is configured as the hybrid cloud management platform 100 .
  • the front end is configured as a distributed system architecture, and the front end can deploy multiple cloud platforms.
  • the use of a distributed system architecture is conducive to concurrent responses with multiple users, preprocessing and allocation of virtual resources, recording and calling of log files, authority verification, and data monitoring.
  • the virtual machine performs specific operation events such as recycling operations.
  • the front end can be understood as a visual operation interface capable of initiating a virtual machine recycling operation instruction.
  • the command to delete the virtual machine is received in the front-end visual interface.
  • pages such as the display of virtual machines, the deletion process, and the dialog box formed by deletion events are formed visually.
  • the front end judges the current state of the virtual machine to be deleted (that is, the virtual machine to be reclaimed), and only executes the execution of the virtual machine to be deleted whose current state is the shutdown state, the power-on state, the abnormal state and the unknown state, and puts it into the back-end recycle bin
  • the recycle thread of the server returns an alarm message to the deletion command initiated by the virtual machine to be deleted that is not in the shutdown state, startup state, abnormal state or unknown state, and refuses to put the virtual machine into the back-end recycle bin deployed on the back-end for recycling. in the thread. Therefore, in this embodiment, the term "to be deleted” and the term "to be recovered” have the same meaning.
  • the user can first select the virtual machine that needs to be put into the front-end recycle bin on the visual operation interface formed by the hybrid cloud management platform 100, and click the "Delete” button. "Shutdown”, “Power on”, “Unknown” and “Abnormal” status of virtual machines to perform recycling operations), a prompt box will pop up on the front-end page to prompt the user, and after the user confirms the name of the virtual machine that needs to be placed in the front-end recycling bin for the second time , after clicking the "Confirm” button, the request data is sent to the backend, which is deployed and runs in the hybrid cloud management platform 100 .
  • the operation request will be terminated.
  • the request url "placeVmInRecycleBin” will be used to send various data required for the operation based on the recycling virtual machine to the backend, including the user id. , virtual machine id, etc. to point to the determined virtual machine that needs to be reclaimed.
  • Step S2 the back end receives the notification sent by the front end and performs permission verification on the deletion instruction, and executes the corresponding deletion instruction according to the current state of the virtual machine to be deleted according to the current state of the virtual machine to be deleted.
  • the virtual machine to be deleted placed in the back-end recycling bin does not release the binding relationship between the virtual machine to be deleted and the virtual resource before executing the corresponding recycling thread.
  • the method further includes: the back-end recycle bin regularly checks the binding relationship between the virtual machine to be deleted and the virtual resource Decommission the failed virtual machine and perform a forced reclamation of the virtual machine.
  • the binding relationship between the virtual machine and the virtual resource includes the binding relationship established between the virtual machine and one or more virtual resources of a virtual network, a security group, a key pair, or a virtual disk.
  • the front-end recycle bin will It will first check the record that the corresponding key pair has been saved in the first database 15. When it is checked that the key pair has been bound to the virtual machine, an error will be thrown and an error message will be returned to the front-end, resulting in the Termination of the virtual machine's reclamation operation.
  • the front end After the front end gets the returned error message, it will prompt the user with the error message in a visual form such as a warning box. Therefore, through the above-mentioned binding relationship established for the key pair, it is possible to effectively avoid the erroneous recovery operation of the virtual machine caused by human error operation or malicious recovery operation during the process of recovering the virtual machine. It has important technical value in scenarios such as payment systems and settlement systems of online shopping platforms; and because the recovery method disclosed in this embodiment does not require the recovered virtual machine to reside in memory during the entire process of performing the recovery operation on the virtual machine , thereby effectively avoiding the disorderly occupation of physical resources and virtual resources of various types of cloud platforms, and improving the overall stability of the cloud platform.
  • the security and stability of the virtual machine deletion operation are improved, and the user data security is ensured; at the same time, it is also possible to effectively avoid the previously configured virtual machine caused by the recovery operation of the virtual machine.
  • the defect of unbinding various resources makes it possible to establish resource binding relationships with various resources and policies bound to the virtual machine before the virtual machine performs and delete operations after the virtual machine is restored due to the wrong deletion operation, which shortens the period of time.
  • the term "resource” may be understood as a physical resource and/or a virtual resource forming a virtual machine.
  • the virtual resources include resources 2a corresponding to computing nodes in the cloud platform, resources 2b corresponding to network nodes, resources 2c corresponding to storage nodes or resources 2d corresponding to control nodes.
  • the virtual machine recycle bin implementation device 400 running the cloud platform virtual machine recycling method of the present invention performs resource deletion and resource recovery on the resources formed by each node in the cloud platform during the virtual machine recycling process. After the virtual machine is reclaimed, the occupation of the above-mentioned one or more virtual resources by the virtual machine performing the reclamation operation is released.
  • the virtual machine recycle bin implementation apparatus 400 configures the cloud orchestration engine 1001, the virtualization engine 1002, and one or more hardware devices 20i.
  • the hardware device 20i may be a CPU, memory, firewall, memory, dedicated chip, physical network card, disk, and the like.
  • the cloud orchestration engine 1001 can be implemented by using a container (Docker) technology or Kubernetes.
  • the virtualization engine 1002 may employ a VMware virtualization engine.
  • the virtual machine and the function of performing recycling on the virtual machine are not bound to the underlying specific cloud orchestration engine 1001 or hardware device 20i on which a specific type of cloud platform depends, so it can be compatible with almost All mainstream cloud environments and mainstream hardware platforms can be adapted to operating systems such as Kirin, Kingdee, and Great Wall, or X86 hardware platforms or ARM architecture hardware platforms or MIPS architecture hardware platforms of different manufacturers.
  • the recycle bin back-end service 17 in the first cloud platform in FIG. 7 or FIG. 8 the back-end service 102 in the hybrid cloud management platform, the front-end recycle bin and the back-end recycle bin, etc.
  • the Docker method is packaged and deployed to form independent microservices (and developed based on the Java language), and all run in any Linux distribution server.
  • the development based on the Java language is inherently cross-platform, and the stored data is based on relational open source databases (for example, the first database 15 and the second database 25 ), which are mounted by the back-end service 102 in the hybrid cloud management platform in FIG. 7 .
  • the field "is_in_recycle_bin" contained in virtual_machine stored in the second database 25 records (ie, determines) whether the virtual machine is in the front-end recycle bin.
  • the first database 15 and the second database 25 can be deployed in various environments.
  • the front-end recycle bin is positioned as a sub-function on the side of the first cloud platform 11 or the second cloud platform 21
  • the back-end recycle bin is on the side of the hybrid cloud management platform 100 .
  • the first cloud platform 11 or the second cloud platform 21 can call the adapted gateway service in different cloud environments to complete the callback operation of the virtual machine state data and other data during the virtual machine recycling operation.
  • the binding relationship between the virtual machine entering the front-end recycle bin and the virtual network, security group, key pair, virtual disk, etc. still exists. If the deleted resource has been bound to the virtual machine in the front-end recycle bin, then Operation will be restricted. There is no limit to the storage time of virtual machines in the front-end recycle bin. Only virtual machines in the "off”, “on” and “unknown” states can be placed in the front-end recycle bin, and virtual machines in the "unknown" state are deleted immediately after being placed in the front-end recycle bin.
  • the permission verification performed by the backend for the deletion instruction includes at least one of the following verification contents: user id, virtual machine id, virtual machine name, virtual machine state, operating system running the virtual machine, hardware information forming the virtual machine, deploying the virtual machine The cloud platform information and the cluster attribute information of the cluster where the virtual machine is located.
  • the back-end recycle bin is logically located in the recycle bin interface 101 of the hybrid cloud management platform 100
  • the front-end recycle bin is logically located in the recycle bin interface 16 of the first cloud platform
  • the front-end recycle bin is connected to the back-end recycle bin. Recycle bins are independent of each other.
  • the front-end recycle bin and the back-end recycle bin in this embodiment are processes running in the hybrid cloud management platform 100 .
  • the affiliation formed by the virtual resources can be checked at the same time. If it is found that the project to which the virtual machine belongs is different from the project actually owned by the user, it will be regarded as an unauthorized operation, and any related operations to the virtual machine will be terminated. operation, and return the corresponding error information to the front end, and the front end will pop up a corresponding warning box to remind the user that the user does not have the permission to operate.
  • the affiliation formed by the virtual resources here includes not only the type of virtual resources associated with the virtual machine, but also the quota of the virtual resources associated with the virtual machine (for example, VM1 configures a 40G disk, VM2 configures a 50G disk), and even includes a virtual machine.
  • the configured virtual intranet IP address and virtual gateway, etc. As long as the virtual machine to be reclaimed cooperates with one or more of the above virtual resource types and/or virtual resources in the permission verification phase, or the configuration is inconsistent with the configuration previously issued by the user, it is determined that the user has no right to the virtual machine for recycling.
  • the hybrid cloud management platform 100 will continue to query the information corresponding to the virtual machine id in the first database 15, including but not limited to the name, status, cloud environment information, running status, task status, and cluster of the virtual machine. information and more. If the virtual machine information in the first database 15 is queried and returned as Null, the hybrid cloud management platform 100 will also interrupt the recycling operation and return an error code and prompt information to the front end, indicating that the information sent by the user is wrong and not Find the corresponding virtual machine information.
  • the reason why the virtual machines in the above four states can only be put into the front-end recycle bin is mainly because when the virtual machine is performing some important operations, suddenly putting it into the front-end recycle bin will affect the operation of the virtual machine. For example, when the virtual machine is creating, restarting, modifying the configuration, migrating, restoring, mirroring, and backing up, it is not supported to put it in the front-end recycle bin, so as to avoid responding to some important operations that the user's virtual machine is performing. Or when sensitive data is modified, accidental loss or damage caused by events placed in the front-end recycle bin.
  • the virtual machine recycle bin supports batch virtual machine operations and single virtual machine operations, and the single virtual machine operations and batch operations are substantially the same. Whether it is a batch or non-batch operation, the backend is required to query the virtual machine information from the second database 25, such as the data configured before the virtual machine is reclaimed, such as fields such as "environment”, "zone_id", etc. data to determine the corresponding cloud environment and cluster information, and determine the corresponding request cloud environment according to the above field data.
  • the backend is required to query the virtual machine information from the second database 25, such as the data configured before the virtual machine is reclaimed, such as fields such as "environment”, "zone_id", etc. data to determine the corresponding cloud environment and cluster information, and determine the corresponding request cloud environment according to the above field data.
  • the backend is required to query the virtual machine information from the second database 25, such as the data configured before the virtual machine is reclaimed, such as fields such as "environment”, "zone_id”, etc. data to determine the corresponding cloud environment and cluster information
  • Recycle Bin List which is used to cache the corresponding virtual machine.
  • the polled virtual machine information will be put into different queues according to different states. If it is a virtual machine in the "on” state, it will be added to the "standby virtual machine list” , if the current state of the virtual machine is "unknown", it will be added to the "list of virtual machines to be deleted". When the polling is over, it will check whether the "list of virtual machines to be shut down” and "list of virtual machines to be deleted" are empty. The steps of the recycle operation of the virtual machine. If the "list of virtual machines to be deleted" is not empty, the steps of reclaiming the virtual machines whose current state is in the "unknown” state will be performed one by one, as described below.
  • the polled virtual machine information will be put into different queues according to different states. ", if it is a virtual machine in the "abnormal” state, it will also be added to the "directly placed in the recycle bin list". When the polling is over, it will check whether “Put it directly into the recycle bin list” is empty (Null). If "Put it directly into the recycle bin list” is not empty, it will be executed one by one.
  • steps of recycling a virtual machine in the "shutdown" state please refer to the following.
  • step 401 the id of the virtual machine to be put into the recycle bin.
  • the recycle bin here is the front-end recycle bin.
  • Step 402 Query the corresponding virtual machine information in the first database 15 according to the virtual machine id.
  • Step 403 Determine whether the authority of the virtual machine meets the requirements, that is, the authority verification operation of the subject who initiates the operation on the virtual machine.
  • Step 405 Determine whether the state of the virtual machine is a power-on, power-off or abnormal state, if yes, execute step 406 in sequence; if not, jump to execute step 404: end and return an error prompt.
  • Step 406 Obtain information such as cloud environment and cluster corresponding to the virtual machine.
  • Step 407 Invoke the gateway service corresponding to the cloud environment for asynchronous processing.
  • Step 408 Determine whether the batch processing ends, if so, directly end and exit, if not, jump to step 401 .
  • step 501 is first performed: invoking the gateway service of the first cloud platform.
  • Step 502 Send virtual machine information such as virtual machine id, user id, etc. to the first cloud platform management system, and the first cloud platform management system runs in the first cloud platform 11 .
  • Step 503 The first cloud platform management system executes virtual machine recycling logic.
  • Step 504 Determine whether the execution is completed.
  • Step 505 The first cloud platform management system notifies the cloud gateway of the first cloud platform.
  • Step 506 The first cloud platform re-queries the corresponding virtual machine to assemble the latest data and calls back to the hybrid cloud management platform 100 .
  • Non-batch operation refers to performing the recycling operation on the virtual machines whose current status is "shutdown”, “startup”, “abnormal”, and “unknown” one by one. For details, see below.
  • the recycling method further includes: creating a plurality of availability zones at the front end, where the availability zones are virtual digital centers, and establishing an association relationship between virtual machines and different permissions configured for users in the availability zones 10 and 20,
  • the availability zones 10 and 20 are created by the hybrid cloud management platform 100
  • the availability zones 10 and 20 include at least one cloud platform
  • the availability zones 10 and 20 are managed by the backend.
  • the recycle bin interface 101 in the hybrid cloud management platform 100 in FIG. 7 or FIG. 8 and the backend service 102 in the hybrid cloud management platform jointly define the backend, which can be directly responded by the user.
  • the recycle bin interface 101 in the hybrid cloud management platform 100 sends a data request to the back-end service 102 in the hybrid cloud management platform, and the back-end service 102 in the hybrid cloud management platform sends the data request to the recycle bin interface 101 in the hybrid cloud management platform 100 Return user information.
  • the back-end service 102 in the hybrid cloud management platform and the first cloud platform 11 (or the second cloud platform 21 ) perform a call function/synchronize state.
  • the availability zone 10 (or availability zone 20 ) managed by the hybrid cloud management platform 100 includes one or several types of cloud platforms, whether the cloud platform is based on Archer OS (a subordinate concept of the first cloud platform 11 ) or WMware ESXi (The subordinate concept of the second cloud platform 21 ) is irrelevant.
  • the same Availability Zone 10 (or Availability Zone 20 ) may include the same cloud platform (as shown in FIG. 2 ), and the same Availability Zone 10 (or Availability Zone 20 ) may also include different cloud platforms (see FIG. 3 ). Show).
  • a first database 15 can be configured for the front end
  • a second database 25 is configured for the back end
  • the first database 15 is used to record the status of the virtual machines in the availability zones 10 and 20.
  • the second database 25 is used to record the verification content associated with the permission verification of the deletion instruction performed by the backend.
  • the second database 25 is used to update the first database 15 and Read the updated virtual machine state data.
  • Availability zones 10 and 20 store at least one cloud operating system or hypervisor.
  • the recycle bin interface 16 of the first cloud platform in FIG. 7 and FIG. 8 and the recycle bin backend service 17 in the first cloud platform jointly define the front end, which can be directly responded by the user.
  • the recycling method further includes: using a compare and swap algorithm (Compare And Swap, CAS mechanism) to store the underlying state of at least one cloud operating system or hypervisor in the availability zone 10 (or the availability zone 20 ).
  • the data updates the virtual machine state data recorded in the first database 15 .
  • the hybrid cloud management platform 100 calls the updated virtual machine state data in the first database 15 and updates the attributes of the same fields in the second database 25 .
  • the "state" field contained in the virtual machine state data will be updated to "Stopping”
  • the "update_time” field will be updated to the current time
  • the corresponding virtual machine information, mounted disk information, network information, etc. will be recorded in the log. in the file.
  • the recovery method further includes: using a comparison and exchange algorithm to store the underlying state data of at least one cloud operating system or a hypervisor for the first database 15 in the available zones 10 and 20 .
  • the state machine can be used to limit the recycling operation performed by the user on the virtual machine.
  • the CAS mechanism ensures that only one user can operate at a certain time. Assuming that user A successfully obtains the operation permission, when user A After the virtual machine is shut down, the state of the virtual machine changes to "shutting down", and the state machine mechanism ensures that all other operations cannot be performed. operation.
  • the cloud gateway of the first cloud platform 11 After the update of the virtual machine state data recorded in the first database 15 is completed, the cloud gateway of the first cloud platform 11 will be notified. At this time, the state of the virtual machine changes from "shutdown" state to "shutdown". After the cloud gateway is notified, it will re-query the latest information of the corresponding virtual machine in the first cloud platform 11 , and package the queried information and call back to the hybrid cloud management platform 100 .
  • the hybrid cloud management platform 100 After the hybrid cloud management platform 100 obtains the callback information, it will update the "is_in_recycle_bin" field in the corresponding virtual machine record in the database on the hybrid cloud management platform 100 side (ie, the second database 25 ), change it to "true”, and change "update_time” Modify the field to "Current Time” and update the "state” field to "Stop”.
  • the corresponding virtual machine information, mounted disk information, network information, etc. are recorded in the log file, and the execution result is returned to the front end.
  • the execution result returned to the front end includes the name of the virtual machine and the completion of the corresponding operation, etc. Then the front end will visually display the returned information to the user in the form of a prompt box or dialog box.
  • the log file is stored in the hybrid cloud management platform 100 .
  • the log file displays all information related to virtual machine operations, including but not limited to modification time, virtual machine name, modification content, operator, etc., which also brings a more intuitive method for later troubleshooting, the operation of virtual machine deletion. It will also perform detailed logging of the whole process.
  • the back-end log file recording interface provides powerful search and analysis functions in the back-end. Users can sort, search and paginate by name, modification time, virtual machine status, etc. Operation, the user can quickly locate the corresponding event in the massive log records, and learn the specific modification information or influence scope. If the customer virtual machine or data is lost due to human factors, the log file records can quickly locate the The specific person who initiates the virtual machine recycling operation, such as an administrator or user who does not have the operation authority.
  • the virtual machine to be deleted is added to the list of virtual machines to be deleted, and the back-end creates an asynchronous virtual machine deletion thread to put the to-be-deleted virtual machine in the back-end recycle bin delete immediately after.
  • the hybrid cloud management platform 100 will repackage the queried virtual machine information, the specific cloud environment where it is located, and the original request parameters (including the virtual machine ref_id , user id, etc.) to the cloud gateway (eg, ArcherOS gateway) of the first cloud platform, and the cloud gateway of the first cloud platform calls the corresponding first cloud platform 11 .
  • “unknown” refers to the state in which the state of the virtual machine changes and the exact state cannot be sensed due to the misoperation or error of the underlying layer.
  • the detailed execution steps in the first cloud platform 11 are shown in FIG. 5 , which will not be repeated here.
  • the cloud gateway of the first cloud platform will be notified, and the first The cloud gateway of a cloud platform will re-initiate a query request to the first database 15 to query the latest information of the virtual machine corresponding to the first cloud platform 11, and package the queried information and call it back to the hybrid cloud management platform 100.
  • the hybrid cloud After the management platform 100 obtains the message, it will update the data recorded in the second database 25 corresponding to the virtual machine. For example, at this time, the "state” field will be updated to "Deleting", and the "update_time” field will be updated to "current time”.
  • the machine information, mounted disk information and network information are recorded in the log file.
  • the platform 100 and the hybrid cloud management platform 100 will first query the resources associated with the virtual machine in the second database 25, such as disk information, network card information, key pair information, etc., and then delete all associated virtual machines. Resource data information, and release virtual resources to the resource pool at the same time. When all the associated resource data are deleted successfully, the records in the first database 15 corresponding to the virtual machine will be deleted, and the corresponding virtual machine detailed information, as well as the mounted disk information, network information, etc. will be recorded in the log. in the file. Push the final execution result of the virtual machine recycling operation in the unknown state to the front end and display it to the user.
  • the resources associated with the virtual machine in the second database 25 such as disk information, network card information, key pair information, etc.
  • the hybrid cloud management platform 100 will repackage the queried virtual machine information, the specific cloud environment where it is located, and the original request parameters (including the virtual machine ref_id, user id etc.) are forwarded to the cloud gateway of the first cloud platform, and the cloud gateway of the first cloud platform invokes the corresponding cloud environment of the first cloud platform 11 .
  • the detailed execution steps in the first cloud platform 11 are shown in FIG. 5 , which will not be repeated here.
  • the cloud gateway of the first cloud platform When the state of the virtual machine in the first cloud platform 11 changes (for example, the state of the virtual machine changes from the "on” state to the “shutdown” state), the cloud gateway of the first cloud platform will be notified, and the cloud gateway of the first cloud platform will be notified.
  • the gateway will re-initiate a query request to the first database 15 to query the latest information of the corresponding virtual machine in the first cloud platform 11, and wrap the queried information and call back the hybrid cloud management platform 100.
  • the hybrid cloud management platform 100 obtains the message
  • the data recorded in the second database 25 corresponding to the virtual machine will be updated. For example, the "state” field will be updated to "Stopping" and the "update_time” field will be updated to "current time”.
  • the disk information, network information, etc. are recorded in the log file.
  • the cloud gateway of the first cloud platform will be notified (the current state of the virtual machine changes from “shutdown” state to “shutdown” state), and the cloud gateway of the first cloud platform will re-report to the first database after being notified.
  • 15 initiates a query request to query the latest information of the corresponding virtual machine in the first cloud platform 11, and wraps the queried information and calls it back to the hybrid cloud management platform 100, and the hybrid cloud management platform 100 will update the second database after obtaining the callback information 25 corresponds to the "is_in_recycle_bin” field in the virtual machine record, change it to "true”, change the "update_time” field to "current time”, and update the "state” field to "Stop”.
  • the corresponding virtual machine information, mounted disk information and network information are recorded in the log file, and the execution result is returned to the front end, including the virtual machine name and the completion of the corresponding operation, etc., and then the front end will return the information through the Visual forms such as prompt boxes are fed back to users.
  • the hybrid cloud management platform 100 will repackage the queried virtual machine information, the specific cloud environment where it is located, and the original request parameters (including the virtual machine ref_id, user id, etc. ) is forwarded to the cloud gateway of the first cloud platform, and the cloud gateway of the first cloud platform invokes the corresponding cloud environment of the first cloud platform 11 .
  • the detailed flow of execution in the first cloud platform 11 is shown in FIG. 5 , and details are not repeated here.
  • the hybrid cloud management platform 100 When the operation of the first cloud platform 11 is completed, it will notify the cloud gateway of the first cloud platform 11. After the cloud gateway of the first cloud platform 11 is notified, it will re-query the latest information of the corresponding virtual machine in the first cloud platform 11, and will query The received information is packaged and called back to the hybrid cloud management platform 100. After the hybrid cloud management platform 100 obtains the callback information, it will modify the "is_in_recycle_bin" field in the corresponding virtual machine record in the virtual machine in the second database 25, and change it to "true” ", modify the "update_time” field to "current time”. At the same time, the corresponding virtual machine information, mounted disk information, network information, etc. are recorded in the log, and the execution result is returned to the front end.
  • the aforementioned execution result includes the name of the virtual machine and the completion of the corresponding operation, etc., and then the front end will The returned information is fed back to the user through visual means such as a prompt box.
  • the virtual machine in the "abnormal" state and the virtual machine in the "shutdown” state perform the same recycling operation manner and specific implementation process, so the description is omitted.
  • the back-end executes the operation of adding the virtual machine in the power-on state and executing the deletion to the list of virtual machines to be shut down, and the back-end creates a thread to shut down the virtual machine asynchronously.
  • the virtual machine reclaims the main thread 100 to jump to execute the asynchronous shutdown of the virtual machine thread 200, and for a virtual machine in an unknown state, the virtual machine reclaims the main thread 100 to jump to execute asynchronous deletion of the virtual machine thread. 300.
  • the applicant elaborates the above process in detail.
  • Step 101 Determine the identifier of the virtual machine to be put into the recycle bin, so as to determine the status data of the virtual machine to be reclaimed.
  • Step 102 Determine whether the virtual machine is in a state to be recycled, if not, end; if yes, jump to step 103.
  • Step 103 Determine whether the virtual machine is in a powered-on state, if so, go to step 21: add the virtual machine to the list of virtual machines to be shut down; if not, go to step 104: determine whether the virtual machine is in an unknown state, if yes, go to step 22 : add the virtual machine to the list of virtual machines to be deleted; if not, go to step 105 .
  • Step 105 Update the virtual machine recycle bin status to true, that is, the hybrid cloud management platform 100 modifies the obtained callback information in the "is_in_recycle_bin" field in the corresponding virtual machine record in the virtual machine in the second database 25, and changes it to " true", then jump to step 106.
  • Step 106 Determine whether the batch processing ends, if yes, skip to step 107; if not, return to step 101 to traverse and execute the above steps 101 to 105.
  • Step 107 determine whether the list of virtual machines to be shut down is empty, if not, jump to step 108 : create a new asynchronous shutdown virtual machine thread; if so, jump to step 109 . At the same time, step 109 is also jumped to after the execution of the newly created asynchronous shutdown virtual machine thread is completed.
  • Step 109 determine whether the list of virtual machines to be deleted is empty, if not, skip to step 110 : create a new asynchronous deletion virtual machine thread, if so, end directly.
  • the asynchronous shutdown virtual machine thread 200 shown in FIG. 5 will be newly started, and it will immediately return to the front end that the corresponding virtual machine is in operation, and the front end will display the returned information to the user.
  • the corresponding virtual machine database record (ie, the first database 15) in the first cloud platform 11 is first modified, and the field data indicating the virtual machine state is changed to "shutdown", and then the The virtual machine performs any other operations, thus ensuring the idempotency of interface operations by means of a state machine.
  • the asynchronous shutdown virtual machine thread 200 will read the previously queried virtual machine information, such as the ref_id, state, name and other fields corresponding to the virtual machine in the cloud orchestration engine 1001 and repackage them, and at the same time obtain the corresponding information through oAuth authentication the authorization code X-Auth-Token, and then call the shutdown service in the first cloud platform 11 and pass in the packaged request parameters.
  • the state of the virtual machine corresponding to the bottom layer will also become "shutdown".
  • the shutdown thread of the first cloud platform 11 that asynchronously shuts down the virtual machine thread will be timed. Polling for changes in the state of the bottom layer.
  • the first cloud platform 11 polls the cloud orchestration engine 1001 for a change in the state of the virtual machine, and the first cloud platform 11 will update the latest bottom layer state.
  • the corresponding virtual machine details, mounted disk information, network information, etc. are recorded in the log file, and the final execution result is pushed to the front end.
  • the details of the asynchronous shutdown of the virtual machine thread 200 are as follows.
  • the asynchronous shutdown virtual machine thread 200 invokes the list of virtual machines to be shut down by jumping to step 23 .
  • Step 201 Obtain a list of virtual machines to be shut down.
  • Step 202 Read the virtual machine information in the list of virtual machines to be shut down one by one, such as the aforementioned fields such as ref_id, status, and name.
  • Step 203 Create a new shutdown virtual machine thread, and perform polling check. If the virtual machine thread is not shut down at this time, create a new thread to execute step 206: call the shutdown interface; after the polling check, jump to step 204: determine to be shutdown Whether the virtual machine list is empty, if yes, go to step 205: end; if not, go back to step 202.
  • invoking the shutdown interface in step 206 is specifically calling a shutdown instruction adapted to the first cloud platform 11 and/or the second cloud platform 21 from the hybrid cloud management platform 100, and the shutdown instruction can be regarded as a process of performing a shutdown operation on the virtual machine between method calls.
  • step 207 is executed: the state of the virtual machine is updated to shutdown, and finally step 208 is executed: the state of the recycle bin of the virtual machine is updated to true, that is, the callback information obtained by the hybrid cloud management platform 100 is modified in the second database 25. Change the "is_in_recycle_bin" field in the corresponding virtual machine record in the virtual machine to "true”.
  • the asynchronous deletion of the virtual machine thread 300 is as follows.
  • the asynchronous deletion virtual machine thread 300 calls the list of virtual machines to be deleted by jumping to step 24 .
  • Step 301 Obtain a list of virtual machines to be deleted.
  • Step 302 Take out the virtual machine information in the list of virtual machines to be deleted one by one.
  • Step 303 Create a new virtual machine deletion thread, and perform polling check. If the virtual machine thread is not deleted at this time, create a new thread to execute Step 306: Call the delete virtual machine interface; after the polling check, jump to step 304: Judgment Whether the list of virtual machines to be deleted is empty, if yes, go to step 305 and end; if not, return to step 302 .
  • step 307 is executed: polling the deletion result, and finally jump to execute step 308: delete the corresponding virtual machine information from the second database 25.
  • the method for recycling a virtual machine of a cloud platform solves the problem that the cloud platform, especially the virtual machines with different current states in different types of cloud platforms, can perform efficient and safe recycling operations. Significantly reduces the occupation and waste of resources such as computing resources and memory resources during the recovery operation of the virtual machine, and reduces the response time of concurrent operations;
  • the virtual machine caused by performing the recycling operation on the virtual machine is effectively avoided.
  • the defect of unbinding of various resources previously configured makes it possible to establish a resource binding relationship with various resources and policies bound to the virtual machine before performing and deleting operations after the virtual machine is restored due to the wrong deletion operation , which shortens the recovery speed of the virtual machine that has been put into the back-end recycle bin and the resources consumed by the recovery process, thereby indirectly improving the user experience.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • this embodiment discloses a computer device 800 .
  • the computer device 800 executes the recovery method disclosed in the first embodiment.
  • the computer device 800 includes: a processor 51, a memory 52, and a computer program stored in the memory 52 and configured to be executed by the processor 51, the processor 51 executing the computer program described in the first embodiment when executing the computer program The steps in the cloud platform virtual machine recycling method.
  • the memory 52 is composed of several storage units, namely, the storage unit 521 to the storage unit 52i, wherein the parameter i takes a positive integer greater than or equal to two.
  • Both the processor 51 and the memory 52 are connected to the system bus 53 .
  • the form of the system bus 53 does not need to be specifically limited. I2C bus, SPI bus, SCI bus, PCI bus, PCI-e bus, ISA bus, etc., can be reasonably changed according to the specific type of the electronic device 500 and the requirements of application scenarios.
  • the system bus 53 is not the invention of the present application, so it will not be described in the present application.
  • the storage unit 52 in this embodiment may be a storage unit in a physical state, so that the computer device 800 can be understood as a computer or a computer cluster or a cluster server in a physical state; at the same time, the storage unit 52 may also be a virtual state.
  • the storage unit for example, is based on the virtual storage space formed by the physical storage device through the underlying virtualization technology, so that the computer device 800 is configured as a virtual device such as a cloud platform, a virtual server, and a virtual cluster, or the computer device 800 is understood as a PC, Tablets, smartphones, smart wearable electronics, physical clusters or data centers, etc.
  • a general-purpose processor may be a microprocessor, or alternatively, the general-purpose processor may be any conventional processor, controller, microcontroller, or state machine.
  • a processor may also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors in combination with a digital signal processor core, or any other similar configuration. accomplish.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention provides a cloud platform virtual machine recycling method and a computer device. The method comprises: a front end receives a deletion instruction for a virtual machine, places the virtual machine in a front-end recycle bin deployed at the front end, and then sends a notification to a rear end; the rear end receives the notification sent by the front end and performs permission check on the deletion instruction, and for the deletion instruction that passes permission check, separately and correspondingly places, according to the current state of a virtual machine to be deleted, the virtual machine in a recycling thread of a rear-end recycle bin deployed at the rear end; and the virtual machine to be deleted that is placed in the rear-end recycle bin does not unbind a binding relationship between the virtual machine to be deleted and a virtual resource before executing a corresponding recycling thread. The present invention improves the security and stability when executing the deletion operation of the virtual machine, ensures the data security of a user, reduces the resource consumption of the virtual machine placed in the recycle bin, reduces the response time of a concurrent operation, and greatly improves the user experience.

Description

一种云平台虚拟机回收方法及计算机设备A kind of cloud platform virtual machine recycling method and computer equipment
本申请要求了申请日为2021年01月12日,申请号为202110034978X,发明名称为“一种云平台虚拟机回收方法及计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application whose filing date is January 12, 2021, the application number is 202110034978X, and the invention title is "A method for recycling a virtual machine on a cloud platform and computer equipment", the entire contents of which are incorporated by reference in in this application.
技术领域technical field
本发明涉及云计算技术领域,尤其涉及一种云平台虚拟机回收方法及计算机设备。The invention relates to the technical field of cloud computing, and in particular, to a cloud platform virtual machine recycling method and computer equipment.
背景技术Background technique
对云平台中的虚拟机执行回收操作,是针对虚拟机删除操作后根据需要进行恢复的功能,以有效恢复用户在操作过程中由于误操作造成的虚拟机删除,提升虚拟机的安全性和稳定性,有效保护了用户的数据安全并确保良好的用户体验。Performing the recovery operation on the virtual machine in the cloud platform is a function of recovering the virtual machine as needed after the virtual machine deletion operation, so as to effectively recover the virtual machine deletion caused by the user's misoperation during the operation process, and improve the security and stability of the virtual machine. It effectively protects the user's data security and ensures a good user experience.
在现有技术中,对虚拟机的回收操作通常与云平台的编排引擎相互绑定,放入回收站的虚拟机会在一段时间内依然驻留在内存中,从而对部署云平台的计算机设备的物理内存和/或虚拟内存造成了巨大的资源消耗。同时,不同类型的云平台在执行资源编排时,如果与编排引擎相互绑定,则无法实现对虚拟机的回收功能。In the prior art, the recycle operation of virtual machines is usually bound to the orchestration engine of the cloud platform, and the virtual machines put into the recycle bin still reside in the memory for a period of time. Physical memory and/or virtual memory cause huge resource consumption. At the same time, when different types of cloud platforms perform resource orchestration, if they are bound to each other with the orchestration engine, the function of recycling virtual machines cannot be realized.
申请人经过检索后发现公开号CN109117251A的中国发明专利公开了“一种虚拟机回收站的实现方法、装置和可读存储介质”的现有技术,其基于OpenStack的云平台的运行环境。该现有技术为了对虚拟机的回收操作,在整个回收操作中虚拟机依次历经暂停状态与关机状态,并在关机状态停留一段时间后将虚拟机在回收站用的信息彻底删除。在暂停状态进入到关机状态时,将虚拟机的系统盘和数据盘都转化为镜像,保存在镜像存储中。同时,在关机状态停留一段时间后,删除回收站中的系统盘数据和数据盘数据信息。After searching, the applicant found that the Chinese invention patent with publication number CN109117251A discloses the prior art of "a method, device and readable storage medium for realizing a virtual machine recycle bin", which is based on the operating environment of the cloud platform of OpenStack. In the prior art, in order to recycle a virtual machine, the virtual machine goes through a pause state and a shutdown state in sequence during the whole recycle operation, and completely deletes the information used by the virtual machine in the recycle bin after staying in the shutdown state for a period of time. When the suspended state enters the shutdown state, the system disk and data disk of the virtual machine are converted into images and stored in the image storage. At the same time, after staying in the shutdown state for a period of time, the system disk data and data disk data information in the recycle bin are deleted.
申请人指出该现有技术无论在何种状态下都需要在内存中留驻虚拟机的数据信息,从而导致形成该云平台的计算机的资源开销过大;同时,该现有技术将虚拟机的系统盘与数据盘分别保存,事实上不仅会导致数据残留也会导致操作的繁琐,更加严重的是会导致虚拟机在被恢复时无法将对应的系统盘与数据盘对应封装成原始的虚拟机;此外,该现有技术在执行虚拟机恢复时指出通过启动镜像创建虚拟机,数据盘镜像创建卷,然后把数据盘挂载到虚拟机上,就能够完成虚拟的恢复。申请人指出该技术方案完全背离虚拟机的基本常识。The applicant pointed out that the prior art needs to store the data information of the virtual machine in the memory regardless of the state, so that the resource overhead of the computer forming the cloud platform is too large; The disk and the data disk are saved separately, in fact, not only will the data remain, but also the operation will be cumbersome, and more seriously, the virtual machine will not be able to encapsulate the corresponding system disk and data disk into the original virtual machine when it is restored; In addition, when performing virtual machine recovery, the prior art points out that a virtual machine is created by starting an image, a volume is created from a data disk image, and then the data disk is mounted on the virtual machine, so that virtual recovery can be completed. The applicant points out that the technical solution completely deviates from the basic common sense of virtual machines.
最后,上述现有技术采用功能性限定的描述方式限定了虚拟机回收站的实现装置,然而该现有技术并未从云计算及虚拟机的基础架构上阐述如何在OpenStack的云平台中实现其所谓的虚拟机回收机制及具体实现过程。此外,申请人指出其他相关现有技术也无法解决纳管多个不同类型的云平台场景中对不同类型的云平台中所创建及运行的虚拟机的回收操作。Finally, the above-mentioned prior art defines the implementation device of the virtual machine recycle bin in a functionally limited description manner. However, the prior art does not explain how to implement it in the cloud platform of OpenStack from the perspective of cloud computing and the infrastructure of the virtual machine. The so-called virtual machine recycling mechanism and the specific implementation process. In addition, the applicant points out that other related existing technologies cannot solve the recovery operation of virtual machines created and running in different types of cloud platforms in the scenario of hosting multiple different types of cloud platforms.
有鉴于此,有必要对现有技术中的云平台虚拟机回收方法予以改进,以解决上述问题。In view of this, it is necessary to improve the cloud platform virtual machine recycling method in the prior art to solve the above problems.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于揭示一种云平台虚拟机回收方法及计算机设备,用以解决云平台中不同的当前状态的虚拟机执行高效且安全的回收操作,尤其是为了避免在对虚拟机执行回收操作过程中造成对计算资源与内存资源等资源的占用与浪费。The purpose of the present invention is to disclose a cloud platform virtual machine recycling method and computer equipment, which are used to solve the problem of performing efficient and safe recycling operations on virtual machines in different current states in the cloud platform, especially to avoid performing recycling operations on virtual machines. In the process, resources such as computing resources and memory resources are occupied and wasted.
为实现上述第一个发明目的,本发明提供了一种云平台虚拟机回收方法,包括:In order to achieve the above-mentioned first purpose of the invention, the present invention provides a cloud platform virtual machine recycling method, including:
前端接收对虚拟机的删除指令,将虚拟机放入部署于前端的前端回收站后,由前端向后端发出通知;The front-end receives the deletion instruction for the virtual machine, and after placing the virtual machine into the front-end recycle bin deployed on the front-end, the front-end sends a notification to the back-end;
后端接收前端发出的通知并对删除指令进行权限校验,对通过权限校验的删除指令根据待删除的虚拟机的当前状态,分别执行对应的将虚拟机放入部署于后端的后端回收站的回收线程中,其中,放入后端回收站中的待删除的虚拟机在执行对应的回收线程之前不解除待删除的虚拟机与虚拟资源的绑定关系。The back-end receives the notification from the front-end and performs permission verification on the deletion instruction. For the deletion instruction that has passed the permission verification, according to the current state of the virtual machine to be deleted, the corresponding virtual machine is put into the back-end deployed on the back-end for recycling. In the recycling thread of the back-end recycling bin, the virtual machine to be deleted placed in the back-end recycling bin does not release the binding relationship between the virtual machine to be deleted and the virtual resource before executing the corresponding recycling thread.
作为本发明的进一步改进,将虚拟机放入部署后端的后端回收站的回收线程执行完毕后,还包括:As a further improvement of the present invention, after the recycle thread that puts the virtual machine into the back-end recycle bin of the deployment back-end is executed, it also includes:
后端回收站定期检查待删除的虚拟机与虚拟资源的绑定关系解除失败的虚拟机,并对虚拟机执行强制回收。The back-end recycle bin periodically checks the virtual machine that fails to release the binding relationship between the virtual machine to be deleted and the virtual resource, and performs forced recycling of the virtual machine.
作为本发明的进一步改进,前端判断待删除的虚拟机的当前状态,仅对当前状态为关机状态、开机状态、异常状态及未知状态的待删除的虚拟机执行放入后端回收站的回收线程,对不属于关机状态、开机状态、异常状态及未知状态的待删除的虚拟机所发起的删除指令返回告警信息,并拒绝将虚拟机放入部署于后端的后端回收站的回收线程中。As a further improvement of the present invention, the front end judges the current state of the virtual machine to be deleted, and only executes the recycling thread put into the back-end recycle bin for the virtual machine to be deleted whose current state is the shutdown state, the power-on state, the abnormal state and the unknown state. , returns an alarm message to the deletion command initiated by the virtual machine to be deleted that is not in the shutdown state, power-on state, abnormal state or unknown state, and refuses to put the virtual machine into the recycling thread of the back-end recycle bin deployed in the back-end.
作为本发明的进一步改进,所述接收对虚拟机的删除指令在前端的可视化界面中被接收;As a further improvement of the present invention, the receiving instruction to delete the virtual machine is received in the front-end visual interface;
后端对删除指令进行权限校验包含以下至少一种校验内容:用户id、虚拟机id、虚拟机名称、虚拟机状态、运行虚拟机的操作系统、形成虚拟机的硬件信息、部署虚拟机的云平台信息以及虚拟机所在集群的集群属性信息;The permission verification performed by the backend for the deletion instruction includes at least one of the following verification contents: user id, virtual machine id, virtual machine name, virtual machine state, operating system running the virtual machine, hardware information forming the virtual machine, deploying the virtual machine The cloud platform information and the cluster attribute information of the cluster where the virtual machine is located;
当后端基于所述校验内容对删除指令进行权限校验失败时,由后端向前端回收站发出中止删除操作的指令,所述后端接收前端发出的通知并对删除指令进行权限校验且基于所述校验内容对删除指令进行权限校验成功后,对放入后端回收站中的待删除的虚拟机解除待删除的虚拟机与虚拟资源的绑定关系。When the back-end fails to perform permission verification on the deletion instruction based on the verification content, the back-end sends an instruction to abort the deletion operation to the front-end recycle bin, and the back-end receives the notification from the front-end and performs permission verification on the deletion instruction And after the permission verification of the deletion instruction is successful based on the verification content, the binding relationship between the virtual machine to be deleted and the virtual resource is released for the virtual machine to be deleted placed in the back-end recycle bin.
作为本发明的进一步改进,所述虚拟机与虚拟资源的绑定关系包括虚拟机与虚拟网络、安全组、秘钥对或者虚拟磁盘中的一种或者几种的虚拟资源之间所建立的绑定关系。As a further improvement of the present invention, the binding relationship between the virtual machine and the virtual resource includes the binding established between the virtual machine and one or more of the virtual resources in the virtual network, security group, key pair or virtual disk. established relationship.
作为本发明的进一步改进,所述前端包含至少一种云平台,所述前端被后端纳管,所述前端与后端逻辑上相互独立,所述后端被配置为混合云管理平台。As a further improvement of the present invention, the front end includes at least one cloud platform, the front end is managed by the back end, the front end and the back end are logically independent of each other, and the back end is configured as a hybrid cloud management platform.
作为本发明的进一步改进,还包括:As a further improvement of the present invention, it also includes:
在前端创建多个可用区,所述可用区为虚拟数字中心,在所述可用区中建立虚拟机与对 用户配置的不同权限的关联关系,所述可用区由混合云管理平台创建,所述可用区中包含至少一种云平台,所述可用区被后端纳管。Create multiple availability zones at the front end, where the availability zone is a virtual digital center, and establish an association relationship between virtual machines and different permissions configured for users in the availability zone, the availability zone is created by the hybrid cloud management platform, and the The availability zone includes at least one cloud platform, and the availability zone is managed by the backend.
作为本发明的进一步改进,所述前端配置第一数据库,所述后端配置第二数据库,所述第一数据库用于记录可用区中虚拟机的状态数据,所述第二数据库用于记录后端对删除指令进行权限校验所关联的校验内容,当待删除的虚拟机被回收后,通过所述第二数据库对第一数据库进行更新;所述可用区存放至少一个云操作系统或者虚拟机管理程序。As a further improvement of the present invention, the front-end is configured with a first database, and the back-end is configured with a second database, the first database is used to record the status data of the virtual machines in the availability zone, and the second database is used to record The verification content associated with the permission verification performed by the terminal on the deletion instruction, when the virtual machine to be deleted is recycled, the first database is updated through the second database; the availability zone stores at least one cloud operating system or virtual machine machine management program.
作为本发明的进一步改进,待删除的虚拟机的当前状态为未知状态时,将待删除的虚拟机加入待删除虚拟机列表,并由后端创建异步删除虚拟机线程,以将待删除的虚拟机放入后端回收站后立即执行删除操作。As a further improvement of the present invention, when the current state of the virtual machine to be deleted is an unknown state, the virtual machine to be deleted is added to the list of virtual machines to be deleted, and the back-end creates an asynchronous virtual machine deletion thread to delete the virtual machine to be deleted The delete operation is performed immediately after the machine is placed in the back-end recycle bin.
作为本发明的进一步改进,待删除的虚拟机的当前状态为关机状态时,修改待删除的虚拟机在第二数据库中留存的字段信息,并将修改后的字段信息与待删除的虚拟机所挂载的磁盘信息及网络配置信息记录至日志文件,并将所述日志文件保存至第二数据库后向前端予以可视化展示。As a further improvement of the present invention, when the current state of the virtual machine to be deleted is the shutdown state, the field information retained in the second database of the virtual machine to be deleted is modified, and the modified field information is compared with the virtual machine to be deleted. The mounted disk information and network configuration information are recorded in a log file, and the log file is saved to the second database for visual display to the front end.
作为本发明的进一步改进,待删除的虚拟机的当前状态为开机状态或者异常状态时,由后端执行将开机状态并执行删除的虚拟机加入至待关机虚拟机列表的操作,并由后端创建异步关闭虚拟机线程。As a further improvement of the present invention, when the current state of the virtual machine to be deleted is a power-on state or an abnormal state, the back-end performs the operation of adding the virtual machine in the power-on state and the deleted virtual machine to the list of virtual machines to be shut down, and the back-end Creates an asynchronous shutdown virtual machine thread.
作为本发明的进一步改进,还包括:使用比较交换算法对可用区存放至少一个云操作系统或者虚拟机管理程序所具有的底层状态数据对第一数据库中记录的虚拟机状态数据进行更新;所述混合云管理平台调用第一数据库中更新后的虚拟机状态数据,并对第二数据库中相同字段的属性进行更新。As a further improvement of the present invention, it also includes: using a comparison and exchange algorithm to update the virtual machine state data recorded in the first database with the underlying state data stored in the availability zone of at least one cloud operating system or a virtual machine management program; the The hybrid cloud management platform invokes the updated virtual machine state data in the first database, and updates the attributes of the same field in the second database.
作为本发明的进一步改进,还包括:使用比较交换算法对可用区存放至少一个云操作系统或者虚拟机管理程序所具有的底层状态数据对第一数据库中记录的虚拟机状态数据进行更新;所述第二数据库直接调用第一数据库中更新后的虚拟机状态数据,并对第二数据库中相同字段的属性进行更新。As a further improvement of the present invention, it also includes: using a comparison and exchange algorithm to update the virtual machine state data recorded in the first database with the underlying state data stored in the availability zone of at least one cloud operating system or a virtual machine management program; the The second database directly calls the updated virtual machine state data in the first database, and updates the attributes of the same field in the second database.
作为本发明的进一步改进,所述前端被配置为分布式系统架构。As a further improvement of the present invention, the front end is configured as a distributed system architecture.
基于相同发明思想,本申请还揭示了一种计算机设备,包括:Based on the same inventive idea, the present application also discloses a computer device, including:
处理器,存储器,以及processor, memory, and
存储在所述存储器中且被配置为由所述处理器执行的计算机程序;a computer program stored in the memory and configured to be executed by the processor;
所述处理器在执行所述计算机程序时执行如上述任一项发明创造所述的云平台虚拟机回收方法中的步骤。When executing the computer program, the processor executes the steps in the cloud platform virtual machine recycling method according to any one of the above inventions.
与现有技术相比,本发明的有益效果是:Compared with the prior art, the beneficial effects of the present invention are:
首先,在本申请所揭示的云平台虚拟机回收方法,解决了云平台尤其是包含不同类型的云平台中具有不同的当前状态的虚拟机执行高效且安全的回收操作,显著地降低了对虚拟机执行回收操作过程中对计算资源与内存资源等资源的占用与浪费,降低了并发操作的响应时 间;First of all, the cloud platform virtual machine recycling method disclosed in the present application solves the problem that the cloud platform, especially the virtual machines with different current states including different types of cloud platforms, performs efficient and safe recycling operations, and significantly reduces the need for virtual machines. It reduces the occupation and waste of resources such as computing resources and memory resources during the process of recycling operations by the computer, which reduces the response time of concurrent operations;
同时,本申请所揭示的云平台虚拟机回收方法,由于将位于前端中的前端回收站与位于后端中的后端回收站相互分离,有效地避免了因对虚拟机执行回收操作所导致的虚拟机之前所配置的各种资源的解绑定的缺陷,使得因错误删除操作对虚拟机在恢复后能够与该虚拟机在执行与删除操作前所绑定的各种资源及策略建立资源绑定关系,缩短了已经放入后端回收站中的虚拟机的恢复速度及恢复过程所消耗的资源,由此间接地提高了用户体验。At the same time, in the cloud platform virtual machine recycling method disclosed in the present application, since the front-end recycling bin located in the front end and the back-end recycling bin located in the back end are separated from each other, the virtual machine recycling operation is effectively avoided. The defect of unbinding the various resources previously configured by the virtual machine makes it possible to establish resource binding with the various resources and policies bound to the virtual machine before the virtual machine is executed and deleted after the virtual machine is restored due to the erroneous deletion operation. The fixed relationship shortens the recovery speed of the virtual machines that have been put into the back-end recycle bin and the resources consumed by the recovery process, thereby indirectly improving the user experience.
附图说明Description of drawings
图1为云平台虚拟机回收方法的主流程图;Fig. 1 is the main flow chart of the cloud platform virtual machine recycling method;
图2为混合云管理平台创建多个可用区且每个可用区由多个相同类型的云平台组成的实例图;Figure 2 is an example diagram in which the hybrid cloud management platform creates multiple availability zones and each availability zone is composed of multiple cloud platforms of the same type;
图3为混合云管理平台创建多个可用区且每个可用区由多个不同类型的云平台组成的实例图;Figure 3 is an example diagram in which the hybrid cloud management platform creates multiple availability zones and each availability zone is composed of multiple cloud platforms of different types;
图4为云平台中实现虚拟机回收站的架构图;Fig. 4 is the architecture diagram of realizing the virtual machine recycle bin in the cloud platform;
图5为本发明一种云平台虚拟机回收方法的详细流程图,其中,包含虚拟机回收主线程,以及,根据虚拟机的状态分别为开机状态或者未知状态分别启动异步关闭虚拟机线程与异步删除虚拟机线程;FIG. 5 is a detailed flowchart of a method for reclaiming a virtual machine on a cloud platform according to the present invention, which includes the main thread of reclaiming the virtual machine, and, according to whether the state of the virtual machine is a power-on state or an unknown state, respectively starting asynchronously closing the virtual machine thread and asynchronously delete virtual machine threads;
图6为运行本发明一种云平台虚拟机回收方法的虚拟机回收站实现装置在虚拟机回收过程中对云平台中各个节点所形成的资源进行资源删除与资源恢复的示例图;6 is an example diagram of a virtual machine recycle bin implementation device running a cloud platform virtual machine recycling method of the present invention, performing resource deletion and resource recovery on resources formed by each node in the cloud platform during the virtual machine recycling process;
图7为包含至少一种云平台的可用区被混合云管理平台纳管并在对虚拟机执行回收操作过程中调用第一数据库中更新后的虚拟机状态数据,并对第二数据库中相同字段的属性进行更新在一种实例中的示意图;FIG. 7 shows that the availability zone including at least one cloud platform is managed by the hybrid cloud management platform, and the updated virtual machine state data in the first database is called during the recovery operation for the virtual machine, and the same field in the second database is called. Schematic diagram of the properties being updated in one instance;
图8为包含至少一种云平台的可用区被混合云管理平台纳管并在对虚拟机执行回收操作过程中调用第一数据库中更新后的虚拟机状态数据,并对第二数据库中相同字段的属性进行更新在另一种实例中的示意图;FIG. 8 shows that the availability zone including at least one cloud platform is managed by the hybrid cloud management platform, and the updated virtual machine state data in the first database is called during the recovery operation of the virtual machine, and the same field in the second database is called. Schematic diagram of the properties being updated in another instance;
图9为后端以批量操作方式将虚拟机放入回收站中的详细流程图;Fig. 9 is the detailed flow chart of back-end putting virtual machines into the recycle bin in batch operation mode;
图10为后端以批量操作方式将虚拟机放入回收站并由后端执行校验的详细流程图;Figure 10 is a detailed flowchart of the back-end putting virtual machines into the recycle bin in batch operation mode and performing verification by the back-end;
图11为运行本发明一种云平台虚拟机回收方法的一种计算机设备的拓扑图。FIG. 11 is a topology diagram of a computer device running a cloud platform virtual machine recycling method of the present invention.
具体实施方式Detailed ways
下面结合附图所示的各实施方式对本发明进行详细说明,但应当说明的是,这些实施方式并非对本发明的限制,本领域普通技术人员根据这些实施方式所作的功能、方法、或者结构上的等效变换或替代,均属于本发明的保护范围之内。The present invention will be described in detail below with reference to the various embodiments shown in the accompanying drawings, but it should be noted that these embodiments do not limit the present invention. Equivalent transformations or substitutions all fall within the protection scope of the present invention.
术语“逻辑”包括用于执行任务的任何物理和有形功能。例如,流程图中所示的每个操 作对应于用于执行该操作的逻辑组件。可以使用例如在计算机设备上运行的软件、硬件(例如,芯片实现的逻辑功能)等、和/或其任何组合来执行操作。当由计算设备实现时,逻辑组件表示作为无论以何种方式实现的计算机系统的物理部分的电组件。The term "logic" includes any physical and tangible function for performing a task. For example, each operation shown in the flowchart corresponds to a logical component for performing that operation. Operations may be performed using, for example, software running on a computer device, hardware (eg, chip-implemented logic functions), etc., and/or any combination thereof. When implemented by a computing device, logical components represent electrical components that are physical parts of a computer system, however implemented.
短语“配置为”或者短语“被配置为”包括可以构造任何种类的物理和有形的功能以执行标识的操作的任何方式。功能可以被配置为使用例如在计算机设备上运行的软件、硬件(例如,芯片实现的逻辑功能)等、和/或其任何组合来执行操作。The phrase "configured to" or the phrase "configured to" includes any manner in which any kind of physical and tangible function can be constructed to perform the identified operation. Functions may be configured to perform operations using, for example, software running on a computer device, hardware (eg, chip-implemented logic functions), etc., and/or any combination thereof.
实施例一:Example 1:
参图1至图10所揭示的本发明一种云平台虚拟机回收方法(以下简称“回收方法”)的详细实现过程。本实施例所揭示的该回收方法由用户在可用区10和/或可用区20的第一云平台11和/或第二云平台21中的可视化操作界面中发起。可视化操作界面中嵌布形成供管理员或者用户执行对虚拟机执行回收操作的操作视窗,管理员或者用户可在可视化的操作视窗中发起对一种云平台的一个或者多个虚拟机或者几种云平台的一个或者多个虚拟机执行回收操作。Referring to FIG. 1 to FIG. 10, the detailed implementation process of a cloud platform virtual machine recycling method (hereinafter referred to as "recycling method") of the present invention is disclosed. The recycling method disclosed in this embodiment is initiated by the user in the visual operation interface in the first cloud platform 11 and/or the second cloud platform 21 in the availability zone 10 and/or the availability zone 20 . The visual operation interface is embedded to form an operation window for administrators or users to perform recovery operations on virtual machines. Administrators or users can initiate operations on one or more virtual machines or several types of virtual machines of a cloud platform in the visual operation window. One or more virtual machines of the cloud platform perform the recycling operation.
该回收方法包括以下步骤S1至步骤S2。The recycling method includes the following steps S1 to S2.
步骤S1:前端接收对虚拟机的删除指令,将虚拟机放入部署于前端的前端回收站后,由前端向后端发出通知。前端包含至少一种云平台,所述前端被后端纳管,前端与后端逻辑上相互独立,后端被配置为混合云管理平台100。前端被配置为分布式系统架构,前端可部署多个云平台。采用分布式系统架构有利于与多个用户进行并发响应、虚拟资源的预处理与分配、日志文件的记录与调用、权限校验及数据监控等操作,并通过图4中的虚拟化引擎1002对虚拟机进行回收操作等具体的操作事件。Step S1: the front end receives the deletion instruction for the virtual machine, and after placing the virtual machine in the front-end recycle bin deployed in the front-end, the front-end sends a notification to the back-end. The front end includes at least one cloud platform, the front end is managed by the back end, the front end and the back end are logically independent from each other, and the back end is configured as the hybrid cloud management platform 100 . The front end is configured as a distributed system architecture, and the front end can deploy multiple cloud platforms. The use of a distributed system architecture is conducive to concurrent responses with multiple users, preprocessing and allocation of virtual resources, recording and calling of log files, authority verification, and data monitoring. The virtual machine performs specific operation events such as recycling operations.
在本实施例中,前端可被理解为能够发起虚拟机回收操作指令的可视化操作界面。接收对虚拟机的删除指令在前端的可视化界面中被接收。在前端中以可视化形成虚拟机的展示、删除过程、删除事件所形成的对话框等页面。In this embodiment, the front end can be understood as a visual operation interface capable of initiating a virtual machine recycling operation instruction. The command to delete the virtual machine is received in the front-end visual interface. In the front-end, pages such as the display of virtual machines, the deletion process, and the dialog box formed by deletion events are formed visually.
前端判断待删除的虚拟机(即待执行回收操作的虚拟机)的当前状态,仅对当前状态为关机状态、开机状态、异常状态及未知状态的待删除的虚拟机执行放入后端回收站的回收线程,对不属于关机状态、开机状态、异常状态及未知状态的待删除的虚拟机所发起的删除指令返回告警信息,并拒绝将虚拟机放入部署于后端的后端回收站的回收线程中。因此,在本实施例中,术语“待删除”与术语“待回收”具等同含义。The front end judges the current state of the virtual machine to be deleted (that is, the virtual machine to be reclaimed), and only executes the execution of the virtual machine to be deleted whose current state is the shutdown state, the power-on state, the abnormal state and the unknown state, and puts it into the back-end recycle bin The recycle thread of the server returns an alarm message to the deletion command initiated by the virtual machine to be deleted that is not in the shutdown state, startup state, abnormal state or unknown state, and refuses to put the virtual machine into the back-end recycle bin deployed on the back-end for recycling. in the thread. Therefore, in this embodiment, the term "to be deleted" and the term "to be recovered" have the same meaning.
用户可首先在混合云管理平台100所形成的可视化操作界面选择需要放入前端回收站中的虚拟机,并点击“删除”按钮,为了防止用户误删除虚拟机(即用户错误地将不属于呈“关机”、“开机”、“未知”及“异常”状态的虚拟机执行回收操作),前端页面会弹出提示框提示用户,并经过用户二次确认需要放入前端回收站的虚拟机名称后,点击“确认”按钮后,请求数据发送到后端,该后端部署并运行于混合云管理平台100中。The user can first select the virtual machine that needs to be put into the front-end recycle bin on the visual operation interface formed by the hybrid cloud management platform 100, and click the "Delete" button. "Shutdown", "Power on", "Unknown" and "Abnormal" status of virtual machines to perform recycling operations), a prompt box will pop up on the front-end page to prompt the user, and after the user confirms the name of the virtual machine that needs to be placed in the front-end recycling bin for the second time , after clicking the "Confirm" button, the request data is sent to the backend, which is deployed and runs in the hybrid cloud management platform 100 .
如果用点击“取消”按钮后,操作请求将会终止,当用户点击“确认”按钮后,会通过 请求url“placeVmInRecycleBin”向后端发送基于回收虚拟机操作所需要的各种数据,包括用户id,虚拟机id等,以指向确定的需要被执行回收操作的虚拟机。If the "Cancel" button is clicked, the operation request will be terminated. When the user clicks the "Confirm" button, the request url "placeVmInRecycleBin" will be used to send various data required for the operation based on the recycling virtual machine to the backend, including the user id. , virtual machine id, etc. to point to the determined virtual machine that needs to be reclaimed.
步骤S2:后端接收前端发出的通知并对删除指令进行权限校验,对通过权限校验的删除指令根据待删除的虚拟机的当前状态,分别执行对应的将虚拟机放入部署于后端的后端回收站的回收线程中,其中,放入后端回收站中的待删除的虚拟机在执行对应的回收线程之前不解除待删除的虚拟机与虚拟资源的绑定关系。优选的,在本实施例中,在将虚拟机放入部署后端的后端回收站的回收线程执行完毕后,还包括:后端回收站定期检查待删除的虚拟机与虚拟资源的绑定关系解除失败的虚拟机,并对虚拟机执行强制回收。Step S2: the back end receives the notification sent by the front end and performs permission verification on the deletion instruction, and executes the corresponding deletion instruction according to the current state of the virtual machine to be deleted according to the current state of the virtual machine to be deleted. In the recycling thread of the back-end recycling bin, the virtual machine to be deleted placed in the back-end recycling bin does not release the binding relationship between the virtual machine to be deleted and the virtual resource before executing the corresponding recycling thread. Preferably, in this embodiment, after the recycle thread of placing the virtual machine into the back-end recycle bin of the deployment backend is executed, the method further includes: the back-end recycle bin regularly checks the binding relationship between the virtual machine to be deleted and the virtual resource Decommission the failed virtual machine and perform a forced reclamation of the virtual machine.
在本实施例中,虚拟机与虚拟资源的绑定关系包括虚拟机与虚拟网络、安全组、秘钥对或者虚拟磁盘中的一种或者几种的虚拟资源之间所建立的绑定关系。以密钥对为例,如果密钥对已经绑定到了虚拟机上,同时此虚拟机又放入到了前端回收站中,则当用户在密钥对列表删除该密钥对时,前端回收站会首先检查对应密钥对已经保存在第一数据库15中的记录,当检查到该密钥对已经绑定到虚拟机上时,就会抛出错误同时返回给前端错误信息,并导致对该虚拟机的回收操作的终止。前端得到返回的错误信息后,会将错误信息通过警告框等可视化形式提示给用户。由此,通过上述对密钥对所建立的绑定关系,使得在回收虚拟机的过程中能够有效地避免人为误操作或者恶意的回收操作所导致的对虚拟机的错误回收操作,这在金融支付系统、在线购物平台的结算系统等场景中具有重要技术价值;而且由于本实施例所揭示的该回收方法在对虚拟机执行回收操作的整个过程中,不需要将回收后的虚拟机留驻内存,从而有效地避免了对各种类型的云平台的物理资源及虚拟资源的无序占用,并提高了云平台的整体稳定性。In this embodiment, the binding relationship between the virtual machine and the virtual resource includes the binding relationship established between the virtual machine and one or more virtual resources of a virtual network, a security group, a key pair, or a virtual disk. Taking the key pair as an example, if the key pair has been bound to the virtual machine and the virtual machine is placed in the front-end recycle bin, when the user deletes the key pair from the key pair list, the front-end recycle bin will It will first check the record that the corresponding key pair has been saved in the first database 15. When it is checked that the key pair has been bound to the virtual machine, an error will be thrown and an error message will be returned to the front-end, resulting in the Termination of the virtual machine's reclamation operation. After the front end gets the returned error message, it will prompt the user with the error message in a visual form such as a warning box. Therefore, through the above-mentioned binding relationship established for the key pair, it is possible to effectively avoid the erroneous recovery operation of the virtual machine caused by human error operation or malicious recovery operation during the process of recovering the virtual machine. It has important technical value in scenarios such as payment systems and settlement systems of online shopping platforms; and because the recovery method disclosed in this embodiment does not require the recovered virtual machine to reside in memory during the entire process of performing the recovery operation on the virtual machine , thereby effectively avoiding the disorderly occupation of physical resources and virtual resources of various types of cloud platforms, and improving the overall stability of the cloud platform.
虚拟机与其他类型的虚拟资源的绑定关系参上述所述,在此不再赘述。The binding relationship between the virtual machine and other types of virtual resources is referred to above, and is not repeated here.
通过上述技术方案,提高了执行虚拟机删除操作时的安全性和稳定性,确保了用户数据安全;同时,也能够有效地避免了因对虚拟机执行回收操作所导致的虚拟机之前所配置的各种资源的解绑定的缺陷,使得因错误删除操作对虚拟机在恢复后能够与该虚拟机在执行与删除操作前所绑定的各种资源及策略建立资源绑定关系,缩短了已经放入后端回收站中的虚拟机的恢复速度及恢复过程所消耗的资源。在本实施例中,术语“资源”可被理解为形成虚拟机的物理资源和/或虚拟资源。Through the above technical solutions, the security and stability of the virtual machine deletion operation are improved, and the user data security is ensured; at the same time, it is also possible to effectively avoid the previously configured virtual machine caused by the recovery operation of the virtual machine. The defect of unbinding various resources makes it possible to establish resource binding relationships with various resources and policies bound to the virtual machine before the virtual machine performs and delete operations after the virtual machine is restored due to the wrong deletion operation, which shortens the period of time. The recovery speed of virtual machines placed in the back-end recycle bin and the resources consumed by the recovery process. In this embodiment, the term "resource" may be understood as a physical resource and/or a virtual resource forming a virtual machine.
结合图6所示,该虚拟资源包括云平台中的计算节点对应资源2a,网络节点对应资源2b,存储节点对应资源2c或者控制节点对应资源2d。运行本发明一种云平台虚拟机回收方法的虚拟机回收站实现装置400在虚拟机回收过程中对云平台中各个节点所形成的资源进行资源删除与资源恢复。虚拟机在被回收后释放被执行回收操作的虚拟机对上述一种或者几种虚拟资源的占用。虚拟机回收站实现装置400配置云编排引擎1001、虚拟化引擎1002,以及一个或者多个硬件设备20i。硬件设备20i可为CPU、内存、防火墙、内存、专用芯片、物理网卡、磁盘等。同时结合图4所示,该云编排引擎1001可采用容器(Docker)技术或 者Kubernetes实现。虚拟化引擎1002可采用VMware虚拟化引擎。Referring to FIG. 6 , the virtual resources include resources 2a corresponding to computing nodes in the cloud platform, resources 2b corresponding to network nodes, resources 2c corresponding to storage nodes or resources 2d corresponding to control nodes. The virtual machine recycle bin implementation device 400 running the cloud platform virtual machine recycling method of the present invention performs resource deletion and resource recovery on the resources formed by each node in the cloud platform during the virtual machine recycling process. After the virtual machine is reclaimed, the occupation of the above-mentioned one or more virtual resources by the virtual machine performing the reclamation operation is released. The virtual machine recycle bin implementation apparatus 400 configures the cloud orchestration engine 1001, the virtualization engine 1002, and one or more hardware devices 20i. The hardware device 20i may be a CPU, memory, firewall, memory, dedicated chip, physical network card, disk, and the like. At the same time, as shown in FIG. 4 , the cloud orchestration engine 1001 can be implemented by using a container (Docker) technology or Kubernetes. The virtualization engine 1002 may employ a VMware virtualization engine.
本实施例所揭示的回收方法,虚拟机及对虚拟机执行回收的功能不与特定类型的云平台所依赖的底层特定的云编排引擎1001或硬件设备20i产生绑定,因此能够兼容市面上几乎所有主流的云环境和主流硬件平台,能够适配麒麟、金蝶、长城等操作系统或者不同厂商的X86型硬件平台或者ARM架构硬件平台或者MIPS架构硬件平台。In the recycling method disclosed in this embodiment, the virtual machine and the function of performing recycling on the virtual machine are not bound to the underlying specific cloud orchestration engine 1001 or hardware device 20i on which a specific type of cloud platform depends, so it can be compatible with almost All mainstream cloud environments and mainstream hardware platforms can be adapted to operating systems such as Kirin, Kingdee, and Great Wall, or X86 hardware platforms or ARM architecture hardware platforms or MIPS architecture hardware platforms of different manufacturers.
同时,在本实施例中,图7或者图8中的第一云平台中的回收站后端服务17、混合云管理平台中的后端服务102、前端回收站及后端回收站等可通过Docker方式打包部署以形成独立的微服务(并基于Java语言开发),并均在任何Linux发布版服务器中运行。同时,基于Java语言开发天生具有跨平台特性,存储数据基于关系型开源数据库(例如第一数据库15与第二数据库25),由图7中混合云管理平台中的后端服务102所挂载的第二数据库25中所保存的virtual_machine所含的字段“is_in_recycle_bin”来记录(即判断)虚拟机是否在前端回收站中。同时,第一数据库15与第二数据库25可以在多种环境下部署。前端回收站定位于第一云平台11或者第二云平台21一侧的一个子功能,而后端回收站则是偏向于混合云管理平台100的一侧。第一云平台11或者第二云平台21可在不同的云环境中调用适配的网关服务即可完成对虚拟机回收操作过程中虚拟机状态数据等数据的回调操作等。Meanwhile, in this embodiment, the recycle bin back-end service 17 in the first cloud platform in FIG. 7 or FIG. 8 , the back-end service 102 in the hybrid cloud management platform, the front-end recycle bin and the back-end recycle bin, etc. The Docker method is packaged and deployed to form independent microservices (and developed based on the Java language), and all run in any Linux distribution server. At the same time, the development based on the Java language is inherently cross-platform, and the stored data is based on relational open source databases (for example, the first database 15 and the second database 25 ), which are mounted by the back-end service 102 in the hybrid cloud management platform in FIG. 7 . The field "is_in_recycle_bin" contained in virtual_machine stored in the second database 25 records (ie, determines) whether the virtual machine is in the front-end recycle bin. Meanwhile, the first database 15 and the second database 25 can be deployed in various environments. The front-end recycle bin is positioned as a sub-function on the side of the first cloud platform 11 or the second cloud platform 21 , while the back-end recycle bin is on the side of the hybrid cloud management platform 100 . The first cloud platform 11 or the second cloud platform 21 can call the adapted gateway service in different cloud environments to complete the callback operation of the virtual machine state data and other data during the virtual machine recycling operation.
在本实施例中,进入前端回收站的虚拟机与虚拟网络、安全组、密钥对、虚拟磁盘等绑定关系仍然存在,如果删除的资源已绑定在前端回收站中的虚拟机,那么操作会受到限制。前端回收站中的虚拟机保存时间不做限制。只有“关机”、“开机”和“未知”状态的虚拟机可以放入前端回收站中,并且“未知”状态的虚拟机被放入前端回收站后会立即删除。In this embodiment, the binding relationship between the virtual machine entering the front-end recycle bin and the virtual network, security group, key pair, virtual disk, etc. still exists. If the deleted resource has been bound to the virtual machine in the front-end recycle bin, then Operation will be restricted. There is no limit to the storage time of virtual machines in the front-end recycle bin. Only virtual machines in the "off", "on" and "unknown" states can be placed in the front-end recycle bin, and virtual machines in the "unknown" state are deleted immediately after being placed in the front-end recycle bin.
后端对删除指令进行权限校验包含以下至少一种校验内容:用户id、虚拟机id、虚拟机名称、虚拟机状态、运行虚拟机的操作系统、形成虚拟机的硬件信息、部署虚拟机的云平台信息以及虚拟机所在集群的集群属性信息。当后端基于所述校验内容对删除指令进行权限校验失败时,由后端向前端回收站发出中止删除操作的指令,所述后端接收前端发出的通知并对删除指令进行权限校验且基于所述校验内容对删除指令进行权限校验成功后,对放入后端回收站中的待删除的虚拟机解除待删除的虚拟机与虚拟资源的绑定关系。在本实施例中,后端回收站逻辑上位于混合云管理平台100中的回收站界面101中,前端回收站逻辑上位于第一云平台的回收站界面16中,且前端回收站与后端回收站相互独立。同时,本实施例中的前端回收站与后端回收站是一种运行于混合云管理平台100中的进程。The permission verification performed by the backend for the deletion instruction includes at least one of the following verification contents: user id, virtual machine id, virtual machine name, virtual machine state, operating system running the virtual machine, hardware information forming the virtual machine, deploying the virtual machine The cloud platform information and the cluster attribute information of the cluster where the virtual machine is located. When the back-end fails to perform permission verification on the deletion instruction based on the verification content, the back-end sends an instruction to abort the deletion operation to the front-end recycle bin, and the back-end receives the notification from the front-end and performs permission verification on the deletion instruction And after the permission verification of the deletion instruction is successful based on the verification content, the virtual machine to be deleted placed in the back-end recycle bin is released from the binding relationship between the virtual machine to be deleted and the virtual resource. In this embodiment, the back-end recycle bin is logically located in the recycle bin interface 101 of the hybrid cloud management platform 100, the front-end recycle bin is logically located in the recycle bin interface 16 of the first cloud platform, and the front-end recycle bin is connected to the back-end recycle bin. Recycle bins are independent of each other. Meanwhile, the front-end recycle bin and the back-end recycle bin in this embodiment are processes running in the hybrid cloud management platform 100 .
在权限校验阶段中,可对虚拟资源所形成的隶属关系同时进行检验,如果发现虚拟机所属的项目与用户实际拥有的项目不相同,则被认定为越权操作,会终止任何有关对虚拟机的操作,并向前端返回对应的错误信息,前端会弹出对应的警告框提示用户没有操作权限。此处的虚拟资源所形成的隶属关系既包括虚拟机所关联的虚拟资源的种类,也包括虚拟机所关联的虚拟资源的配额(例如VM1配置40G磁盘,VM2配置50G磁盘),甚至包括虚拟机所配置的虚拟内网IP地址及虚拟网关等。只要待回收的虚拟机在权限校验阶段中上述一种或 者几种虚拟资源种类和/或虚拟资源的配合,或者配置与用户之前下发的配置不一致,则认定为该用户对虚拟机无权作回收操作。In the permission verification stage, the affiliation formed by the virtual resources can be checked at the same time. If it is found that the project to which the virtual machine belongs is different from the project actually owned by the user, it will be regarded as an unauthorized operation, and any related operations to the virtual machine will be terminated. operation, and return the corresponding error information to the front end, and the front end will pop up a corresponding warning box to remind the user that the user does not have the permission to operate. The affiliation formed by the virtual resources here includes not only the type of virtual resources associated with the virtual machine, but also the quota of the virtual resources associated with the virtual machine (for example, VM1 configures a 40G disk, VM2 configures a 50G disk), and even includes a virtual machine. The configured virtual intranet IP address and virtual gateway, etc. As long as the virtual machine to be reclaimed cooperates with one or more of the above virtual resource types and/or virtual resources in the permission verification phase, or the configuration is inconsistent with the configuration previously issued by the user, it is determined that the user has no right to the virtual machine for recycling.
当权限校验成功后,混合云管理平台100会继续查询第一数据库15中对应虚拟机id的信息,包括但不限于虚拟机的名称、状态、云环境信息、运行状态、任务状态、所在集群信息等等。如果在查询第一数据库15的虚拟机信息返回为空(Null)的话,混合云管理平台100也会导致回收操作中断并向前端返回错误码及提示信息,提示用户发送的信息是错误的,未找到对应的虚拟机信息。After the permission verification is successful, the hybrid cloud management platform 100 will continue to query the information corresponding to the virtual machine id in the first database 15, including but not limited to the name, status, cloud environment information, running status, task status, and cluster of the virtual machine. information and more. If the virtual machine information in the first database 15 is queried and returned as Null, the hybrid cloud management platform 100 will also interrupt the recycling operation and return an error code and prompt information to the front end, indicating that the information sent by the user is wrong and not Find the corresponding virtual machine information.
在本实施例中,仅会关注虚拟机当前的状态信息和集群信息,只有状态为“关机”、“开机”、“异常”、“未知”的虚拟机才能够被放入前端回收站中,并会将查询到的虚拟机状态与上述四个状态进行一一比对,如果不符合状态要求,任何对虚拟机执行的回收操作将禁止,并向前端返回错误码和提示信息,提示用户当前操作的虚拟机状态不符合放入前端回收站的要求。In this embodiment, only the current status information and cluster information of the virtual machine are concerned, and only the virtual machines whose status is "shutdown", "startup", "abnormal", and "unknown" can be put into the front-end recycle bin. It will compare the queried virtual machine status with the above four statuses one by one. If it does not meet the status requirements, any recycling operation of the virtual machine will be prohibited, and an error code and prompt information will be returned to the front end to remind the user of the current status. The virtual machine state of the operation does not meet the requirements to be placed in the front-end recycle bin.
在本实施例中,之所以只能将上述四种状态的虚拟机放入前端回收站中,主要是考虑到虚拟机正在进行某些重要操作时,突然放入前端回收站会对虚拟机运行的内部数据产生影响,例如虚拟机正在进行创建、重启、修改配置、迁移、还原、制作镜像、备份等操作时不支持放入前端回收站中,避免响应用户的虚拟机正在执行的一些重要操作或对敏感数据修改时,因执行放入前端回收站的事件而导致的意外丢失或损坏等不良现象。In this embodiment, the reason why the virtual machines in the above four states can only be put into the front-end recycle bin is mainly because when the virtual machine is performing some important operations, suddenly putting it into the front-end recycle bin will affect the operation of the virtual machine. For example, when the virtual machine is creating, restarting, modifying the configuration, migrating, restoring, mirroring, and backing up, it is not supported to put it in the front-end recycle bin, so as to avoid responding to some important operations that the user's virtual machine is performing. Or when sensitive data is modified, accidental loss or damage caused by events placed in the front-end recycle bin.
参图9与图10所示,在本实施例中,虚拟机回收站支持批量虚拟机操作和单个虚拟机操作的,单个虚拟机的操作和批量操作大体相同。不管是批量还是非批量操作,都需要借助后端并根据第二数据库25查询到的虚拟机信息,如虚拟机在被执行回收操作之前所配置的数据,例如“environment”,“zone_id”等字段数据,来确定对应的云环境和集群信息,并根据上述字段数据来确定对应的请求云环境。下文申请人将分别对回收虚拟机的非批量和批量操作的详细实现过程予以描述。Referring to FIG. 9 and FIG. 10 , in this embodiment, the virtual machine recycle bin supports batch virtual machine operations and single virtual machine operations, and the single virtual machine operations and batch operations are substantially the same. Whether it is a batch or non-batch operation, the backend is required to query the virtual machine information from the second database 25, such as the data configured before the virtual machine is reclaimed, such as fields such as "environment", "zone_id", etc. data to determine the corresponding cloud environment and cluster information, and determine the corresponding request cloud environment according to the above field data. The applicant will describe the detailed implementation process of the non-batch and batch operations of recycling virtual machines respectively below.
在批量操作过程中首先建立三个队列来存储需要异步处理的虚拟机和同步处理的虚拟机,三个队列分别为“待关机虚拟机列表”、“待删除虚拟机列表”,“直接放入回收站列表”,用于缓存对应的虚拟机。During the batch operation, three queues are first established to store virtual machines that need to be processed asynchronously and virtual machines that need to be processed synchronously. Recycle Bin List", which is used to cache the corresponding virtual machine.
对于异步操作的批量操作中会将轮询到的虚拟机信息根据不同的状态放入不同的队列中,如果是呈“开机”状态的虚拟机,会将其加入到“待关机虚拟机列表”中,如果当前状态呈“未知”状态的虚拟机,会将其加入到“待删除虚拟机列表”中。当轮询结束后,会检查一遍“待关机虚拟机列表”和“待删除虚拟机列表”是否为空,如果“待关机虚拟机列表”不为空,就会逐个执行对呈“开机”状态的虚拟机的回收操作的步骤。如果“待删除虚拟机列表”不为空,就会逐个执行对当前状态呈“未知”状态的虚拟机的回收操作的步骤,具体参下文所述。For the batch operation of asynchronous operations, the polled virtual machine information will be put into different queues according to different states. If it is a virtual machine in the "on" state, it will be added to the "standby virtual machine list" , if the current state of the virtual machine is "unknown", it will be added to the "list of virtual machines to be deleted". When the polling is over, it will check whether the "list of virtual machines to be shut down" and "list of virtual machines to be deleted" are empty. The steps of the recycle operation of the virtual machine. If the "list of virtual machines to be deleted" is not empty, the steps of reclaiming the virtual machines whose current state is in the "unknown" state will be performed one by one, as described below.
对于同步操作的批量操作中会将轮询到的虚拟机信息根据不同的状态放入不同的队列 中,如果是呈“关机”状态的虚拟机,会将其加入到“直接放入回收站列表”中,如果是呈“异常”状态的虚拟机,同样也会将其加入到“直接放入回收站列表”中。当轮询结束后,会检查一遍“直接放入回收站列表”是否为空(Null),如果“直接放入回收站列表”不为空,就会逐个执行就会逐个执行对当前状态呈“关机”状态的虚拟机的回收操作的步骤,具体参下文所述。For the batch operation of the synchronization operation, the polled virtual machine information will be put into different queues according to different states. ", if it is a virtual machine in the "abnormal" state, it will also be added to the "directly placed in the recycle bin list". When the polling is over, it will check whether "Put it directly into the recycle bin list" is empty (Null). If "Put it directly into the recycle bin list" is not empty, it will be executed one by one. For the steps of recycling a virtual machine in the "shutdown" state, please refer to the following.
具体的,参图9所示,步骤401:待放入回收站中的虚拟机id。此处的回收站即前端回收站。Specifically, as shown in FIG. 9 , step 401 : the id of the virtual machine to be put into the recycle bin. The recycle bin here is the front-end recycle bin.
步骤402:根据虚拟机id查询第一数据库15中对应的虚拟机信息。Step 402: Query the corresponding virtual machine information in the first database 15 according to the virtual machine id.
步骤403:判断虚拟机权限是否满足要求,即对虚拟机发起操作的主体的权限校验操作。Step 403: Determine whether the authority of the virtual machine meets the requirements, that is, the authority verification operation of the subject who initiates the operation on the virtual machine.
步骤405:判断虚拟机状态是为开机、关机或者异常状态,若是,顺序执行步骤406;若否,跳转执行步骤404:结束并返回错误提示。Step 405: Determine whether the state of the virtual machine is a power-on, power-off or abnormal state, if yes, execute step 406 in sequence; if not, jump to execute step 404: end and return an error prompt.
步骤406:获取对应虚拟机的云环境、集群等信息。Step 406: Obtain information such as cloud environment and cluster corresponding to the virtual machine.
步骤407:调用对应云环境的网关服务异步处理。Step 407: Invoke the gateway service corresponding to the cloud environment for asynchronous processing.
步骤408:判断批量处理是否结束,若是,则直接结束并退出,若否,跳转执行步骤401。Step 408 : Determine whether the batch processing ends, if so, directly end and exit, if not, jump to step 401 .
参图10所示,首先执行步骤501:调用第一云平台的网关服务。Referring to FIG. 10 , step 501 is first performed: invoking the gateway service of the first cloud platform.
步骤502:将虚拟机id,用户id等虚拟机信息发送至第一云平台管理系统,该第一云平台管理系统运行于第一云平台11中。Step 502 : Send virtual machine information such as virtual machine id, user id, etc. to the first cloud platform management system, and the first cloud platform management system runs in the first cloud platform 11 .
步骤503:第一云平台管理系统执行虚拟机回收逻辑。Step 503: The first cloud platform management system executes virtual machine recycling logic.
步骤504:判断是否执行完毕。Step 504: Determine whether the execution is completed.
步骤505:第一云平台管理系统通知第一云平台的云网关。Step 505: The first cloud platform management system notifies the cloud gateway of the first cloud platform.
步骤506:第一云平台重新查询对应的虚拟机组装出最新的数据回调给混合云管理平台100。Step 506 : The first cloud platform re-queries the corresponding virtual machine to assemble the latest data and calls back to the hybrid cloud management platform 100 .
非批量操作是指对当前状态为“关机”、“开机”、“异常”、“未知”状态的虚拟机逐一地执行回收操作,具体参下文所述。Non-batch operation refers to performing the recycling operation on the virtual machines whose current status is "shutdown", "startup", "abnormal", and "unknown" one by one. For details, see below.
在本实施例中,该回收方法还包括:在前端创建多个可用区,所述可用区为虚拟数字中心,在可用区10、20中建立虚拟机与对用户配置的不同权限的关联关系,可用区10、20由混合云管理平台100创建,可用区10、20中包含至少一种云平台,可用区10及可用区20被后端纳管。图7或者图8中混合云管理平台100中的回收站界面101与混合云管理平台中的后端服务102共同定义出后端,并可直接被用户所响应。混合云管理平台100中的回收站界面101发送数据请求至混合云管理平台中的后端服务102,并由混合云管理平台中的后端服务102向混合云管理平台100中的回收站界面101返回用户信息。混合云管理平台中的后端服务102与第一云平台11(或者第二云平台21)之间执行调用功能/同步状态。至于被混合云管理平台100所纳管的可用区10(或者可用区20)究竟包含一种还是几种类型云平台,云平台是基于Archer OS(第一云平台11的下位概念)还是WMware ESXi(第二云 平台21的下位概念)在所不问。同时,同一个可用区10(或者可用区20)可包含相同的云平台(参图2所示),同一个可用区10(或者可用区20)也可包含不同的云平台(参图3所示)。In this embodiment, the recycling method further includes: creating a plurality of availability zones at the front end, where the availability zones are virtual digital centers, and establishing an association relationship between virtual machines and different permissions configured for users in the availability zones 10 and 20, The availability zones 10 and 20 are created by the hybrid cloud management platform 100 , the availability zones 10 and 20 include at least one cloud platform, and the availability zones 10 and 20 are managed by the backend. The recycle bin interface 101 in the hybrid cloud management platform 100 in FIG. 7 or FIG. 8 and the backend service 102 in the hybrid cloud management platform jointly define the backend, which can be directly responded by the user. The recycle bin interface 101 in the hybrid cloud management platform 100 sends a data request to the back-end service 102 in the hybrid cloud management platform, and the back-end service 102 in the hybrid cloud management platform sends the data request to the recycle bin interface 101 in the hybrid cloud management platform 100 Return user information. The back-end service 102 in the hybrid cloud management platform and the first cloud platform 11 (or the second cloud platform 21 ) perform a call function/synchronize state. As for whether the availability zone 10 (or availability zone 20 ) managed by the hybrid cloud management platform 100 includes one or several types of cloud platforms, whether the cloud platform is based on Archer OS (a subordinate concept of the first cloud platform 11 ) or WMware ESXi (The subordinate concept of the second cloud platform 21 ) is irrelevant. Meanwhile, the same Availability Zone 10 (or Availability Zone 20 ) may include the same cloud platform (as shown in FIG. 2 ), and the same Availability Zone 10 (or Availability Zone 20 ) may also include different cloud platforms (see FIG. 3 ). Show).
结合图7与图8所示,优选的,可为前端配置第一数据库15,所述后端配置第二数据库25,所述第一数据库15用于记录可用区10、20中虚拟机的状态数据,所述第二数据库25用于记录后端对删除指令进行权限校验所关联的校验内容,当待删除的虚拟机被回收后,通过第二数据库25对第一数据库15进行更新并读取更新后的虚拟机状态数据。可用区10、20存放至少一个云操作系统或者虚拟机管理程序。图7与图8中的第一云平台的回收站界面16与第一云平台中的回收站后端服务17共同定义出前端,并可直接被用户所响应。7 and 8, preferably, a first database 15 can be configured for the front end, and a second database 25 is configured for the back end, and the first database 15 is used to record the status of the virtual machines in the availability zones 10 and 20. Data, the second database 25 is used to record the verification content associated with the permission verification of the deletion instruction performed by the backend. When the virtual machine to be deleted is recycled, the second database 25 is used to update the first database 15 and Read the updated virtual machine state data. Availability zones 10 and 20 store at least one cloud operating system or hypervisor. The recycle bin interface 16 of the first cloud platform in FIG. 7 and FIG. 8 and the recycle bin backend service 17 in the first cloud platform jointly define the front end, which can be directly responded by the user.
在本实施例中,该回收方法还包括:使用比较交换算法(Compare And Swap,CAS机制)对可用区10(或者可用区20)存放至少一个云操作系统或者虚拟机管理程序所具有的底层状态数据对第一数据库15中记录的虚拟机状态数据进行更新。混合云管理平台100调用第一数据库15中更新后的虚拟机状态数据,并对第二数据库25中相同字段的属性进行更新。In this embodiment, the recycling method further includes: using a compare and swap algorithm (Compare And Swap, CAS mechanism) to store the underlying state of at least one cloud operating system or hypervisor in the availability zone 10 (or the availability zone 20 ). The data updates the virtual machine state data recorded in the first database 15 . The hybrid cloud management platform 100 calls the updated virtual machine state data in the first database 15 and updates the attributes of the same fields in the second database 25 .
例如,虚拟机状态数据所包含的“state”字段会更新为“Stopping”,“update_time”字段更新为当前时间,同时将相应的虚拟机信息、挂载的磁盘信息、网络信息等都记录到日志文件当中。For example, the "state" field contained in the virtual machine state data will be updated to "Stopping", the "update_time" field will be updated to the current time, and the corresponding virtual machine information, mounted disk information, network information, etc. will be recorded in the log. in the file.
结合图7与图8所示,优选的,该回收方法还包括:使用比较交换算法对可用区10、20存放至少一个云操作系统或者虚拟机管理程序所具有的底层状态数据对第一数据库15中记录的虚拟机状态数据进行更新;所述第二数据库25直接调用第一数据库15中更新后的虚拟机状态数据,并对第二数据库25中相同字段的属性进行更新。As shown in FIG. 7 and FIG. 8 , preferably, the recovery method further includes: using a comparison and exchange algorithm to store the underlying state data of at least one cloud operating system or a hypervisor for the first database 15 in the available zones 10 and 20 . Update the virtual machine state data recorded in the second database 25; the second database 25 directly calls the updated virtual machine state data in the first database 15, and updates the attributes of the same fields in the second database 25.
更新虚拟机状态之前,首先拷贝第一数据库15所所保存的原始信息到内存中,并在内存中修改完虚拟机最新信息,保存到第一数据库15对应的虚拟机记录之前,比较第一数据库15所保存的最新信息是否与内存中的原始拷贝信息相同;如果相同,则表面在这段时间内没有其他人做了操作更新,便可更新第一数据库15对应的虚拟机记录信息,避免了脏数据;如果不同,则表面在这段时间内有其他人做了操作更新,此时如果继续更新数据库对应的虚拟机记录信息,则会产生脏数据。Before updating the state of the virtual machine, first copy the original information stored in the first database 15 into the memory, and modify the latest information of the virtual machine in the memory, and compare the first database before saving it to the virtual machine record corresponding to the first database 15 Whether the latest information saved in 15 is the same as the original copy information in the memory; if it is the same, it means that no one else has performed an operation update during this period of time, so the virtual machine record information corresponding to the first database 15 can be updated, avoiding the need for Dirty data; if it is different, it means that someone else has done an operation update during this period of time. At this time, if you continue to update the virtual machine record information corresponding to the database, dirty data will be generated.
如果发现第一数据库15所保存的虚拟机的最新信息与内存中的原始拷贝信息不同,那么就说明在此期间有其他用户改动了第一数据库15中虚拟机信息,那么此时的内存中的拷贝信息,及数据修改都作废,重新拷贝数据库最新信息到内存中,重复前面的过程,直到更新成功,或不满足条件终止。通过比较交换算法方式,保证了任何时刻只有一个用户的操作能够完整的实现,避免了脏数据的产生。If it is found that the latest information of the virtual machine saved in the first database 15 is different from the original copy information in the memory, it means that other users have changed the information of the virtual machine in the first database 15 during this period. Copy information and data modification are invalidated, re-copy the latest information of the database into memory, and repeat the previous process until the update is successful, or the conditions are not met and terminated. By comparing and exchanging algorithms, it is ensured that only one user's operation can be fully realized at any time, avoiding the generation of dirty data.
在本实施例中,可通过状态机(State Machine)限制用户对虚拟机所执行的回收操作,例如当某一个用户拿到资源的操作权限(可以理解为抽象的锁)后,以虚拟机关机为例,当 用户A、用户B、用户C等多个用户同时对虚拟机进行操作,通过CAS机制保证只有一个用户在某一时刻可以进行操作,假设用户A顺利拿到了操作权限,当用户A对虚拟机进行关机操作后,虚拟机状态变为“关机中”,此时状态机机制保证了所有其他操作不能进行,只有当“关机中”完成后,变为“已关机”状态才能进行别的操作。In this embodiment, the state machine (State Machine) can be used to limit the recycling operation performed by the user on the virtual machine. For example, when multiple users such as user A, user B, and user C operate the virtual machine at the same time, the CAS mechanism ensures that only one user can operate at a certain time. Assuming that user A successfully obtains the operation permission, when user A After the virtual machine is shut down, the state of the virtual machine changes to "shutting down", and the state machine mechanism ensures that all other operations cannot be performed. operation.
对第一数据库15中记录的虚拟机状态数据进行更新完成后会通知第一云平台11的云网关,此时虚拟机状态由“关机中”状态变为“关机”。云网关得到通知后会重新查询第一云平台11中对应虚拟机的最新信息,并将查询到的信息包装后回调给混合云管理平台100。混合云管理平台100得到回调信息后会更新混合云管理平台100侧的数据库(即第二数据库25)中对应虚拟机记录中的“is_in_recycle_bin”字段,将其改为“true”,将“update_time”字段修改为“当前时间”,将“state”字段更新为“Stop”。同时将相应的虚拟机信息、挂载的磁盘信息、网络信息等都记录到日志文件当中,并将执行结果返回给前端,返回给前端的执行结果包括虚拟机名称及对应操作的完成情况等,然后前端将返回信息通过提示框或者对话框的形式向用户进行可视化展示。具体的,在本实施例中,日志文件保存在混合云管理平台100中。After the update of the virtual machine state data recorded in the first database 15 is completed, the cloud gateway of the first cloud platform 11 will be notified. At this time, the state of the virtual machine changes from "shutdown" state to "shutdown". After the cloud gateway is notified, it will re-query the latest information of the corresponding virtual machine in the first cloud platform 11 , and package the queried information and call back to the hybrid cloud management platform 100 . After the hybrid cloud management platform 100 obtains the callback information, it will update the "is_in_recycle_bin" field in the corresponding virtual machine record in the database on the hybrid cloud management platform 100 side (ie, the second database 25 ), change it to "true", and change "update_time" Modify the field to "Current Time" and update the "state" field to "Stop". At the same time, the corresponding virtual machine information, mounted disk information, network information, etc. are recorded in the log file, and the execution result is returned to the front end. The execution result returned to the front end includes the name of the virtual machine and the completion of the corresponding operation, etc. Then the front end will visually display the returned information to the user in the form of a prompt box or dialog box. Specifically, in this embodiment, the log file is stored in the hybrid cloud management platform 100 .
日志文件显示所有和虚拟机操作相关的信息,包括但不仅限于修改时间、虚拟机名称、修改内容、操作人员等等,这样也为后期排查问题带来了更直观的办法,虚拟机删除的操作也会进行全过程的详细日志记录,同时在后端的日志文件记录界面,在后端中提供了强大的搜索和分析功能,用户可以按照名称、修改时间、虚拟机状态等进行排序、搜索及分页操作,用户可以在海量的日志记录中迅速定位到相应的事件,了解到具体涉及的修改信息或影响范围,如果因人为因素导致客户虚拟机或数据丢失等情况,可以通过日志文件记录迅速定位到具体的发起虚拟机回收操作的人员,例如不具有操作权限的管理员或者用户。The log file displays all information related to virtual machine operations, including but not limited to modification time, virtual machine name, modification content, operator, etc., which also brings a more intuitive method for later troubleshooting, the operation of virtual machine deletion. It will also perform detailed logging of the whole process. At the same time, the back-end log file recording interface provides powerful search and analysis functions in the back-end. Users can sort, search and paginate by name, modification time, virtual machine status, etc. Operation, the user can quickly locate the corresponding event in the massive log records, and learn the specific modification information or influence scope. If the customer virtual machine or data is lost due to human factors, the log file records can quickly locate the The specific person who initiates the virtual machine recycling operation, such as an administrator or user who does not have the operation authority.
待删除的虚拟机的当前状态为未知状态时,将待删除的虚拟机加入待删除虚拟机列表,并由后端创建异步删除虚拟机线程,以将待删除的虚拟机放入后端回收站后立即执行删除操作。When the current state of the virtual machine to be deleted is unknown, the virtual machine to be deleted is added to the list of virtual machines to be deleted, and the back-end creates an asynchronous virtual machine deletion thread to put the to-be-deleted virtual machine in the back-end recycle bin delete immediately after.
如果待执行回收操作的虚拟机的当前状态呈“未知”状态,混合云管理平台100会将查询到的虚拟机信息以及所在的具体云环境,及原始请求参数重新包装后,(包含虚拟机ref_id,用户id等)转发给第一云平台的云网关(例如ArcherOS网关),第一云平台的云网关调用对应的第一云平台11。其中,“未知”是指由于底层误操作或者错误,导致虚拟机状态发生变化同时不能够感知到确切状态的状态。If the current state of the virtual machine to be reclaimed is "unknown", the hybrid cloud management platform 100 will repackage the queried virtual machine information, the specific cloud environment where it is located, and the original request parameters (including the virtual machine ref_id , user id, etc.) to the cloud gateway (eg, ArcherOS gateway) of the first cloud platform, and the cloud gateway of the first cloud platform calls the corresponding first cloud platform 11 . Among them, "unknown" refers to the state in which the state of the virtual machine changes and the exact state cannot be sensed due to the misoperation or error of the underlying layer.
在第一云平台11中的详细执行步骤如图5所示,在此不再赘述。当前端中的第一云平台11的虚拟机的状态发生变化时(此时虚拟机的当前状态由“未知”状态变为“删除中”状态),会通知第一云平台的云网关,第一云平台的云网关会重新向第一数据库15发起查询请求,以查询第一云平台11中对应的虚拟机最新信息,并将查询到的信息包装后回调至混合云管理平台100,混合云管理平台100得到消息后会更新第二数据库25中对应虚拟机记 录的数据,比如此时“state”字段会更新为“Deleting”,“update_time”字段更新为“当前时间”,同时将相应的虚拟机信息、挂载的磁盘信息及网络信息等都记录到日志文件中。The detailed execution steps in the first cloud platform 11 are shown in FIG. 5 , which will not be repeated here. When the state of the virtual machine of the first cloud platform 11 in the front end changes (the current state of the virtual machine changes from "unknown" state to "deleting" state), the cloud gateway of the first cloud platform will be notified, and the first The cloud gateway of a cloud platform will re-initiate a query request to the first database 15 to query the latest information of the virtual machine corresponding to the first cloud platform 11, and package the queried information and call it back to the hybrid cloud management platform 100. The hybrid cloud After the management platform 100 obtains the message, it will update the data recorded in the second database 25 corresponding to the virtual machine. For example, at this time, the "state" field will be updated to "Deleting", and the "update_time" field will be updated to "current time". The machine information, mounted disk information and network information are recorded in the log file.
第一云平台11操作完成后会通知第一云平台的云网关(备注:此时第一云平台中已删除对应的虚拟机),第一云平台的云网关得到通知后会回调混合云管理平台100,混合云管理平台100得到回调信息后会首先查询在第二数据库25中与该虚拟机关联的资源,比如磁盘信息、网卡信息、密钥对信息等等,然后首先删除所有的关联虚拟资源的数据信息,同时释放虚拟资源到资源池中。当所有关联资源数据都删除成功以后,会将该虚拟机对应的在第一数据库15中的记录删除,同时将相应的虚拟机详细信息,以及挂载的磁盘信息,网络信息等都记录到日志文件当中。将最终的对未知状态的虚拟机回收操作的执行结果推送给前端并显示给用户。After the operation of the first cloud platform 11 is completed, it will notify the cloud gateway of the first cloud platform (Note: the corresponding virtual machine has been deleted in the first cloud platform at this time), and the cloud gateway of the first cloud platform will call back the hybrid cloud management after being notified. After obtaining the callback information, the platform 100 and the hybrid cloud management platform 100 will first query the resources associated with the virtual machine in the second database 25, such as disk information, network card information, key pair information, etc., and then delete all associated virtual machines. Resource data information, and release virtual resources to the resource pool at the same time. When all the associated resource data are deleted successfully, the records in the first database 15 corresponding to the virtual machine will be deleted, and the corresponding virtual machine detailed information, as well as the mounted disk information, network information, etc. will be recorded in the log. in the file. Push the final execution result of the virtual machine recycling operation in the unknown state to the front end and display it to the user.
如果待执行回收操作的虚拟机呈“开机”状态,混合云管理平台100会将查询到的虚拟机信息以及所在的具体云环境,及原始请求参数重新包装后,(包含虚拟机ref_id,用户id等)转发给第一云平台的云网关,第一云平台的云网关调用对应的第一云平台11云环境。在第一云平台11中的详细执行步骤如如图5所示,在此不再赘述。If the virtual machine to be reclaimed is in the "on" state, the hybrid cloud management platform 100 will repackage the queried virtual machine information, the specific cloud environment where it is located, and the original request parameters (including the virtual machine ref_id, user id etc.) are forwarded to the cloud gateway of the first cloud platform, and the cloud gateway of the first cloud platform invokes the corresponding cloud environment of the first cloud platform 11 . The detailed execution steps in the first cloud platform 11 are shown in FIG. 5 , which will not be repeated here.
当第一云平台11中的虚拟机有状态变化时(例如:虚拟机状态由“开机”状态变为“关机中”状态),会通知第一云平台的云网关,第一云平台的云网关会重新向第一数据库15发起查询请求,以查询第一云平台11中对应的虚拟机最新信息,并将查询到的信息包装后回调混合云管理平台100,混合云管理平台100得到消息后会更第二数据库25中对应虚拟机记录的数据,比如此时“state”字段会更新为“Stopping”,“update_time”字段更新为“当前时间”,同时将相应的虚拟机信息,以及挂载的磁盘信息,网络信息等都记录到日志文件中。When the state of the virtual machine in the first cloud platform 11 changes (for example, the state of the virtual machine changes from the "on" state to the "shutdown" state), the cloud gateway of the first cloud platform will be notified, and the cloud gateway of the first cloud platform will be notified. The gateway will re-initiate a query request to the first database 15 to query the latest information of the corresponding virtual machine in the first cloud platform 11, and wrap the queried information and call back the hybrid cloud management platform 100. After the hybrid cloud management platform 100 obtains the message The data recorded in the second database 25 corresponding to the virtual machine will be updated. For example, the "state" field will be updated to "Stopping" and the "update_time" field will be updated to "current time". The disk information, network information, etc. are recorded in the log file.
操作完成后会通知第一云平台的云网关(此时虚拟机的当前状态由“关机中”状态变为“关机”状态),第一云平台的云网关得到通知后会重新向第一数据库15发起查询请求,以查询第一云平台11中对应虚拟机的最新信息,并将查询到的信息包装后回调至混合云管理平台100,混合云管理平台100得到回调信息后会更新第二数据库25中对应虚拟机记录中的“is_in_recycle_bin”字段,将其改为“true”,将“update_time”字段修改为“当前时间”,将“state”字段更新为“Stop”。同时将相应的虚拟机信息、挂载的磁盘信息及网络信息等都记录到日志文件中,并将执行结果返回给前端,包括虚拟机名称及对应操作的完成情况等,然后前端将返回信息通过提示框等可视化形式反馈给用户。After the operation is completed, the cloud gateway of the first cloud platform will be notified (the current state of the virtual machine changes from "shutdown" state to "shutdown" state), and the cloud gateway of the first cloud platform will re-report to the first database after being notified. 15 initiates a query request to query the latest information of the corresponding virtual machine in the first cloud platform 11, and wraps the queried information and calls it back to the hybrid cloud management platform 100, and the hybrid cloud management platform 100 will update the second database after obtaining the callback information 25 corresponds to the "is_in_recycle_bin" field in the virtual machine record, change it to "true", change the "update_time" field to "current time", and update the "state" field to "Stop". At the same time, the corresponding virtual machine information, mounted disk information and network information are recorded in the log file, and the execution result is returned to the front end, including the virtual machine name and the completion of the corresponding operation, etc., and then the front end will return the information through the Visual forms such as prompt boxes are fed back to users.
如果待执行回收操作的虚拟机呈“关机”状态,混合云管理平台100会将查询到的虚拟机信息以及所在的具体云环境以及原始请求参数重新包装后,(包含虚拟机ref_id,用户id等)转发给第一云平台的云网关,第一云平台的云网关调用对应的第一云平台11的云环境。在第一云平台11中的执行详细流程如图5所示,在此不再赘述。If the virtual machine to be reclaimed is in the "shutdown" state, the hybrid cloud management platform 100 will repackage the queried virtual machine information, the specific cloud environment where it is located, and the original request parameters (including the virtual machine ref_id, user id, etc. ) is forwarded to the cloud gateway of the first cloud platform, and the cloud gateway of the first cloud platform invokes the corresponding cloud environment of the first cloud platform 11 . The detailed flow of execution in the first cloud platform 11 is shown in FIG. 5 , and details are not repeated here.
当第一云平台11操作完成后会通知第一云平台11的云网关,第一云平台11的云网关 得到通知后会重新查询第一云平台11中对应虚拟机的最新信息,并将查询到的信息包装后回调至混合云管理平台100,混合云管理平台100得到回调信息后会修改第二数据库25中的虚拟机中对应虚拟机记录中的“is_in_recycle_bin”字段,将其改为“true”,将“update_time”字段修改为“当前时间”。同时将相应的虚拟机信息,以及挂载的磁盘信息,网络信息等都记录到日志当中,并将执行结果返回给前端,前述执行结果包括虚拟机名称及对应操作的完成情况等,然后前端将返回信息通过提示框等可视化方式反馈给用户。呈“异常”状态的虚拟机与呈“关机”状态的虚拟机执行回收操作方式及具体实现过程相同,故予以省略描述。When the operation of the first cloud platform 11 is completed, it will notify the cloud gateway of the first cloud platform 11. After the cloud gateway of the first cloud platform 11 is notified, it will re-query the latest information of the corresponding virtual machine in the first cloud platform 11, and will query The received information is packaged and called back to the hybrid cloud management platform 100. After the hybrid cloud management platform 100 obtains the callback information, it will modify the "is_in_recycle_bin" field in the corresponding virtual machine record in the virtual machine in the second database 25, and change it to "true" ", modify the "update_time" field to "current time". At the same time, the corresponding virtual machine information, mounted disk information, network information, etc. are recorded in the log, and the execution result is returned to the front end. The aforementioned execution result includes the name of the virtual machine and the completion of the corresponding operation, etc., and then the front end will The returned information is fed back to the user through visual means such as a prompt box. The virtual machine in the "abnormal" state and the virtual machine in the "shutdown" state perform the same recycling operation manner and specific implementation process, so the description is omitted.
待删除的虚拟机的当前状态为“关机”状态时,修改待删除的虚拟机在第二数据库25中留存的字段信息,并将修改后的字段信息与待删除的虚拟机所挂载的磁盘信息及网络配置信息记录至日志文件,并将所述日志文件保存至第二数据库25后向前端予以可视化展示。When the current state of the virtual machine to be deleted is the "shutdown" state, modify the field information retained in the second database 25 of the virtual machine to be deleted, and associate the modified field information with the disk mounted on the virtual machine to be deleted. The information and network configuration information are recorded in a log file, and the log file is saved to the second database 25 and displayed to the front end visually.
待删除的虚拟机的当前状态为开机状态或者异常状态时,由后端执行将开机状态并执行删除的虚拟机加入至待关机虚拟机列表的操作,并由后端创建异步关闭虚拟机线程。When the current state of the virtual machine to be deleted is the power-on state or abnormal state, the back-end executes the operation of adding the virtual machine in the power-on state and executing the deletion to the list of virtual machines to be shut down, and the back-end creates a thread to shut down the virtual machine asynchronously.
参图5所示,对于开机状态的虚拟机由虚拟机回收主线程100跳转执行异步关闭虚拟机线程200,对于未知状态的虚拟机由虚拟机回收主线程100跳转执行异步删除虚拟机线程300。申请人对上述过程予以详细阐述。Referring to FIG. 5 , for a virtual machine in a powered-on state, the virtual machine reclaims the main thread 100 to jump to execute the asynchronous shutdown of the virtual machine thread 200, and for a virtual machine in an unknown state, the virtual machine reclaims the main thread 100 to jump to execute asynchronous deletion of the virtual machine thread. 300. The applicant elaborates the above process in detail.
开始。start.
步骤101:确定待放入回收站中的虚拟机标识,从而确定待执行回收操作的虚拟机的状态数据。Step 101: Determine the identifier of the virtual machine to be put into the recycle bin, so as to determine the status data of the virtual machine to be reclaimed.
步骤102:判断虚拟机是否待回收状态,若否,则结束;若是,跳转执行步骤103。Step 102: Determine whether the virtual machine is in a state to be recycled, if not, end; if yes, jump to step 103.
步骤103:判断虚拟机是否为开机状态,如是,则执行步骤21:将虚拟机加入待关机虚拟机列表;若否,则执行步骤104:判断虚拟机是否为未知状态,若是,则执行步骤22:将虚拟机加入待删除虚拟机列表;若否,执行步骤105。Step 103: Determine whether the virtual machine is in a powered-on state, if so, go to step 21: add the virtual machine to the list of virtual machines to be shut down; if not, go to step 104: determine whether the virtual machine is in an unknown state, if yes, go to step 22 : add the virtual machine to the list of virtual machines to be deleted; if not, go to step 105 .
步骤105:更新虚拟机回收站状态为true,即由混合云管理平台100将得到的回调信息修改第二数据库25中的虚拟机中对应虚拟机记录中的“is_in_recycle_bin”字段,将其改为“true”,然后,跳转执行步骤106。Step 105: Update the virtual machine recycle bin status to true, that is, the hybrid cloud management platform 100 modifies the obtained callback information in the "is_in_recycle_bin" field in the corresponding virtual machine record in the virtual machine in the second database 25, and changes it to " true", then jump to step 106.
步骤106:判断批量处理是否结束,若是,则跳转执行步骤107;若否,则返回执行步骤101,以遍历执行上述步骤101~步骤105。Step 106: Determine whether the batch processing ends, if yes, skip to step 107; if not, return to step 101 to traverse and execute the above steps 101 to 105.
步骤107:判断待关机虚拟机列表是否为空,若否,则跳转执行步骤108:新建异步关闭虚拟机线程;若是,则跳转执行步骤109。同时,在新建异步关闭虚拟机线程执行完毕后同样跳转执行步骤109。Step 107 : determine whether the list of virtual machines to be shut down is empty, if not, jump to step 108 : create a new asynchronous shutdown virtual machine thread; if so, jump to step 109 . At the same time, step 109 is also jumped to after the execution of the newly created asynchronous shutdown virtual machine thread is completed.
步骤109:判断待删除虚拟机列表是否为空,若否,则跳转执行步骤110:新建异步删除虚拟机线程,若是,则直接结束。Step 109 : determine whether the list of virtual machines to be deleted is empty, if not, skip to step 110 : create a new asynchronous deletion virtual machine thread, if so, end directly.
当检测到虚拟机呈“开机”状态,会新启动图5中异步关闭虚拟机线程200,并立即返回给前端对应的虚拟机正在操作中,前端将返回的信息显示给用户。When it is detected that the virtual machine is in the "on" state, the asynchronous shutdown virtual machine thread 200 shown in FIG. 5 will be newly started, and it will immediately return to the front end that the corresponding virtual machine is in operation, and the front end will display the returned information to the user.
在异步关闭虚拟机线程200中,首先会修改第一云平台11中对应的虚拟机数据库记录(即第一数据库15),将表示虚拟机状态的字段数据改为“关机中”,之后禁止对虚拟机进行其他的任何操作,从而通过状态机的方式确保了接口操作的幂等性。之后该异步关闭虚拟机线程200中会读取之前查询到的虚拟机信息,例如该虚拟机在云编排引擎1001中对应的ref_id、状态、名称等字段并重新包装,同时通过oAuth认证拿到对应的授权码X-Auth-Token,然后调用第一云平台11中的关机服务并传入包装好的请求参数。In the asynchronous shutdown of the virtual machine thread 200, the corresponding virtual machine database record (ie, the first database 15) in the first cloud platform 11 is first modified, and the field data indicating the virtual machine state is changed to "shutdown", and then the The virtual machine performs any other operations, thus ensuring the idempotency of interface operations by means of a state machine. After that, the asynchronous shutdown virtual machine thread 200 will read the previously queried virtual machine information, such as the ref_id, state, name and other fields corresponding to the virtual machine in the cloud orchestration engine 1001 and repackage them, and at the same time obtain the corresponding information through oAuth authentication the authorization code X-Auth-Token, and then call the shutdown service in the first cloud platform 11 and pass in the packaged request parameters.
当成功调用第一云平台11所传入的请求参数以后,底层对应的虚拟机状态也将变为“关机中”,此时第一云平台11中的异步关闭虚拟机线程的关机线程会定时轮询底层的状态变化,当云编排引擎1001完成虚拟机关机操作后,第一云平台11轮询到云编排引擎1001中的虚拟机状态发生改变,第一云平台11会将最新的底层状态数据更新第一云平台11的数据库信息,例如将“is_in_recycle_bin”字段,将其改为“true”,将“update_time”字段修改为“当前时间”,将“state”字段改为“Stop”已关机状态。同时将相应的虚拟机详细信息、挂载的磁盘信息、网络信息等都记录到日志文件中,并将最终的执行结果推送给前端。When the request parameters passed in by the first cloud platform 11 are successfully called, the state of the virtual machine corresponding to the bottom layer will also become "shutdown". At this time, the shutdown thread of the first cloud platform 11 that asynchronously shuts down the virtual machine thread will be timed. Polling for changes in the state of the bottom layer. After the cloud orchestration engine 1001 completes the virtual machine shutdown operation, the first cloud platform 11 polls the cloud orchestration engine 1001 for a change in the state of the virtual machine, and the first cloud platform 11 will update the latest bottom layer state. Data update the database information of the first cloud platform 11, for example, change the "is_in_recycle_bin" field to "true", change the "update_time" field to "current time", and change the "state" field to "Stop" Shut down state. At the same time, the corresponding virtual machine details, mounted disk information, network information, etc. are recorded in the log file, and the final execution result is pushed to the front end.
异步关闭虚拟机线程200具体如下所示。The details of the asynchronous shutdown of the virtual machine thread 200 are as follows.
异步关闭虚拟机线程200通过跳转步骤23调用待关机虚拟机列表。The asynchronous shutdown virtual machine thread 200 invokes the list of virtual machines to be shut down by jumping to step 23 .
步骤201:获取待关机虚拟机列表。Step 201: Obtain a list of virtual machines to be shut down.
步骤202:逐个读取待关机虚拟机列表中的虚拟机信息,例如前述ref_id、状态、名称等字段。Step 202: Read the virtual machine information in the list of virtual machines to be shut down one by one, such as the aforementioned fields such as ref_id, status, and name.
步骤203:新建关闭虚拟机线程,并轮询检查,如果此时没有关闭虚拟机线程,则新建线程,以执行步骤206:调用关机接口;轮询检查结束后跳转执行步骤204:判断待关机虚拟机列表是否为空,若是,则跳转步骤205:结束;若否,则返回执行步骤202。其中,步骤206中调用关机接口具体为从混合云管理平台100中调用适配第一云平台11和/或第二云平台21的关机指令,关机指令可视为对虚拟机执行关机操作的进程间的方法调用。Step 203: Create a new shutdown virtual machine thread, and perform polling check. If the virtual machine thread is not shut down at this time, create a new thread to execute step 206: call the shutdown interface; after the polling check, jump to step 204: determine to be shutdown Whether the virtual machine list is empty, if yes, go to step 205: end; if not, go back to step 202. Wherein, invoking the shutdown interface in step 206 is specifically calling a shutdown instruction adapted to the first cloud platform 11 and/or the second cloud platform 21 from the hybrid cloud management platform 100, and the shutdown instruction can be regarded as a process of performing a shutdown operation on the virtual machine between method calls.
步骤206结束后执行步骤207:更行虚拟机状态为关机,并最终执行步骤208:更新虚拟机回收站状态为true,即由混合云管理平台100将得到的回调信息修改第二数据库25中的虚拟机中对应虚拟机记录中的“is_in_recycle_bin”字段,将其改为“true”。After step 206, step 207 is executed: the state of the virtual machine is updated to shutdown, and finally step 208 is executed: the state of the recycle bin of the virtual machine is updated to true, that is, the callback information obtained by the hybrid cloud management platform 100 is modified in the second database 25. Change the "is_in_recycle_bin" field in the corresponding virtual machine record in the virtual machine to "true".
异步删除虚拟机线程300具体如下所示。The asynchronous deletion of the virtual machine thread 300 is as follows.
异步删除虚拟机线程300通过跳转步骤24调用待删除虚拟机列表。The asynchronous deletion virtual machine thread 300 calls the list of virtual machines to be deleted by jumping to step 24 .
步骤301:获取待删除虚拟机列表。Step 301: Obtain a list of virtual machines to be deleted.
步骤302:逐个取出待删除虚拟机列表中的虚拟机信息。Step 302: Take out the virtual machine information in the list of virtual machines to be deleted one by one.
步骤303:新建虚拟机删除线程,并轮询检查,如果此时没有删除虚拟机线程,则新建线程,以执行步骤306:调用删除虚拟机接口;轮询检查结束后跳转执行步骤304:判断待删除虚拟机列表是否为空,若是,跳转步骤305并结束;若否,则返回执行步骤302。Step 303: Create a new virtual machine deletion thread, and perform polling check. If the virtual machine thread is not deleted at this time, create a new thread to execute Step 306: Call the delete virtual machine interface; after the polling check, jump to step 304: Judgment Whether the list of virtual machines to be deleted is empty, if yes, go to step 305 and end; if not, return to step 302 .
步骤306结束后执行步骤307:轮询删除结果,并最终跳转执行步骤308:从第二数据 库25中删除对应的虚拟机信息。After the end of step 306, step 307 is executed: polling the deletion result, and finally jump to execute step 308: delete the corresponding virtual machine information from the second database 25.
综上所述,通过本实施例所揭示的一种云平台虚拟机回收方法,解决了云平台尤其是包含不同类型的云平台中具有不同的当前状态的虚拟机执行高效且安全的回收操作,显著地降低了对虚拟机执行回收操作过程中对计算资源与内存资源等资源的占用与浪费,降低了并发操作的响应时间;To sum up, the method for recycling a virtual machine of a cloud platform disclosed in this embodiment solves the problem that the cloud platform, especially the virtual machines with different current states in different types of cloud platforms, can perform efficient and safe recycling operations. Significantly reduces the occupation and waste of resources such as computing resources and memory resources during the recovery operation of the virtual machine, and reduces the response time of concurrent operations;
同时,在该云平台虚拟机回收方法中,由于将位于前端中的前端回收站与位于后端中的后端回收站相互分离,有效地避免了因对虚拟机执行回收操作所导致的虚拟机之前所配置的各种资源的解绑定的缺陷,使得因错误删除操作对虚拟机在恢复后能够与该虚拟机在执行与删除操作前所绑定的各种资源及策略建立资源绑定关系,缩短了已经放入后端回收站中的虚拟机的恢复速度及恢复过程所消耗的资源,由此间接地提高了用户体验。At the same time, in the cloud platform virtual machine recycling method, since the front-end recycling bin located in the front-end and the back-end recycling bin located in the back-end are separated from each other, the virtual machine caused by performing the recycling operation on the virtual machine is effectively avoided. The defect of unbinding of various resources previously configured makes it possible to establish a resource binding relationship with various resources and policies bound to the virtual machine before performing and deleting operations after the virtual machine is restored due to the wrong deletion operation , which shortens the recovery speed of the virtual machine that has been put into the back-end recycle bin and the resources consumed by the recovery process, thereby indirectly improving the user experience.
实施例二:Embodiment 2:
参图11所示,本实施例揭示了一种计算机设备800。该计算机设备800运行实施例一所揭示的该回收方法。Referring to FIG. 11 , this embodiment discloses a computer device 800 . The computer device 800 executes the recovery method disclosed in the first embodiment.
计算机设备800包括:处理器51、存储器52以及存储在存储器52中且被配置为由所述处理器51执行的计算机程序,该处理器51在执行所述计算机程序时执行如实施例一所述的云平台虚拟机回收方法中的步骤。The computer device 800 includes: a processor 51, a memory 52, and a computer program stored in the memory 52 and configured to be executed by the processor 51, the processor 51 executing the computer program described in the first embodiment when executing the computer program The steps in the cloud platform virtual machine recycling method.
具体的,该存储器52由若干存储单元组成,即存储单元521~存储单元52i,其中,参数i取大于或者等于二的正整数。处理器51与存储器52均接入系统总线53。系统总线53的形式并不需要予以具体限定,I2C总线、SPI总线、SCI总线、PCI总线、PCI-e总线、ISA总线等,并可根据电子设备500的具体类型及应用场景需求予以合理变更。系统总线53并非本申请发明点,故在本申请中不予展开陈述。Specifically, the memory 52 is composed of several storage units, namely, the storage unit 521 to the storage unit 52i, wherein the parameter i takes a positive integer greater than or equal to two. Both the processor 51 and the memory 52 are connected to the system bus 53 . The form of the system bus 53 does not need to be specifically limited. I2C bus, SPI bus, SCI bus, PCI bus, PCI-e bus, ISA bus, etc., can be reasonably changed according to the specific type of the electronic device 500 and the requirements of application scenarios. The system bus 53 is not the invention of the present application, so it will not be described in the present application.
需要说明的是,本实施例中的存储单元52可为物理态的存储单元,从而将计算机设备800理解为物理态的计算机或者计算机集群或者集群服务器;同时,存储单元52还可为虚拟态的存储单元,例如基于物理存储设备通过底层虚拟化技术所形成的虚拟存储空间,从而将该计算机设备800配置为云平台、虚拟服务器、虚拟集群等虚拟装置,或者将该计算机设备800理解为PC、平板电脑、智能手机、智能可穿戴电子设备、物理集群或者数据中心等。It should be noted that the storage unit 52 in this embodiment may be a storage unit in a physical state, so that the computer device 800 can be understood as a computer or a computer cluster or a cluster server in a physical state; at the same time, the storage unit 52 may also be a virtual state. The storage unit, for example, is based on the virtual storage space formed by the physical storage device through the underlying virtualization technology, so that the computer device 800 is configured as a virtual device such as a cloud platform, a virtual server, and a virtual cluster, or the computer device 800 is understood as a PC, Tablets, smartphones, smart wearable electronics, physical clusters or data centers, etc.
本实施例所示出的计算机设备800与实施例一中相同部分的技术方案,请参照实施例一所示,在此不再赘述。For the technical solution of the same part of the computer device 800 shown in this embodiment and the first embodiment, please refer to that shown in the first embodiment, and details are not repeated here.
本发明实施例中所描述的各种说明性的逻辑块,或单元都可以通过通用处理器,数字信号处理器,专用集成电路(ASIC),现场可编程门阵列或其它可编程逻辑装置,离散门或晶体管逻辑,离散硬件部件,或上述任何组合的设计来实现或操作所描述的功能。通用处理器可以为微处理器,可选地,该通用处理器也可以为任何传统的处理器、控制器、微控制器或状态机。处理器也可以通过计算装置的组合来实现,例如数字信号处理器和微处理器,多个 微处理器,一个或多个微处理器联合一个数字信号处理器核,或任何其它类似的配置来实现。The various illustrative logic blocks, or units described in the embodiments of the present invention can be implemented by general-purpose processors, digital signal processors, application specific integrated circuits (ASICs), field programmable gate arrays or other programmable logic devices, discrete Gate or transistor logic, discrete hardware components, or any combination of the above are designed to implement or operate the functions described. A general-purpose processor may be a microprocessor, or alternatively, the general-purpose processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors in combination with a digital signal processor core, or any other similar configuration. accomplish.
上文所列出的一系列的详细说明仅仅是针对本发明的可行性实施方式的具体说明,它们并非用以限制本发明的保护范围,凡未脱离本发明技艺精神所作的等效实施方式或变更均应包含在本发明的保护范围之内。The series of detailed descriptions listed above are only specific descriptions for the feasible embodiments of the present invention, and they are not used to limit the protection scope of the present invention. Changes should all be included within the protection scope of the present invention.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化囊括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。It will be apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, but that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the invention is to be defined by the appended claims rather than the foregoing description, which are therefore intended to fall within the scope of the claims. All changes within the meaning and scope of the equivalents of , are included in the present invention. Any reference signs in the claims shall not be construed as limiting the involved claim.
此外,应当理解,虽然本说明书按照实施方式加以描述,但并非每个实施方式仅包含一个独立的技术方案,说明书的这种叙述方式仅仅是为清楚起见,本领域技术人员应当将说明书作为一个整体,各实施例中的技术方案也可以经适当组合,形成本领域技术人员可以理解的其他实施方式。In addition, it should be understood that although this specification is described in terms of embodiments, not each embodiment only includes an independent technical solution, and this description in the specification is only for the sake of clarity, and those skilled in the art should take the specification as a whole , the technical solutions in each embodiment can also be appropriately combined to form other implementations that can be understood by those skilled in the art.

Claims (15)

  1. 一种云平台虚拟机回收方法,其特征在于,包括:A method for reclaiming a cloud platform virtual machine, comprising:
    前端接收对虚拟机的删除指令,将虚拟机放入部署于前端的前端回收站后,由前端向后端发出通知;The front-end receives the deletion instruction for the virtual machine, and after placing the virtual machine into the front-end recycle bin deployed on the front-end, the front-end sends a notification to the back-end;
    后端接收前端发出的通知并对删除指令进行权限校验,对通过权限校验的删除指令根据待删除的虚拟机的当前状态,分别执行对应的将虚拟机放入部署于后端的后端回收站的回收线程中,其中,放入后端回收站中的待删除的虚拟机在执行对应的回收线程之前不解除待删除的虚拟机与虚拟资源的绑定关系。The back-end receives the notification from the front-end and performs permission verification on the deletion instruction. For the deletion instruction that has passed the permission verification, according to the current state of the virtual machine to be deleted, the corresponding virtual machine is put into the back-end deployed on the back-end for recycling. In the recycling thread of the back-end recycling bin, the virtual machine to be deleted placed in the back-end recycling bin does not release the binding relationship between the virtual machine to be deleted and the virtual resource before executing the corresponding recycling thread.
  2. 根据权利要求1所述的云平台虚拟机回收方法,其特征在于,将虚拟机放入部署后端的后端回收站的回收线程执行完毕后,还包括:The cloud platform virtual machine recycling method according to claim 1, wherein after the recycling thread of placing the virtual machine into the back-end recycling bin of the deployment back-end is executed, the method further comprises:
    后端回收站定期检查待删除的虚拟机与虚拟资源的绑定关系解除失败的虚拟机,并对虚拟机执行强制回收。The back-end recycle bin periodically checks the virtual machine that fails to release the binding relationship between the virtual machine to be deleted and the virtual resource, and performs forced recycling of the virtual machine.
  3. 根据权利要求1所述的云平台虚拟机回收方法,其特征在于,前端判断待删除的虚拟机的当前状态,仅对当前状态为关机状态、开机状态、异常状态及未知状态的待删除的虚拟机执行放入后端回收站的回收线程,对不属于关机状态、开机状态、异常状态及未知状态的待删除的虚拟机所发起的删除指令返回告警信息,并拒绝将虚拟机放入部署于后端的后端回收站的回收线程中。The cloud platform virtual machine recycling method according to claim 1, wherein the front-end determines the current state of the virtual machine to be deleted, and only the virtual machine to be deleted whose current state is a shutdown state, a power-on state, an abnormal state and an unknown state is to be deleted. The machine executes the recycling thread placed in the back-end recycle bin, returns alarm information to the deletion command initiated by the virtual machine to be deleted that is not in the shutdown state, power-on state, abnormal state or unknown state, and refuses to put the virtual machine in the In the recycling thread of the backend recycle bin of the backend.
  4. 根据权利要求3所述的云平台虚拟机回收方法,其特征在于,所述接收对虚拟机的删除指令在前端的可视化界面中被接收;The method for reclaiming a virtual machine on a cloud platform according to claim 3, wherein the receiving the deletion instruction for the virtual machine is received in a visual interface of the front end;
    后端对删除指令进行权限校验包含以下至少一种校验内容:用户id、虚拟机id、虚拟机名称、虚拟机状态、运行虚拟机的操作系统、形成虚拟机的硬件信息、部署虚拟机的云平台信息以及虚拟机所在集群的集群属性信息;The permission verification performed by the backend for the deletion instruction includes at least one of the following verification contents: user id, virtual machine id, virtual machine name, virtual machine state, operating system running the virtual machine, hardware information forming the virtual machine, deploying the virtual machine The cloud platform information and the cluster attribute information of the cluster where the virtual machine is located;
    当后端基于所述校验内容对删除指令进行权限校验失败时,由后端向前端回收站发出中止删除操作的指令,所述后端接收前端发出的通知并对删除指令进行权限校验且基于所述校验内容对删除指令进行权限校验成功后,对放入后端回收站中的待删除的虚拟机解除待删除的虚拟机与虚拟资源的绑定关系。When the back-end fails to perform permission verification on the deletion instruction based on the verification content, the back-end sends an instruction to abort the deletion operation to the front-end recycle bin, and the back-end receives the notification from the front-end and performs permission verification on the deletion instruction And after the permission verification of the deletion instruction is successful based on the verification content, the binding relationship between the virtual machine to be deleted and the virtual resource is released for the virtual machine to be deleted placed in the back-end recycle bin.
  5. 根据权利要求1所述的云平台虚拟机回收方法,其特征在于,所述虚拟机与虚拟资源的绑定关系包括虚拟机与虚拟网络、安全组、秘钥对或者虚拟磁盘中的一种或者几种的虚拟资源之间所建立的绑定关系。The method for reclaiming a virtual machine on a cloud platform according to claim 1, wherein the binding relationship between the virtual machine and the virtual resource comprises one of a virtual machine and a virtual network, a security group, a key pair or a virtual disk or The binding relationship established between several virtual resources.
  6. 根据权利要求1至5中任一项所述的云平台虚拟机回收方法,其特征在于,所述前端包含至少一种云平台,所述前端被后端纳管,所述前端与后端逻辑上相互独立,所述后端被配置为混合云管理平台。The cloud platform virtual machine recycling method according to any one of claims 1 to 5, wherein the front end includes at least one cloud platform, the front end is managed by the back end, and the front end and the back end logic independent of each other, the backend is configured as a hybrid cloud management platform.
  7. 根据权利要求6所述的云平台虚拟机回收方法,其特征在于,还包括:The cloud platform virtual machine recycling method according to claim 6, further comprising:
    在前端创建多个可用区,所述可用区为虚拟数字中心,在所述可用区中建立虚拟机与对用户配置的不同权限的关联关系,所述可用区由混合云管理平台创建,所述可用区中包含至少一种云平台,所述可用区被后端纳管。Create multiple availability zones at the front end, where the availability zone is a virtual digital center, and establish an association relationship between virtual machines and different permissions configured for users in the availability zone, the availability zone is created by the hybrid cloud management platform, and the The availability zone includes at least one cloud platform, and the availability zone is managed by the backend.
  8. 根据权利要求6所述的云平台虚拟机回收方法,其特征在于,所述前端配置第一数据库,所述后端配置第二数据库,所述第一数据库用于记录可用区中虚拟机的状态数据,所述第二数据库用于记录后端对删除指令进行权限校验所关联的校验内容,当待删除的虚拟机被回收后,通过所述第二数据库对第一数据库进行更新;所述可用区存放至少一个云操作系统或者虚拟机管理程序。The cloud platform virtual machine recycling method according to claim 6, wherein the front end is configured with a first database, the back end is configured with a second database, and the first database is used to record the state of the virtual machine in the availability zone data, the second database is used to record the verification content associated with the permission verification performed by the back end on the deletion instruction, and after the virtual machine to be deleted is recycled, the first database is updated through the second database; The availability zone stores at least one cloud operating system or a hypervisor.
  9. 根据权利要求8所述的云平台虚拟机回收方法,其特征在于,待删除的虚拟机的当前状态为未知状态时,将待删除的虚拟机加入待删除虚拟机列表,并由后端创建异步删除虚拟机线程,以将待删除的虚拟机放入后端回收站后立即执行删除操作。The cloud platform virtual machine recycling method according to claim 8, wherein when the current state of the virtual machine to be deleted is an unknown state, the virtual machine to be deleted is added to the list of virtual machines to be deleted, and the back-end creates an asynchronous Delete virtual machine threads to delete the virtual machine to be deleted as soon as it is placed in the back-end recycle bin.
  10. 根据权利要求8所述的云平台虚拟机回收方法,其特征在于,待删除的虚拟机的当前状态为关机状态时,修改待删除的虚拟机在第二数据库中留存的字段信息,并将修改后的字段信息与待删除的虚拟机所挂载的磁盘信息及网络配置信息记录至日志文件,并将所述日志文件保存至第二数据库后向前端予以可视化展示。The cloud platform virtual machine recycling method according to claim 8, wherein when the current state of the virtual machine to be deleted is a shutdown state, the field information retained in the second database of the virtual machine to be deleted is modified, and the modified virtual machine is modified. The latter field information and the disk information and network configuration information mounted on the virtual machine to be deleted are recorded in a log file, and the log file is saved to the second database for visual display to the front end.
  11. 根据权利要求8所述的云平台虚拟机回收方法,其特征在于,待删除的虚拟机的当前状态为开机状态或者异常状态时,由后端执行将开机状态并执行删除的虚拟机加入至待关机虚拟机列表的操作,并由后端创建异步关闭虚拟机线程。The cloud platform virtual machine recycling method according to claim 8, wherein when the current state of the virtual machine to be deleted is a powered-on state or an abnormal state, the back-end executes adding the virtual machine in the powered-on state and executing the deletion to the to-be-deleted virtual machine. Shutdown the operation of the virtual machine list, and the asynchronous shutdown virtual machine thread created by the backend.
  12. 根据权利要求8所述的云平台虚拟机回收方法,其特征在于,还包括:使用比较交换算法对可用区存放至少一个云操作系统或者虚拟机管理程序所具有的底层状态数据对第一数据库中记录的虚拟机状态数据进行更新;所述混合云管理平台调用第一数据库中更新后的虚拟机状态数据,并对第二数据库中相同字段的属性进行更新。The cloud platform virtual machine recycling method according to claim 8, further comprising: using a comparison and exchange algorithm to store the underlying state data of at least one cloud operating system or a hypervisor in the first database in the availability zone. The recorded virtual machine state data is updated; the hybrid cloud management platform calls the updated virtual machine state data in the first database, and updates the attributes of the same field in the second database.
  13. 根据权利要求8所述的云平台虚拟机回收方法,其特征在于,还包括:使用比较交换算法对可用区存放至少一个云操作系统或者虚拟机管理程序所具有的底层状态数据对第一数据库中记录的虚拟机状态数据进行更新;所述第二数据库直接调用第一数据库中更新后的虚拟机状态数据,并对第二数据库中相同字段的属性进行更新。The cloud platform virtual machine recycling method according to claim 8, further comprising: using a comparison and exchange algorithm to store the underlying state data of at least one cloud operating system or a hypervisor in the first database in the availability zone. The recorded virtual machine state data is updated; the second database directly calls the updated virtual machine state data in the first database, and updates the attributes of the same field in the second database.
  14. 根据权利要求1所述的云平台虚拟机回收方法,其特征在于,所述前端被配置为分布式系统架构。The method for recycling a virtual machine on a cloud platform according to claim 1, wherein the front end is configured as a distributed system architecture.
  15. 一种计算机设备,其特征在于,包括:A computer equipment, characterized in that, comprising:
    处理器,存储器,以及processor, memory, and
    存储在所述存储器中且被配置为由所述处理器执行的计算机程序;a computer program stored in the memory and configured to be executed by the processor;
    所述处理器在执行所述计算机程序时执行如权利要求1至14中任一项所述的云平台虚拟机回收方法中的步骤。The processor executes the steps in the cloud platform virtual machine recycling method according to any one of claims 1 to 14 when executing the computer program.
PCT/CN2021/123956 2021-01-12 2021-10-15 Cloud platform virtual machine recycling method and computer device WO2022151776A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110034978.XA CN112732406B (en) 2021-01-12 2021-01-12 Cloud platform virtual machine recovery method and computer equipment
CN202110034978.X 2021-01-12

Publications (1)

Publication Number Publication Date
WO2022151776A1 true WO2022151776A1 (en) 2022-07-21

Family

ID=75590335

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/123956 WO2022151776A1 (en) 2021-01-12 2021-10-15 Cloud platform virtual machine recycling method and computer device

Country Status (2)

Country Link
CN (1) CN112732406B (en)
WO (1) WO2022151776A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573332A (en) * 2023-10-19 2024-02-20 中移互联网有限公司 Cloud mobile phone recycling method and device, electronic equipment and storage medium
CN118093252A (en) * 2024-04-28 2024-05-28 浪潮云信息技术股份公司 Database diagnosis method and device of cloud platform

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112732406B (en) * 2021-01-12 2021-12-24 华云数据控股集团有限公司 Cloud platform virtual machine recovery method and computer equipment
CN113128909A (en) * 2021-05-13 2021-07-16 瑞麟天下节能技术(北京)有限公司 Server management method based on power resources
CN113961147A (en) * 2021-10-26 2022-01-21 江苏安超云软件有限公司 Method and application for recycling space from deleted blocks on cloud platform
CN117119053A (en) * 2023-01-28 2023-11-24 荣耀终端有限公司 Terminal cloud collaborative data management method, terminal, system and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101986284A (en) * 2010-11-04 2011-03-16 华中科技大学 Dynamic recovery system for waste space of virtual machine image file
CN103473296A (en) * 2013-09-04 2013-12-25 国云科技股份有限公司 Recycle bin mechanism and recycle bin system applicable to cloud computing
US20140130043A1 (en) * 2012-11-07 2014-05-08 International Business Machines Corporation Automated and optimal deactivation of service to enable effective resource reusability
CN104424015A (en) * 2013-09-11 2015-03-18 华为技术有限公司 Virtual machine management method and virtual machine management device
CN109117251A (en) * 2018-08-09 2019-01-01 郑州云海信息技术有限公司 A kind of implementation method, device and the readable storage medium storing program for executing of virtual machine recycle bin
CN110018883A (en) * 2019-04-11 2019-07-16 苏州浪潮智能科技有限公司 A kind of virtual machine delet method, device, equipment and storage medium
CN112732406A (en) * 2021-01-12 2021-04-30 华云数据控股集团有限公司 Cloud platform virtual machine recovery method and computer equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140181817A1 (en) * 2012-12-12 2014-06-26 Vmware, Inc. Methods and apparatus to manage execution of virtual machine workflows
US9471360B2 (en) * 2014-03-14 2016-10-18 International Business Machines Corporation Returning terminated virtual machines to a pool of available virtual machines to be reused thereby optimizing cloud resource usage and workload deployment time
CN105868056B (en) * 2016-04-07 2019-06-21 北京北信源软件股份有限公司 Obtain the method, apparatus and secure virtual machine of deleted document in Windows virtual machine
CN107766125A (en) * 2017-11-06 2018-03-06 国云科技股份有限公司 A kind of delet method of cloud platform virtual machine
CN109800084A (en) * 2018-12-21 2019-05-24 平安科技(深圳)有限公司 Discharge the method and terminal device of resources of virtual machine

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101986284A (en) * 2010-11-04 2011-03-16 华中科技大学 Dynamic recovery system for waste space of virtual machine image file
US20140130043A1 (en) * 2012-11-07 2014-05-08 International Business Machines Corporation Automated and optimal deactivation of service to enable effective resource reusability
CN103473296A (en) * 2013-09-04 2013-12-25 国云科技股份有限公司 Recycle bin mechanism and recycle bin system applicable to cloud computing
CN104424015A (en) * 2013-09-11 2015-03-18 华为技术有限公司 Virtual machine management method and virtual machine management device
CN109117251A (en) * 2018-08-09 2019-01-01 郑州云海信息技术有限公司 A kind of implementation method, device and the readable storage medium storing program for executing of virtual machine recycle bin
CN110018883A (en) * 2019-04-11 2019-07-16 苏州浪潮智能科技有限公司 A kind of virtual machine delet method, device, equipment and storage medium
CN112732406A (en) * 2021-01-12 2021-04-30 华云数据控股集团有限公司 Cloud platform virtual machine recovery method and computer equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117573332A (en) * 2023-10-19 2024-02-20 中移互联网有限公司 Cloud mobile phone recycling method and device, electronic equipment and storage medium
CN118093252A (en) * 2024-04-28 2024-05-28 浪潮云信息技术股份公司 Database diagnosis method and device of cloud platform

Also Published As

Publication number Publication date
CN112732406A (en) 2021-04-30
CN112732406B (en) 2021-12-24

Similar Documents

Publication Publication Date Title
WO2022151776A1 (en) Cloud platform virtual machine recycling method and computer device
KR102141234B1 (en) Versioned hierarchical data structure within a distributed data store
US8812451B2 (en) Programming model for synchronizing browser caches across devices and web services
US11392461B2 (en) Method and apparatus for processing information
US10437865B1 (en) Computer storage deduplication
KR101970839B1 (en) Replaying jobs at a secondary location of a service
US10884863B2 (en) Client session reclaim for a distributed storage system
CN110088733A (en) The layout based on accumulation layer of virtual machine (vm) migration
CN111104388B (en) Method, apparatus and computer readable medium for accessing files
US20230385096A1 (en) Asynchronous queries on secondary data cores in a distributed computing system
CN109656742B (en) Node exception handling method and device and storage medium
CN102460382A (en) Annotating virtual application processes
WO2011097932A1 (en) Method and apparatus for accessing database, database application system
CN110971700B (en) Method and device for realizing distributed lock
US20220207053A1 (en) System and method for highly available database service
CN103514298A (en) Method for achieving file lock and metadata server
CN107623581B (en) Service list generation method, device and system, and acquisition and reporting method and device
US11698795B2 (en) Unified way to track user configuration on a live system
CN112988777B (en) Object processing method and device, computer equipment and storage medium
US11803429B2 (en) Managing alert messages for applications and access permissions
WO2023185335A1 (en) Crash clustering method and apparatus, electronic device and storage medium
JP2011192241A (en) Backup program, method, and computer
US11513904B2 (en) Gold image library management system to reduce backup storage and bandwidth utilization
CN113448493B (en) Method, electronic device and computer readable medium for backing up data
CN111522764B (en) Plug-in operation processing method, terminal and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21918967

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21918967

Country of ref document: EP

Kind code of ref document: A1