WO2019238092A1 - 一种虚拟机的管理方法、装置及系统 - Google Patents

一种虚拟机的管理方法、装置及系统 Download PDF

Info

Publication number
WO2019238092A1
WO2019238092A1 PCT/CN2019/091085 CN2019091085W WO2019238092A1 WO 2019238092 A1 WO2019238092 A1 WO 2019238092A1 CN 2019091085 W CN2019091085 W CN 2019091085W WO 2019238092 A1 WO2019238092 A1 WO 2019238092A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
cloud host
device identifier
cloud
shut down
Prior art date
Application number
PCT/CN2019/091085
Other languages
English (en)
French (fr)
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 华为技术有限公司
Priority to JP2020568802A priority Critical patent/JP7074302B2/ja
Priority to EP19819001.9A priority patent/EP3800549A4/en
Publication of WO2019238092A1 publication Critical patent/WO2019238092A1/zh
Priority to US17/120,735 priority patent/US20210096902A1/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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • 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/4557Distribution of virtual machine instances; Migration and load balancing
    • 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/45583Memory management, e.g. access or allocation

Definitions

  • the present application relates to the field of communications, and in particular, to a method, a device, and a system for managing a virtual machine.
  • the cloud system includes a cloud platform and a cloud host.
  • the cloud platform can create a virtual machine on the cloud host. When the virtual machine runs on the cloud host, it needs to occupy the cloud host's computing resources.
  • This computing resource can be the cloud host's central processing unit (Central Processing). Unit, CPU) and / or memory.
  • CPU central processing unit
  • the cloud platform can control the shutdown of the virtual machine on the cloud host. After controlling the shutdown of the virtual machine on the cloud host, the cloud host releases the computing resources occupied by the virtual machine. At present, no matter what kind of virtual machine, after shutting down the virtual machine in the cloud host, the cloud host always releases the resources occupied by the virtual machine. This management method of the virtual machine is too simple and singular.
  • the embodiments of the present application provide a method, a device, and a system for managing a virtual machine.
  • the technical solution is as follows:
  • an embodiment of the present application provides a method for managing a virtual machine, which is applied to a cloud host.
  • a cloud platform is used to manage the cloud host.
  • the cloud host receives a virtual machine shutdown request message sent by the cloud platform.
  • the virtual machine shutdown request message includes identification information of a virtual machine to be shut down; obtaining a resource management policy for managing a computing resource occupied by the virtual machine to be shut down according to the identification information of the virtual machine to be shut down; and shutting down the standby machine.
  • the virtual machine is shut down, and the computing resource occupied by the virtual machine to be shut down is managed according to the resource management policy after the virtual machine to be shut down is shut down.
  • the cloud host can use the resource management policy corresponding to the virtual machine to be shut down to manage the computing resources occupied by the virtual machine to be shut down, implement different ways to manage the computing resources occupied by each virtual machine for different virtual machines, and enrich the management method for virtual machines.
  • the type of the virtual machine to be shut down is obtained according to the identification information of the virtual machine to be shut down; and from the type of the virtual machine to be shut down, the type and The corresponding resource management strategy is obtained from the corresponding relationship of the resource management strategy.
  • the resource management strategy corresponding to different virtual machines can be obtained through the correspondence between the type of the virtual machine and the resource management strategy, so that different virtual machines can manage the computing resources occupied by each virtual machine in different ways.
  • the virtual machine to be shut down is a first type of virtual machine occupying a hard disk of the cloud host or the virtual machine to be shut down is a second type belonging to a VIP VIP user.
  • the resource management policy is used to instruct the cloud host not to release the computing resources occupied by the virtual machine to be shut down; so that when the first type virtual machine or the second type virtual machine is turned on, the cloud host is guaranteed to have Sufficient computing resources for the first type of virtual machine or the second type of virtual machine to start, the first type of virtual machine cannot be turned on due to insufficient computing resources of the cloud host, and the first type of virtual machine cannot be started, or ,
  • the second type cloud host will not be migrated to other cloud hosts, resulting in a slow start of the second type cloud host.
  • the resource management policy It is used to instruct the cloud host to wait after shutting down the virtual machine to be shut down and release the computing resources occupied by the virtual machine to be shut down when the waiting time reaches a preset time threshold. Since the computing resources occupied by the virtual machine to be shut down are released after waiting for a preset time threshold, when the virtual machine to be shut down needs to be turned on during the waiting process, the operation of applying for a computing resource can be omitted, and the virtual machine to be shut down can be directly turned on to improve the startup. speed
  • a correspondence between a type of the virtual machine and a resource management policy sent by the cloud platform is received.
  • the resource management strategy corresponding to different virtual machines can be obtained through the correspondence between the type of the virtual machine and the resource management strategy, so that different virtual machines can manage the computing resources occupied by each virtual machine in different ways.
  • an embodiment of the present application provides a method for managing a virtual machine, which is applied to a cloud platform, where the cloud platform is used to manage multiple cloud hosts, and the cloud platform receives a virtual machine creation request message sent by a client.
  • the virtual machine creation request message includes configuration information of a virtual machine to be created, and the configuration information includes at least the amount of computing resources required for the virtual machine to be created; and a target cloud is determined among the multiple cloud hosts according to the configuration information.
  • a host wherein the difference between the current remaining idle resource amount of the target cloud host minus the number of computing resources is greater than or equal to a preset threshold; sending the virtual machine creation request message to the target cloud host, and The virtual machine creation request message is used to request the target cloud host to create the virtual machine to be created.
  • the difference is equal to the amount of free resources remaining on the target cloud host after the virtual machine to be created is created on the target cloud host. This ensures that the target cloud host retains a portion of free resources that are not less than a preset threshold after creating the virtual machine to be created In this way, when a part of the virtual machines in the target cloud host is turned on, the reserved idle resources can be used to start the part of the virtual machines without affecting the speed of the part of the virtual machines.
  • the quantity of resources corresponding to each device identifier stored in the correspondence between the equipment identifier and the quantity of resources is obtained, and the quantity of resources corresponding to the equipment identifier includes the current remaining of the cloud host corresponding to the equipment identifier
  • the number of idle resources corresponding to each device identifier minus the number of computing resources to obtain the difference corresponding to each device identifier select from the device identifiers whose difference is greater than or equal to a preset threshold
  • a device identifier determining a cloud host corresponding to the selected device identifier as a target cloud host. In this way, the target cloud host retains an amount of idle resources that is greater than or equal to a preset threshold after creating the virtual machine to be created.
  • the quantity of resources corresponding to each device identifier stored in the correspondence between the equipment identifier and the quantity of resources is obtained, and the quantity of resources corresponding to the equipment identifier includes resources of the cloud host corresponding to the equipment identifier.
  • the total amount and the current remaining idle resource quantity; subtracting the computing resource quantity from the idle resource quantity corresponding to each device identifier to obtain the difference corresponding to each equipment identifier; and according to the resources corresponding to each equipment identifier The total amount and the difference, respectively, calculating the proportion of idle resources corresponding to each device identifier; selecting a device identifier from the device identifiers whose proportion of idle resources is greater than or equal to a preset ratio threshold, and the cloud host corresponding to the selected device identifier Determined as the target cloud host. In this way, the target cloud host retains a proportion of idle resources that is greater than or equal to a preset proportion threshold after creating a virtual machine to be created.
  • the identification information of the virtual machine to be created and the device identifier of the target cloud host are stored in a correspondence between the identification information of the virtual machine and the device identifier, and / Or, the number of idle resources corresponding to the device identifier of the target cloud host stored in the correspondence between the device identifier and the number of resources is updated to the difference corresponding to the device identifier of the target cloud host.
  • the virtual machine migration request message includes identification information of a virtual machine to be migrated; the identification information of the virtual machine and the device
  • the device identifier of the first cloud host corresponding to the identification information of the virtual machine to be migrated is updated to the device identifier of the second cloud host, and the first cloud host is the virtual machine to be migrated before the migration.
  • the second cloud host is the cloud host where the virtual machine to be migrated is located after the migration.
  • the virtual machine can be implemented only by updating the device identifier of the first cloud host corresponding to the identification information of the virtual machine to be migrated to the device identifier of the second cloud host in the correspondence between the identification information of the virtual machine and the device identifier. Migration to improve migration efficiency.
  • a resource application request message is sent to the second cloud host, and the resource The application request message includes the amount of computing resources required by the virtual machine to be migrated, and the resource request request message is used by the second cloud host to provide the virtual machine to be migrated according to the amount of computing resources required by the virtual machine to be migrated.
  • Machine to apply for computing resources This can ensure that when the virtual machine to be migrated is started on the second cloud host, sufficient computing resources are available for the virtual machine to be migrated to be started, thereby increasing the startup speed.
  • the method further receives a virtual machine start request message sent by the client, and the virtual machine start request message includes identification information of a virtual machine to be started;
  • the first cloud host where the virtual machine is powered on has not released the computing resources occupied by the virtual machine to be turned on, or the first cloud host has released the computing resources occupied by the virtual machine to be turned on and the first cloud host is idle
  • the number of resources is greater than or equal to the amount of computing resources required for the virtual machine to be started
  • the virtual machine to be started is started on the first cloud host
  • the virtual machine to be started is released by the first cloud host
  • the occupied computing resources and the number of idle resources of the first cloud host are less than the number of computing resources required for the virtual machine to be started, the virtual machine to be started is started on a third cloud host, and the third cloud host is The difference between the number of idle resources minus the number of computing resources required to start the virtual machine is greater than or equal to a preset threshold, the first cloud host and the third cloud host Two different cloud hosts
  • the remaining idle resource amount of the third cloud host is still greater than or equal to a preset threshold, which can ensure that after the third cloud host turns on the virtual machine to be turned on, a part of the virtual machine remains at least With a threshold of idle resources, when a part of the virtual machines in the third cloud host that is shut down is turned on, the reserved idle resources can be used to turn on the part of the virtual machines without affecting the speed of the part of the virtual machines.
  • the method receives a virtual machine deletion request message sent by the client, and the virtual machine deletion request message includes identification information of a virtual machine to be deleted;
  • the correspondence between the information and the device identification includes the correspondence between the identification information of the virtual machine to be deleted.
  • an embodiment of the present application provides a management apparatus for a virtual machine, configured to execute the first aspect or a method in any possible implementation manner of the first aspect.
  • the apparatus includes a unit for performing the first aspect or the method of any possible implementation manner of the first aspect.
  • an embodiment of the present application provides a management apparatus for a virtual machine, configured to execute the method in the second aspect or any one of the possible implementation manners of the second aspect.
  • the apparatus includes a unit for performing the second aspect or the method of any one of the possible implementation manners of the second aspect.
  • an embodiment of the present application provides a management device for a virtual machine, where the device includes a transceiver, a processor, and a memory.
  • the transceiver, the processor, and the memory may be connected through a bus system.
  • the memory is configured to store a program, an instruction, or code
  • the processor is configured to execute the program, instruction, or code in the memory, complete the first aspect or a method in any possible implementation manner of the first aspect, or complete the second aspect. Method or any possible implementation of the second aspect.
  • an embodiment of the present application provides a computer program product.
  • the computer program product includes a computer program stored in a computer-readable storage medium, and the computing program is loaded by a processor to implement the first aspect. Or a method of any possible implementation manner of the first aspect or a method of implementing the second aspect or any possible implementation manner of the second aspect.
  • an embodiment of the present application provides a non-volatile computer-readable storage medium for storing a computer program, where the computer program is loaded by a processor to execute the foregoing first aspect or any possibility of the first aspect
  • an embodiment of the present application provides a chip, where the chip includes a programmable logic circuit and / or a program instruction, and is used to implement the foregoing first aspect or any possible implementation of the first aspect when the chip is running Method or a method for implementing the second aspect or any possible implementation manner of the second aspect.
  • an embodiment of the present application provides a management system for a virtual machine, including the device according to the third aspect and the device according to the fourth aspect.
  • FIG. 1 is a schematic structural diagram of a system according to an embodiment of the present application.
  • FIG. 2 is a flowchart of a method for creating a virtual machine according to an embodiment of the present application
  • FIG. 3 is a flowchart of a method for shutting down a virtual machine according to an embodiment of the present application
  • FIG. 4 is a flowchart of a method for migrating a virtual machine according to an embodiment of the present application
  • FIG. 5 is a flowchart of a method for starting a virtual machine according to an embodiment of the present application.
  • FIG. 6 is a flowchart of a method for deleting a virtual machine according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a management device for a virtual machine according to an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of another management apparatus for a virtual machine according to an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of another management device for a virtual machine according to an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of another management apparatus for a virtual machine according to an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a management system for a virtual machine according to an embodiment of the present application.
  • an embodiment of the present application provides a system.
  • the system includes:
  • a network connection is established between the cloud platform 1 and each of the plurality of cloud hosts 2.
  • the network connection may be a wired connection or a wireless connection.
  • Cloud platform 1 can be used to manage virtual machines on cloud host 2.
  • the management operations performed by the cloud platform 1 on the virtual machine on the cloud host 2 may include creating a virtual machine on the cloud host 2, turning off the virtual machine on the cloud host 2, turning on the virtual machine on the cloud host 2, or migrating the cloud. At least one of management operations such as a virtual machine on the host 2 and deleting a virtual machine on the cloud host 2.
  • the cloud host 2 may provide computing resources required for the virtual machines it includes to run, and the computing resources may include a CPU, a memory space, and the like.
  • Cloud platform 1 may be used to receive a virtual machine creation request message sent by a client.
  • the virtual machine creation request message includes configuration information of the virtual machine to be created, and the configuration information includes at least the amount of computing resources required for the virtual machine to be created; according to the configuration
  • the information determines the target cloud host among the multiple cloud hosts 2. Among them, the difference between the current remaining idle resources of the target cloud host minus the number of computing resources is greater than or equal to a preset threshold; the allocation is used to identify the virtual machine to be created Sending the virtual machine creation request message including the identification information and configuration information of the virtual machine to be created to the target cloud host.
  • the target cloud host receives the virtual machine creation request message, creates a virtual machine to be created, allocates computing resources to the virtual machine to be created according to the amount of computing resources carried in the virtual machine creation request message, and sends a virtual machine creation completion message to cloud platform 1. .
  • Cloud platform 1 receives the virtual machine creation completion message, and determines that the target cloud host has finished creating the virtual machine to be created.
  • the cloud platform 1 is also used to store the correspondence between the identification information of the virtual machine and the device identification of the cloud host, the correspondence between the device identification of the cloud host and the number of resources, and / or the identification information and resources of the virtual machine. Correspondence of quantity.
  • the identification information of the virtual machine to be created and the device identifier of the target cloud host may be stored in the correspondence between the identification information of the virtual machine and the device identifier. in.
  • the identification information of the virtual machine to be created may include information such as a Universally Unique Identifier (UUID) of the virtual machine to be created, and the device identifier of the target cloud host may include a protocol (Internet Protocol) for interconnection between the networks of the target cloud host. (IP) address and / or Media Access Control (MAC) address and other information.
  • UUID Universally Unique Identifier
  • IP Internet Protocol
  • MAC Media Access Control
  • the identification information of the virtual machine to be created is UUID1
  • the device identification of the target cloud host is IP1
  • the identification information UUID1 and The device identification IP1 of the target cloud host is correspondingly stored in the correspondence between the identification information of the virtual machine and the device identification shown in Table 1.
  • the resource quantity corresponding to the target cloud host may also be updated in the correspondence between the device identifier and the number of resources.
  • the amount of resources corresponding to the target cloud host may include the current remaining idle resources of the target cloud host and the total number of resources included in the target cloud host.
  • the target cloud host ’s The number of idle resources corresponding to the device identification is updated to the difference.
  • the device identifier of the target cloud host is IP1 and the number of idle resources currently remaining on the target cloud host is 30. Assuming that the number of computing resources required for the virtual machine to be created is 5, the calculated difference is 25. Therefore, in the correspondence between the device identifier and the resource quantity shown in Table 2, the device identifier IP1 of the target cloud platform corresponds to The number of idle resources 30 is updated to the difference 25, and the correspondence between the device identifier and the number of resources shown in Table 3 is obtained.
  • Cloud host 1 receives a virtual machine shutdown request message sent by the client.
  • the virtual machine shutdown request message includes identification information of the virtual machine to be shut down. According to the identification information of the virtual machine to be shut down, the correspondence between the virtual machine identification information and the device identifier To obtain the device identifier of the cloud host 2 where the virtual machine to be shut down is located, and forward the virtual machine shutdown request message to the cloud host 2 corresponding to the device identifier.
  • the cloud host 2 may receive the virtual machine shutdown request message, and obtain a resource management policy for managing the computing resources occupied by the virtual machine to be shut down according to the identification information of the virtual machine to be shut down included in the virtual machine shutdown request message; The virtual machine, and after shutting down the virtual machine to be shut down, manages the computing resources occupied by the virtual machine to be shut down according to the resource management policy.
  • the correspondence between the type of the virtual machine and the resource management policy is stored in the cloud host 2. Therefore, the cloud host 2 can obtain the type of the virtual machine to be shut down according to the identification information of the virtual machine to be shut down; according to the type of the virtual machine to be shut down, obtain the corresponding resource management strategy from the correspondence between the type of the virtual machine and the resource management strategy.
  • Table 4 shows the correspondence between virtual machine types and resource management policies.
  • the types of virtual machines include a first type of virtual machine, a second type of virtual machine, and a third type of virtual machine.
  • the first type of virtual machine is a virtual machine that occupies the hard disk of the cloud host.
  • the resource management policy corresponding to the first type of virtual machine is the first resource management policy.
  • the first resource management policy instructs the cloud host not to release the virtual machine after shutting down the first type of virtual machine.
  • the first type of virtual machine occupies the hard disk of the cloud host
  • the first type of virtual machine stores user data on the cloud host ’s hard disk when it is running on the cloud host, and the first type of virtual machine This user data is used. If the first type of virtual machine is powered on, the cloud host does not have enough computing resources for the first type of cloud host, so the first type of cloud host will be migrated to another cloud host and started, because there is no The user data required for the first type of cloud host to be saved, so that the first type of virtual machine cannot be started on other cloud hosts.
  • the cloud host is prevented from releasing the computing resources occupied by the first type of virtual machine according to the first resource management policy, thereby ensuring that the cloud host has computing resources.
  • user data stored on the hard disk of the cloud host can be used to ensure that the first type of virtual machine can be restarted.
  • the second type of virtual machine is a virtual machine for VIP (Very Important) users.
  • the resource management policy corresponding to the second type of virtual machine is the second resource management policy.
  • the second resource management policy instructs the cloud host to Free up the computing resources occupied by the virtual machine; VIP users are usually paying users. In order to retain paying users and improve the experience of paying users, it is necessary to reduce the time required for the second type of virtual machine to be turned on after it is turned off. For this reason, in the embodiment of the present application, when the second type of virtual machine is shut down, the cloud host is prevented from releasing the computing resources occupied by the second type of virtual machine according to the second resource management policy, thereby ensuring that the cloud host has computing resources available for the second Type virtual machines start quickly.
  • the third type of virtual machine is a type of virtual machine other than the first type of virtual machine and the second type of virtual machine.
  • the resource management policy corresponding to the third type of virtual machine is a third resource management policy.
  • the third resource management policy includes a preset. A time threshold is used to instruct the cloud host to wait after shutting down the third type of virtual machine and release the computing resources occupied by the third type of virtual machine when the waiting time reaches a preset time threshold.
  • the cloud host may turn on the third type of virtual machine soon after shutting down the third type of virtual machine, so the third resource management policy includes a preset time threshold for instructing the cloud host to wait after shutting down the third type of virtual machine, and The computing resources occupied by the third type of virtual machine are not released immediately. In this way, if the cloud host needs to start the third type of virtual machine within the waiting time, the cloud host does not need to apply for computing resources, and can directly use the unreleased computing resources to start the third type of virtual machine to increase the startup speed.
  • the hard disks used by the second type virtual machine and the third type virtual machine are often not the local hard disks of the cloud host, but the shared hard disks located on the network. In this way, when the second type virtual machine is powered on, the second type virtual machine can read its stored data from the shared hard disk, and when the third type virtual machine is migrated to another cloud host and started, the third type virtual machine can also Read its stored data from the shared hard drive.
  • Virtual machine type Resource management strategy Type 1 virtual machine First resource management strategy Second type of virtual machine Second resource management strategy Third type of virtual machine Third resource management strategy
  • Cloud platform 1 receives a virtual machine migration request message sent by a client, where the virtual machine migration request message includes identification information of a virtual machine to be migrated; and in a correspondence between the virtual machine identification information and a device identifier, the identifier of the virtual machine to be migrated is The device identifier of the first cloud host corresponding to the information is updated to the device identifier of the second cloud host.
  • the first cloud host is the cloud host where the virtual machine to be migrated is located before the migration
  • the second cloud host is the cloud where the virtual machine to be migrated is located after the migration. Host.
  • cloud platform 1 may also send a resource application request message to the second cloud host, where the resource application request message includes the information required by the virtual machine to be migrated.
  • the number of computing resources The resource application request message is used by the second cloud host to apply for computing resources for the virtual machine to be migrated according to the amount of computing resources required by the virtual machine to be migrated.
  • Cloud platform 1 receives a virtual machine start request message sent by a client, where the virtual machine start request message includes identification information of a virtual machine to be started, and according to the identification information of the virtual machine to be started, the correspondence between the identification information of the virtual machine and the device identifier To obtain the device identifier of the first cloud host where the virtual machine to be turned on is sent, and send the virtual machine start request message to the first cloud host corresponding to the device identifier.
  • the first cloud host receives the virtual machine start request message, and determines the virtual machine to be started according to the identification information of the virtual machine to be started included in the virtual machine start request message; if the first cloud host includes an amount of idle resources greater than or equal to that to be started.
  • the amount of computing resources required by the virtual machine and the first cloud host has released the computing resources occupied by the virtual machine to be turned on, or the first cloud host has not released the computing resources occupied by the virtual machine to be turned on. 1 Send a virtual machine power-on completion message.
  • a virtual machine startup failure message is sent to the cloud platform 1.
  • Cloud platform 1 determines that the virtual machine to be powered on is successfully turned on when it receives a virtual machine power-on completion message; when it receives a virtual machine power-up failure message, it uses multiple cloud hosts 2 based on the amount of computing resources required by the virtual machine to be powered on.
  • a third cloud host is determined, wherein the difference between the current remaining idle resource amount of the third cloud host minus the number of computing resources is greater than or equal to a preset threshold; sending an identifier including the virtual machine to be turned on to the third cloud host Information and configuration information of the virtual machine start request message, the configuration information includes at least the amount of computing resources required by the virtual machine to be turned on.
  • the third cloud host receives the virtual machine power-on request message, creates a virtual machine to be powered on, allocates computing resources to the virtual machine to be powered on according to the amount of computing resources carried in the virtual machine power-on request message, and sends a virtual machine power-on success message to cloud platform 1.
  • Cloud platform 1 receives the virtual machine startup success message, and determines that the virtual machine to be started is successfully opened.
  • Cloud platform 1 receives a virtual machine deletion request message sent by a client, where the virtual machine deletion request message includes identification information of a virtual machine to be deleted; according to the identification information of the virtual machine to be deleted, the correspondence between the identification information of the virtual machine and the device identifier The deletion includes the correspondence between the identification information of the virtual machine to be deleted.
  • cloud platform 1 when the cloud host has not released the computing resources occupied by the virtual machine to be deleted, cloud platform 1 sends a resource release request message to the cloud host according to the device identifier of the cloud host, and the resource release request message includes the virtual machine to be deleted Machine identification information, and the resource release request message is used by the cloud host to release the computing resources occupied by the virtual machine to be deleted according to the identification information of the virtual machine to be deleted.
  • the cloud host 2 may obtain the remaining amount of idle resources and report the remaining amount of idle resources to the cloud platform 1.
  • the cloud host 2 can determine the virtual machine whose computing resources are not currently released, and based on the determined number of computing resources occupied by each virtual machine, calculate the total number of occupied computing resources, and based on the total number of computing resources it includes and the Occupies the total number of computing resources and obtains its remaining free resources.
  • the cloud platform 1 may receive the number of idle resources sent by the cloud host 2, and update the number of idle resources corresponding to the device identifier of the cloud host 2 to the number of received idle resources in the correspondence between the device identifier and the number of resources.
  • Cloud host 2 can obtain its free resources when the virtual machine it contains changes. For example, cloud host 2 obtains its virtual machine when it shuts down a virtual machine, creates a virtual machine, or starts a virtual machine. Number of free resources. Alternatively, the cloud host 2 may obtain its idle resource amount periodically.
  • an embodiment of the present application provides a method for managing a virtual machine.
  • the management method may be used to perform the foregoing operation of creating a virtual machine on a cloud host, and may be applied to the system shown in FIG. 1.
  • the method includes:
  • Step 201 The cloud platform receives a virtual machine creation request message sent by a client.
  • the virtual machine creation request message includes configuration information of a virtual machine to be created, and the configuration information includes at least the amount of computing resources required for the virtual machine to be created.
  • the virtual machine When a user needs to create a virtual machine, for the convenience of description, the virtual machine is called a to-be-created virtual machine, and the user can input configuration information of the to-be-created virtual machine to the client.
  • the client obtains the configuration information of the virtual machine to be created, and sends a virtual machine creation request message including the configuration information of the virtual machine to be created to the cloud platform.
  • Step 202 The cloud platform determines the target cloud host among the multiple cloud hosts according to the configuration information, wherein the difference between the number of remaining idle resources of the target cloud host minus the number of computing resources is greater than or equal to a preset threshold.
  • the calculated difference is equal to the amount of idle resources remaining on the target cloud host after the virtual machine to be created is created on the target cloud host. This can ensure that the target cloud host retains a certain amount of idle time after the virtual machine is created. Resources, so for the closed virtual machines in the target cloud host, when some of the closed virtual machines are turned on, you can use the reserved idle resources to start the part of the virtual machines, and the virtual machines on the target cloud host are started on the target cloud host The speed is faster, which can increase the speed of turning on the virtual machine.
  • the first method can make the amount of idle resources reserved by the target cloud host greater than or equal to a preset threshold.
  • the number of resources corresponding to each device identifier stored in the corresponding relationship between the device identifier and the number of resources can be obtained.
  • the number of resources corresponding to the device identifier includes the current remaining idle resource amount of the cloud host corresponding to the device identifier.
  • the number of idle resources corresponding to the device ID is subtracted from the number of computing resources to obtain the difference corresponding to each device ID; a device ID is selected from the device IDs whose difference is greater than or equal to a preset threshold, and the cloud corresponding to the selected device ID is The host is identified as the target cloud host.
  • a device identifier may be selected according to the load of the cloud host corresponding to each device identifier, for example, the device identifier of a cloud host with the lightest load may be selected .
  • the second method can make the proportion of idle resources reserved by the target cloud host greater than or equal to a preset proportion threshold.
  • the number of resources corresponding to each device identifier stored in the correspondence between the device identifier and the number of resources can be obtained.
  • the number of resources corresponding to the device identifier includes the total resources of the cloud host corresponding to the device identifier and the current remaining free space.
  • the number of resources; the number of idle resources corresponding to each device identifier is subtracted from the number of computing resources to obtain the difference value corresponding to each device identifier; and the total amount of resources corresponding to each device identifier and the difference value are used to calculate the corresponding idle capacity of each device identifier Resource ratio; select a device identifier from device identifiers whose idle resource ratio is greater than or equal to a preset ratio threshold, and determine the cloud host corresponding to the selected device identifier as the target cloud host.
  • a device identifier may be selected according to the load of the cloud host corresponding to each device identifier, for example, a cloud host with the lightest load may be selected.
  • Equipment Identity For each device identifier whose idle resource ratio is greater than or equal to a preset ratio threshold, a device identifier may be selected according to the load of the cloud host corresponding to each device identifier, for example, a cloud host with the lightest load may be selected.
  • Step 203 Assign identification information for identifying the virtual machine to be created, and send a virtual machine creation request message including the identification information and configuration information of the virtual machine to be created to the target cloud host.
  • the identification information of the virtual machine to be created is used to uniquely identify the virtual machine to be created.
  • the identification information of the virtual machine to be created may include information such as the UUID of the virtual machine to be created.
  • Step 204 The target cloud host receives the virtual machine creation request message, creates a virtual machine to be created, and sends a virtual machine creation completion message to the cloud platform.
  • the target cloud host receives the virtual machine creation request message, the virtual machine creation request message includes identification information of the virtual machine to be created and a quantity of computing resources, creates the virtual machine to be created, and sets the virtual machine to be created and the virtual machine to be created Corresponds to the identification information of the virtual machine to be created according to the quantity of the computing resources of the virtual machine to be created to allocate computing resources to complete the creation of the virtual machine to be created.
  • Step 205 The cloud platform receives the virtual machine creation completion message, and sends a first notification message including identification information of the virtual machine to be created to the client to notify the client that the virtual machine to be created is created.
  • the client receives the first notification message, and may save the identification information of the virtual machine to be created included in the first notification message, so as to be used when a subsequent request to shut down the virtual machine, start the virtual machine, migrate the virtual machine, and / or delete the virtual machine. .
  • the cloud platform may further store the identification information of the virtual machine to be created and the device identifier of the target cloud host in the correspondence between the identification information of the virtual machine and the device identifier; and / or,
  • the identification information of the virtual machine to be created and the number of computing resources are correspondingly stored in a correspondence between the identification information of the virtual machine and the number of computing resources.
  • the target cloud host since the number of idle resources remaining on the target cloud host after creating the virtual machine to be created on the target cloud host is greater than or equal to a preset threshold, this can ensure that the target cloud host is creating the target cloud host.
  • a part of the idle resources that are not less than a preset threshold are also reserved, so that when some of the virtual machines in the target cloud host are turned on, the reserved idle resources can be used to start the part of the virtual machines without affecting the The speed at which some virtual machines are turned on.
  • an embodiment of the present application provides a method for managing a virtual machine.
  • the management method may be used to perform the foregoing operation of shutting down a virtual machine on a cloud host, and may be applied to the system shown in FIG. 1.
  • the method includes:
  • Step 301 The cloud platform receives a virtual machine shutdown request message sent by a client, and the virtual machine shutdown request message includes identification information of a virtual machine to be shut down.
  • the virtual machine When a user needs to shut down a virtual machine, for convenience of explanation, the virtual machine is referred to as a virtual machine to be shut down, and the user may input identification information of the virtual machine to be shut down to the client.
  • the client then obtains the identification information of the virtual machine to be shut down, and sends a virtual machine shutdown request message including the identification information of the virtual machine to be shut down to the cloud platform.
  • Step 302 The cloud platform forwards the virtual machine shutdown request message to the cloud host where the virtual machine to be shut down is based on the identification information of the virtual machine to be shut down.
  • This step may be: the cloud platform obtains, according to the identification information of the virtual machine to be shut down, the device identifier of the cloud host where the virtual machine to be shut down is obtained from the correspondence between the virtual machine identification information and the device identifier, and obtains the cloud corresponding to the device identifier.
  • the host forwards the virtual machine shutdown request message.
  • Step 303 The cloud host receives the virtual machine shutdown request message, and obtains a resource management policy for managing the computing resources occupied by the virtual machine to be shut down according to the identification information of the virtual machine to be shut down included in the virtual machine shutdown request message.
  • the cloud host stores the correspondence between the type of the virtual machine and the resource management strategy. Therefore, the cloud host can obtain the type of the virtual machine to be shut down according to the identification information of the virtual machine to be shut down; according to the type of the virtual machine to be shut down, obtain the corresponding resource management strategy from the correspondence between the type of the virtual machine and the resource management strategy.
  • the cloud platform may send the correspondence between the type of the virtual machine and the resource management policy to each cloud host.
  • the cloud host receives and saves the correspondence between the type of the virtual machine and the resource management strategy.
  • the correspondence between the type of the virtual machine and the resource management strategy may be created by the cloud platform.
  • the correspondence between the type of the virtual machine and the resource management strategy is shown in Table 4.
  • the obtained resource management strategy is the first resource management strategy
  • the acquired resource management policy is the second resource management strategy
  • the acquired resource management policy is the third Resource management strategy.
  • Step 304 The cloud host shuts down the virtual machine to be shut down, and manages the computing resources occupied by the virtual machine to be shut down according to the resource management policy after shutting down the virtual machine to be shut down.
  • the cloud host does not release the computing resources occupied by the virtual machine to be shut down after shutting down the virtual machine to be shut down.
  • the cloud host waits after shutting down the virtual machine to be shut down and releases the computing resources occupied by the virtual machine to be shut down when the waiting time reaches a preset time threshold.
  • the cloud host receives the virtual machine start request message sent by the cloud platform for requesting to start the virtual machine to be shut down during the waiting process, the computing resources occupied by the virtual machine to be shut down are not released, but the computing resource is directly used. Computing resources power on virtual machines to be shut down, thereby increasing the speed of powering on.
  • the cloud host may also send a virtual machine shutdown completion message to the cloud platform.
  • the virtual machine shutdown completion message may further include status identification information, which is used to identify whether the cloud host releases the computing resources occupied by the virtual machine to be shut down.
  • the cloud platform may store the identification information of the virtual machine to be shut down and the status identification information included in the virtual machine shutdown completion message in the correspondence between the identification information of the virtual machine and the status identification information, and The client sends a second notification message to notify the client that the virtual machine to be shut down has been shut down.
  • the cloud host can obtain its own remaining idle resource quantity and report its remaining idle resource quantity to the cloud platform.
  • the cloud host can determine the virtual machine that has not released the computing resources, and calculate the total number of occupied computing resources according to the determined number of computing resources occupied by each virtual machine. According to the total number of computing resources included and the occupied resources, Calculate the total number of resources and obtain the remaining free resources.
  • the cloud platform may receive the number of idle resources sent by the cloud host, and update the number of idle resources corresponding to the device identifier of the cloud host in the correspondence between the device identifier and the number of resources to the number of received idle resources.
  • a cloud host can obtain its free resources when the virtual machines it includes change. For example, the cloud host obtains its free resources when it shuts down a virtual machine, creates a virtual machine, or starts a virtual machine. Quantity. Alternatively, the cloud host may periodically obtain its idle resource amount.
  • the cloud host obtains a resource management policy corresponding to the virtual machine to be shut down according to the identification information of the virtual machine to be shut down. In this way, after the virtual machine to be shut down is shut down, the occupation of the virtual machine to be shut down is managed according to the resource management policy. For each virtual machine, a resource management strategy corresponding to the virtual machine is used to manage the computing resources occupied by the virtual machine, which enriches the management method of the virtual machine.
  • an embodiment of the present application provides a method for managing a virtual machine.
  • the management method may be used to perform the foregoing operation of migrating a virtual machine on a cloud host, and may be applied to the system shown in FIG. 1.
  • the method includes:
  • Step 401 The cloud platform receives a virtual machine migration request message sent by a client, and the virtual machine migration request message includes identification information of a virtual machine to be migrated.
  • the virtual machine When a user needs to migrate a virtual machine, for the convenience of description, the virtual machine is referred to as a virtual machine to be migrated, and the user may input identification information of the virtual machine to be migrated to the client.
  • the client then obtains the identification information of the virtual machine to be migrated, and sends a virtual machine migration request message including the identification information of the virtual machine to be migrated to the cloud platform.
  • Step 402 The cloud platform updates the device identifier of the first cloud host corresponding to the identification information of the virtual machine to be migrated to the device identifier of the second cloud host in the correspondence between the identification information of the virtual machine and the device identifier.
  • the cloud host is the cloud host where the virtual machine to be migrated is located before the migration
  • the second cloud host is the cloud host where the virtual machine to be migrated is located after the migration.
  • the user may also input the device identifier of the second cloud host to the client, so that the virtual machine migration request message may include the device identifier of the second cloud host, and the cloud platform may obtain the second cloud from the virtual machine migration request message.
  • the device identification of the host or
  • the cloud platform can select one of the multiple cloud hosts that is different from the first cloud host.
  • the other cloud host serves as the second cloud host.
  • the cloud platform when the cloud platform selects the second cloud host, if the first cloud host has released the computing resources occupied by the virtual machine to be migrated, the cloud platform may randomly select one of the multiple cloud hosts that is different from the first cloud host.
  • the other cloud host serves as the second cloud host; if the first cloud host does not release the computing resources occupied by the virtual machine to be migrated, the cloud platform may select one of the multiple cloud hosts including the amount of idle resources greater than or equal to Another cloud host that requires a different amount of computing resources and is different from the first cloud host serves as the second cloud host.
  • PTZ can obtain corresponding status identification information from the correspondence between the identification information of the virtual machine and the status identification information, and the status identification information is used to identify the occupation of the virtual machine to be migrated. Whether the computing resources are released, so the cloud platform can determine whether the first cloud host releases the computing resources occupied by the virtual machine to be migrated according to the status identification information.
  • the cloud platform may also obtain the amount of computing resources required for the virtual machine to be migrated from the correspondence between the identification information of the virtual machine and the number of computing resources according to the identification information of the virtual machine to be migrated.
  • Step 403 When the first cloud host has not released the computing resources occupied by the virtual machine to be migrated, the cloud platform sends a resource application request message to the second cloud host, where the resource request message includes identification information of the virtual machine to be migrated and the required Calculate the number of resources.
  • the cloud platform may also send a resource release request message to the first cloud host, where the resource release request message includes identification information of the virtual machine to be migrated, so that the first cloud host receives the resource release request message and according to the resource release request
  • the identification information of the virtual machine to be migrated included in the message releases the computing resources occupied by the virtual machine to be migrated.
  • Step 404 The second cloud host receives the resource application request message, and requests computing resources for the virtual machine to be migrated according to the resource application request message.
  • the resource application request message includes identification information of the virtual machine to be migrated and a required amount of computing resources.
  • the second cloud host allocates computing resources according to the number of computing resources, and sets the computing resources to correspond to the identification information. In this way, when the virtual machine to be migrated is started on the second cloud host, the second cloud host can obtain a computing resource corresponding to the identification information of the virtual machine to be migrated, and use the computing resource to start the virtual machine to be migrated.
  • the cloud platform may further send a third notification message to the client to notify the client that the migration of the virtual machine to be migrated has been completed.
  • the cloud platform may, in the correspondence between the identification information of the virtual machine and the device identifier, use the device of the first cloud host corresponding to the identification information of the virtual machine to be migrated. Updating the identifier to the device identifier of the second cloud host can implement virtual machine migration and improve migration efficiency.
  • an embodiment of the present application provides a method for managing a virtual machine.
  • the management method may be used to perform the foregoing operation of enabling a virtual machine on a cloud host, and may be applied to the system shown in FIG. 1.
  • the method includes:
  • Step 501 The cloud platform receives a virtual machine start request message sent by a client, and the virtual machine start request message includes identification information of a virtual machine to be started.
  • the virtual machine When a user needs to start a closed virtual machine, for convenience of explanation, the virtual machine is referred to as a virtual machine to be opened, and the user may input identification information of the virtual machine to be opened to the client.
  • the client then obtains the identification information of the virtual machine to be turned on, and sends a virtual machine start request message including the identification information of the virtual machine to be turned on to the cloud platform.
  • Step 502 The cloud platform forwards the virtual machine start request message to the first cloud host where the virtual machine to be opened is located according to the identification information of the virtual machine to be opened.
  • This step may be: obtaining, according to the identification information of the virtual machine to be turned on, the device identifier of the first cloud host where the virtual machine to be turned on is obtained from the correspondence between the virtual machine identification information and the device identifier, and obtaining the first cloud corresponding to the device identifier The host sends the virtual machine start request message.
  • Step 503 The first cloud host receives the virtual machine start request message, and determines whether the virtual machine to be started can be started according to the virtual machine start request message. If so, step 504 is performed, and if not, step 505 is performed.
  • the first cloud host determines the to-be-opened virtual machine according to the identification information of the to-be-opened virtual machine included in the virtual machine start request message, and obtains the amount of computing resources occupied by the to-be-opened virtual machine. If the first cloud host has released the computing resources occupied by the to-be-opened virtual machine and the amount of computing resources required by the to-be-opened virtual machine is less than or equal to the current remaining idle of the first cloud host The amount of resources, it is determined that the virtual machine to be turned on can be started; if the first cloud host has released the computing resources occupied by the virtual machine to be turned on and the number of computing resources required by the virtual machine to be turned on is greater than the amount of idle resources currently remaining on the first cloud host It is determined that the virtual machine to be started cannot be started.
  • Step 504 The first cloud host starts the virtual machine to be started, sends a virtual machine startup completion message to the cloud platform, and executes step 509.
  • Step 505 The first cloud host sends a virtual machine startup failure message to the cloud platform, and step 506 is performed.
  • Step 506 The cloud platform receives a virtual machine start-up failure message, and determines a third cloud host among multiple cloud hosts according to the identification information of the virtual machine to be turned on, where the current amount of idle resources remaining on the third cloud host minus the virtual machine to be turned on. The difference generated after the amount of computing resources required by the machine is greater than or equal to a preset threshold.
  • the cloud platform may obtain the amount of computing resources required for the virtual machine to be started from the correspondence between the identification information of the virtual machine and the amount of computing resources according to the identification information of the virtual machine to be turned on.
  • a third cloud host is determined.
  • the first method can make the amount of idle resources reserved by the third cloud host greater than or equal to a preset threshold.
  • the number of resources corresponding to each device identifier stored in the corresponding relationship between the device identifier and the number of resources can be obtained.
  • the number of resources corresponding to the device identifier includes the current remaining idle resource amount of the cloud host corresponding to the device identifier.
  • the number of idle resources corresponding to the device ID is subtracted from the number of computing resources to obtain the difference corresponding to each device ID; a device ID is selected from the device IDs whose difference is greater than or equal to a preset threshold, and the cloud corresponding to the selected device ID is The host is determined as the third cloud host.
  • a device identifier may be selected according to the load of the cloud host corresponding to each device identifier, for example, the device identifier of a cloud host with the lightest load may be selected .
  • the second method can make the proportion of idle resources reserved by the third cloud host greater than or equal to a preset proportion threshold.
  • the number of resources corresponding to each device identifier stored in the correspondence between the device identifier and the number of resources can be obtained.
  • the number of resources corresponding to the device identifier includes the total resources of the cloud host corresponding to the device identifier and the current remaining free space.
  • the number of resources; the number of idle resources corresponding to each device identifier is subtracted from the number of computing resources to obtain the difference corresponding to each device identifier; and the total resources and differences corresponding to each device identifier are used to calculate the idle resources corresponding to each device identifier Proportion; selecting a device identifier from device identifiers whose idle resource ratio is greater than or equal to a preset ratio threshold, and determining the cloud host corresponding to the selected device identifier as the third cloud host.
  • a device identifier may be selected according to the load of the cloud host corresponding to each device identifier, for example, a cloud host with the lightest load may be selected.
  • Equipment Identity For each device identifier whose idle resource ratio is greater than or equal to a preset ratio threshold, a device identifier may be selected according to the load of the cloud host corresponding to each device identifier, for example, a cloud host with the lightest load may be selected.
  • Step 507 The cloud platform sends a virtual machine start request message including identification information and configuration information of the virtual machine to be turned on to the third cloud host.
  • the configuration information includes at least the amount of computing resources required for the virtual machine to be turned on.
  • Step 508 The third cloud host receives the virtual machine start request message, creates a virtual machine to be started, and sends a virtual machine start completion message to the cloud platform.
  • the third cloud host receives the virtual machine start request message, creates a virtual machine to be turned on, and sets the virtual machine to be turned on to correspond to the identification information of the virtual machine to be turned on in the virtual machine start request message, according to the virtual machine.
  • the number of computing resources included in the machine start request message allocates computing resources to the virtual machine to be started, and sends a virtual machine start complete message to the cloud platform to enable the virtual machine to be started.
  • Step 509 The cloud platform receives the virtual machine power-on completion message, and sends a fourth notification message to the client to notify the client to complete power-on of the virtual machine to be powered on.
  • the first cloud host and / or the third cloud host can obtain the remaining amount of idle resources and report it to the cloud platform.
  • the cloud platform For a detailed implementation process, refer to related content in the embodiment shown in FIG. 3, which is not described in detail here.
  • the remaining idle resource amount of the third cloud host is greater than or equal to a preset threshold, which can ensure that the third cloud host can turn on the virtual machine after it is turned on.
  • a preset threshold which can ensure that the third cloud host can turn on the virtual machine after it is turned on.
  • the reserved idle resources can be used to start the part of the virtual machines without affecting the part of the virtual machines. Speed of opening.
  • an embodiment of the present application provides a method for managing a virtual machine.
  • the management method may be used to perform the foregoing operation of deleting a virtual machine on a cloud host, and may be applied to the system shown in FIG. 1.
  • the method includes:
  • Step 601 The cloud platform receives a virtual machine deletion request message sent by a client, where the virtual machine deletion request message includes identification information of a virtual machine to be deleted.
  • the virtual machine When a user needs to delete a virtual machine, for convenience of explanation, the virtual machine is referred to as a virtual machine to be deleted, and the user may input identification information of the virtual machine to be deleted to the client.
  • the client then obtains the identification information of the virtual machine to be deleted, and sends a virtual machine deletion request message including the identification information of the virtual machine to be deleted to the cloud platform.
  • Step 602 The cloud platform deletes the corresponding relationship including the identification information of the virtual machine to be deleted from the corresponding relationship between the identification information of the virtual machine and the device identifier according to the identification information of the virtual machine to be deleted.
  • the cloud platform obtains the device identifier of the cloud host where the virtual machine to be deleted is obtained from the correspondence between the identification information of the virtual machine and the device identifier, and from the identification information of the virtual machine and the device identifier
  • the corresponding relationship of the deletion includes the correspondence between the identification information of the virtual machine to be deleted and the device identification of the cloud host.
  • Step 603 When the cloud host does not release the computing resources occupied by the virtual machine to be migrated, the cloud platform sends a resource release request message to the cloud host where the virtual machine to be deleted is located, and the resource application request message includes identification information of the virtual machine to be deleted.
  • the cloud platform sends a resource release request message to the cloud host according to the device identifier of the cloud host, and the resource release request message includes identification information of the virtual machine to be deleted.
  • PTZ can obtain corresponding status identification information from the correspondence between the identification information of the virtual machine and the status identification information, and the status identification information is used to identify the occupation of the virtual machine to be deleted. Whether the computing resources are released, so the cloud platform can determine whether the cloud host releases the computing resources occupied by the virtual machine to be deleted based on the status identification information.
  • Step 604 The cloud host receives the resource release request message, and releases the computing resources occupied by the virtual machine to be deleted according to the identification information of the virtual machine to be deleted.
  • the cloud platform may also send a fifth notification message to the client to notify the client that the deletion of the virtual machine to be deleted has been completed.
  • an embodiment of the present application provides a management device 700 for a virtual machine.
  • a cloud platform is used to manage the device 700.
  • the device 700 may be a cloud host in any of the embodiments shown in FIGS. 1 to 6.
  • cloud hosting including:
  • the receiving unit 701 is configured to receive a virtual machine shutdown request message sent by a cloud platform, where the virtual machine shutdown request message includes identification information of a virtual machine to be shut down;
  • a processing unit 702 configured to obtain a resource management policy for managing the computing resources occupied by the virtual machine to be shut down according to the identification information of the virtual machine to be shut down; to shut down the virtual machine to be shut down; The policy manages the computing resources occupied by the virtual machines to be shut down.
  • processing unit 702 is configured to:
  • a corresponding resource management policy is obtained from the correspondence between the type of the virtual machine and the resource management policy.
  • the resource management policy is used to instruct the device 700 Do not release the computing resources occupied by the virtual machine to be shut down;
  • the resource management policy is used to instruct the apparatus 700 to wait after the virtual machine to be shut down and wait for the waiting time.
  • the preset time threshold is reached, the computing resources occupied by the virtual machine to be shut down are released.
  • the receiving unit 701 is further configured to:
  • the device acquires a resource management policy corresponding to the virtual machine to be shut down according to the identification information of the virtual machine to be shut down, in this way, after the virtual machine to be shut down is shut down, the virtual machine to be shut down is managed according to the resource management policy. Occupied computing resources, so that for each virtual machine, a resource management strategy corresponding to the virtual machine is used to manage the computing resources occupied by the virtual machine, which enriches the management of the virtual machine.
  • an embodiment of the present application provides a management device 800 for a virtual machine.
  • the device 800 is configured to manage multiple cloud hosts.
  • the device 800 may be any one of the embodiments shown in FIGS. 1 to 6.
  • the receiving unit 801 is configured to receive a virtual machine creation request message sent by a client, where the virtual machine creation request message includes configuration information of a virtual machine to be created, where the configuration information includes at least the amount of computing resources required for the virtual machine to be created;
  • a processing unit 802 is configured to determine a target cloud host among multiple cloud hosts according to the configuration information, where a difference between the current remaining idle resource amount of the target cloud host minus the number of computing resources is greater than or equal to a preset threshold;
  • the sending unit 803 is configured to send the virtual machine creation request message to the target cloud host, where the virtual machine creation request message is used to request the target cloud host to create a virtual machine to be created.
  • processing unit 802 is configured to:
  • a device identifier is selected from the device identifiers whose difference is greater than or equal to a preset threshold, and the cloud host corresponding to the selected device identifier is determined as the target cloud host.
  • processing unit 802 is configured to:
  • a device identifier is selected from the device identifiers whose idle resource ratio is greater than or equal to a preset ratio threshold, and the cloud host corresponding to the selected device identifier is determined as the target cloud host.
  • the processing unit 802 is further configured to store the identification information of the virtual machine to be created and the device identification of the target cloud host in a correspondence between the identification information of the virtual machine and the device identification, and / or, store the device The number of idle resources corresponding to the device identifier of the target cloud host saved in the correspondence between the identifier and the number of resources is updated to the difference corresponding to the device identifier of the target cloud host.
  • the receiving unit 801 is further configured to receive a virtual machine migration request message sent by a client, where the virtual machine migration request message includes identification information of a virtual machine to be migrated;
  • the processing unit 802 is further configured to update the device identifier of the first cloud host corresponding to the identification information of the virtual machine to be migrated to the device identifier of the second cloud host in the correspondence between the identification information of the virtual machine and the device identifier.
  • the first cloud host is the cloud host where the virtual machine to be migrated is located before the migration
  • the second cloud host is the cloud host where the virtual machine to be migrated is located after the migration.
  • the sending unit 803 is further configured to send a resource application request message to the second cloud host when the first cloud host has not released the computing resources occupied by the virtual machine to be migrated, and the resource application request message includes the virtual machine to be migrated.
  • the resource request request message is used by the second cloud host to apply for computing resources for the virtual machine to be migrated according to the quantity of computing resources required by the virtual machine to be migrated.
  • the receiving unit 801 is further configured to receive a virtual machine start request message sent by a client, where the virtual machine start request message includes identification information of a virtual machine to be started;
  • the processing unit 802 is further configured to not release the computing resources occupied by the virtual machine to be started on the first cloud host where the virtual machine to be powered on is located, or the first cloud host has released the computing resources occupied by the virtual machine to be powered on and the first cloud
  • the amount of idle resources of the host is greater than or equal to the amount of computing resources required for the virtual machine to be powered on
  • the virtual machine to be powered on is started on the first cloud host; when the first cloud host has released the computing resources occupied by the virtual machine to be powered on and the first
  • the amount of idle resources of the cloud host is less than the amount of computing resources required for the virtual machine to be turned on, start the virtual machine to be turned on on the third cloud host, and subtract the amount of computing resources required for the virtual machine to be turned on from the third cloud host.
  • the difference after the number is greater than or equal to a preset threshold, and the first cloud host and the third cloud host are two different cloud hosts.
  • the receiving unit 801 is further configured to receive a virtual machine deletion request message sent by a client, where the virtual machine deletion request message includes identification information of a virtual machine to be deleted;
  • the processing unit 802 is further configured to delete the correspondence between the identification information of the virtual machine and the device identifier, including the identification information of the virtual machine to be deleted.
  • the target cloud host is determined by the processing unit. Since the difference corresponding to the target cloud host is greater than or equal to a preset threshold, this can ensure that the target cloud host retains a lot of the virtual cloud after it is created. Free resources at a preset threshold so that when some of the virtual machines in the target cloud host are turned off, the reserved idle resources can be used to start the virtual machines without affecting the speed at which the virtual machines are turned on.
  • FIG. 9 is a schematic diagram of a virtual machine management apparatus 900 according to an embodiment of the present application.
  • the device 900 includes at least one processor 901, a bus system 902, a memory 903, and at least one transceiver 904.
  • the device 900 is a device with a hardware structure and can be used to implement the functional units in the device described in FIG. 7.
  • the processing unit 702 in the apparatus 700 shown in FIG. 7 may be implemented by calling the code in the memory 903 by the at least one processor 901, and the receiving unit 701 in the apparatus 700 shown in FIG. 7 may This is achieved by the at least one transceiver 904.
  • the device 900 may also be used to implement the function of the cloud host in any of the embodiments described in FIGS. 1 to 6.
  • the processor 901 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more for controlling the Integrated circuit for application program procedure execution.
  • CPU central processing unit
  • ASIC application-specific integrated circuit
  • the bus system 902 may include a channel for transmitting information between the components.
  • the above-mentioned transceiver 904 is configured to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), and the like.
  • devices or communication networks such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), and the like.
  • the above-mentioned memory 903 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other device that can store information and instructions
  • Type of dynamic storage device can also be electrically erasable programmable read-only memory (electrically erasable programmable read-only memory (EEPROM)), read-only compact disc (compact disc-read-only memory (CD-ROM) or other optical disc storage, optical disc Storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be written Any other media that the computer accesses, but is not limited to.
  • the memory may exist independently and be connected to the processor through a bus. The memory can also be integrated with the processor.
  • the memory 903 is configured to store application program code that executes the solution of the present application, and is controlled and executed by the processor 901.
  • the processor 901 is configured to execute application program code stored in the memory 903, so as to implement functions in the method of the present patent.
  • the processor 901 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 9.
  • the apparatus 900 may include multiple processors, such as the processor 901 and the processor 907 in FIG. 9. Each of these processors can be a single-CPU processor or a multi-CPU processor.
  • a processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
  • the apparatus 900 may further include an output device 905 and an input device 906.
  • the output device 905 communicates with the processor 901 and can display information in a variety of ways.
  • the output device 905 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. Wait.
  • the input device 906 communicates with the processor 901 and can accept user input in a variety of ways.
  • the input device 906 may be a mouse, a keyboard, a touch screen device, or a sensing device.
  • FIG. 10 is a schematic diagram of a management apparatus 1000 for a virtual machine according to an embodiment of the present application.
  • the device 1000 includes at least one processor 1001, a bus system 1002, a memory 1003, and at least one transceiver 1004.
  • the device 1000 is a device with a hardware structure and can be used to implement the functional units in the device described in FIG. 8.
  • the processing unit 802 in the apparatus 800 shown in FIG. 8 may be implemented by calling the code in the memory 1003 by the at least one processor 1001.
  • the receiving unit 801 and The sending unit 803 may be implemented by the at least one transceiver 1004.
  • the device 1000 may also be used to implement the functions of the cloud platform in any of the embodiments described in FIGS. 1 to 6.
  • the processor 1001 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more for controlling the Integrated circuit for application program procedure execution.
  • CPU central processing unit
  • ASIC application-specific integrated circuit
  • the bus system 1002 may include a channel for transmitting information between the components.
  • the transceiver 1004 is used to communicate with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), and the like.
  • networks such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), and the like.
  • the above memory 1003 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM), or other information that can store information and instructions.
  • Type of dynamic storage device can also be electrically erasable programmable read-only memory (electrically erasable programmable read-only memory (EEPROM)), read-only compact disc (compact disc-read-only memory (CD-ROM) or other optical disc storage, optical disc Storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be written Any other media that the computer accesses, but is not limited to.
  • the memory may exist independently and be connected to the processor through a bus. The memory can also be integrated with the processor.
  • the memory 1003 is configured to store application program code that executes the solution of the present application, and the processor 901 controls execution.
  • the processor 1001 is configured to execute application program code stored in the memory 1003, so as to implement functions in the method of the present patent.
  • the processor 1001 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 9.
  • the apparatus 1000 may include multiple processors, such as the processor 1001 and the processor 1007 in FIG. 10. Each of these processors can be a single-CPU processor or a multi-CPU processor.
  • a processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
  • the apparatus 1000 may further include an output device 1005 and an input device 1006.
  • the output device 1005 communicates with the processor 1001 and can display information in a variety of ways.
  • the output device 1005 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. Wait.
  • the input device 1006 communicates with the processor 1001 and can accept user input in a variety of ways.
  • the input device 1006 may be a mouse, a keyboard, a touch screen device, a sensing device, or the like.
  • an embodiment of the present application provides a management system 1100 for a virtual machine.
  • the system includes a device as shown in FIG. 7 or FIG. 9 and a device as shown in FIG. 8 or FIG. 10.
  • the device described in FIG. 7 or FIG. 9 may be a cloud host 1101, and the device described in FIG. 8 or FIG. 10 may be a cloud platform 1102.
  • the program may be stored in a computer-readable storage medium.
  • the storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk.

Abstract

一种虚拟机的管理方法、装置及系统,属于通信领域。所述系统包括:云平台和云主机,所述方法包括:云平台接收客户端发送的虚拟机关闭请求信息(301),向云主机发送虚拟机关闭请求消息(302),所述虚拟机关闭请求消息包括待关闭虚拟机的标识信息;所述云主机根据所述待关闭虚拟机的标识信息,获取用于管理所述待关闭虚拟机占用的计算资源的资源管理策略(303);所述云主机关闭所述待关闭虚拟机,且在关闭所述待关闭虚拟机后根据所述资源管理策略管理所述待关闭虚拟机占用的计算资源(304)。所述装置包括接收单元和处理单元。能够解决目前对虚拟机的管理方式过于单一的问题。

Description

一种虚拟机的管理方法、装置及系统 技术领域
本申请涉及通信领域,特别涉及一种虚拟机的管理方法、装置及系统。
背景技术
云系统包括云平台和云主机,云平台可以在云主机上创建虚拟机,虚拟机在云主机上运行时需要占用云主机的计算资源,该计算资源可以是云主机的中央处理器(Central Processing Unit,CPU)和/或内存等资源。
云平台可以控制云主机上的虚拟机关闭,在控制云主机上的虚拟机关闭后,云主机释放该虚拟机占用的计算资源。目前不管何种虚拟机,在云主机中关闭该虚拟机后,云主机一律释放该虚拟机占用的资源,这种对虚拟机的管理方式过于简单且单一。
发明内容
为了解决目前对虚拟机的管理方式过于单一的问题,本申请实施例提供了一种虚拟机的管理方法、装置及系统。所述技术方案如下:
第一方面,本申请实施例提供了一种虚拟机的管理方法,应用于云主机,云平台用于管理所述云主机,所述云主机接收所述云平台发送的虚拟机关闭请求消息,所述虚拟机关闭请求消息包括待关闭虚拟机的标识信息;根据所述待关闭虚拟机的标识信息,获取用于管理所述待关闭虚拟机占用的计算资源的资源管理策略;关闭所述待关闭虚拟机,且在关闭所述待关闭虚拟机后根据所述资源管理策略管理所述待关闭虚拟机占用的计算资源。这样云主机可以使用待关闭虚拟机对应的资源管理策略管理待关闭虚拟机占用的计算资源,实现对不同虚拟机采用不同方式管理各虚拟机占用的计算资源,丰富了对虚拟机的管理方式。
在第一方面的一种可能的实现方式中,根据所述待关闭虚拟机的标识信息,获取所述待关闭虚拟机的类型;根据所述待关闭虚拟机的类型,从虚拟机的类型与资源管理策略的对应关系中获取对应的资源管理策略。这样可以通过虚拟机的类型与资源管理策略的对应关系获取到不同虚拟机对应的资源管理策略,实现对不同虚拟机采用不同方式管理各虚拟机占用的计算资源。
在第一方面的一种可能的实现方式中,在所述待关闭虚拟机为占用所述云主机的硬盘的第一类型虚拟机或者所述待关闭虚拟机为属于贵宾VIP用户的第二类型虚拟机时,所述资源管理策略用于指示所述云主机不释放所述待关闭虚拟机占用的计算资源;这样可以在开启第一类型虚拟机或第二类型虚拟机时,保证云主机有足够计算资源供第一类型虚拟机开启或第二类型虚拟机开启,不会因云主机的计算资源不足,将第一类型虚拟机迁移到其他云主机上导致第一类型虚拟机无法开启,或者,不会将第二类型云主机迁移到其他云主机,导致第二类型云主机开启速度慢。
在第一方面的一种可能的实现方式中,在所述待关闭虚拟机为除所述第一类型虚拟机和所述第二类型虚拟机以外的其他类型虚拟机时,所述资源管理策略用于指示所述云主机在关闭所述待关闭虚拟机后等待并在等待的时间达到预设时间阈值时释放所述待关闭虚拟机占用 的计算资源。由于等待预设时间阈值才释放待关闭虚拟机占用的计算资源,这样在等待的过程中又需要开启待关闭虚拟机时,省去申请计算资源的操作,可以直接开启待关闭虚拟机,提高开启速度
在第一方面的一种可能的实现方式中,接收所述云平台发送的所述虚拟机的类型与资源管理策略的对应关系。这样可以通过虚拟机的类型与资源管理策略的对应关系获取到不同虚拟机对应的资源管理策略,实现对不同虚拟机采用不同方式管理各虚拟机占用的计算资源。
第二方面,本申请实施例提供了一种虚拟机的管理方法,应用于云平台,所述云平台用于管理多个云主机,所述云平台接收客户端发送的虚拟机创建请求消息,所述虚拟机创建请求消息包括待创建虚拟机的配置信息,所述配置信息至少包括所述待创建虚拟所需要的计算资源数量;根据所述配置信息在所述多个云主机中确定目标云主机,其中,所述目标云主机当前剩余的空闲资源数量减去所述计算资源数量后产生的差值大于或等于预设阈值;向所述目标云主机发送所述虚拟机创建请求消息,所述虚拟机创建请求消息用于请求所述目标云主机创建所述待创建虚拟机。该差值等于在目标云主机上创建待创建虚拟机后目标云主机剩余的空闲资源数量,这样可以保证目标云主机在创建待创建虚拟机后,还保留一部分不少于预设阈值的空闲资源,如此当目标云主机中已关闭的部分虚拟机开启时,可以使用保留的空闲资源来开启该部分虚拟机,不会影响该部分虚拟机开启的速度。
在第二方面的一种可能的实现方式中,获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括所述设备标识对应的云主机当前剩余的空闲资源数量;将所述各设备标识对应的空闲资源数量分别减去所述计算资源数量,得到所述各设备标识对应的差值;从差值大于或等于预设阈值的设备标识中选择一设备标识,将所述选择的设备标识对应的云主机确定为目标云主机。这样使得目标云主机在创建待创建虚拟机后保留的空闲资源数量大于或等于预设阈值。
在第二方面的一种可能的实现方式中,获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括所述设备标识对应的云主机的资源总量和当前剩余的空闲资源数量;将所述各设备标识对应的空闲资源数量分别减去所述计算资源数量,得到所述各设备标识对应的差值;根据所述各设备标识对应的资源总量和差值,分别计算所述各设备标识对应的空闲资源比例;从空闲资源比例大于或等于预设比例阈值的设备标识中选择一设备标识,将所述选择的设备标识对应的云主机确定为目标云主机。这样使得目标云主机在创建待创建虚拟机后保留的空闲资源的比例大于或等于预设比例阈值。
在第二方面的一种可能的实现方式中,将所述待创建虚拟机的标识信息和所述目标云主机的设备标识对应保存在虚拟机的标识信息与设备标识的对应关系中,和/或,将设备标识与资源数量的对应关系中保存的所述目标云主机的设备标识对应的空闲资源数量更新为所述目标云主机的设备标识对应的差值。
在第二方面的一种可能的实现方式中,接收所述客户端发送的虚拟机迁移请求消息,所述虚拟机迁移请求消息包括待迁移虚拟机的标识信息;在虚拟机的标识信息与设备标识的对应关系中,将所述待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识,所述第一云主机是迁移前所述待迁移虚拟机所在的云主机,所述第二云主机是迁移后所述待迁移虚拟机所在的云主机。只需要在虚拟机的标识信息与设备标识的对应关系中,将所述待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备 标识,就可以实现虚拟机迁移,提高迁移效率。
在第二方面的一种可能的实现方式中,在所述第一云主机未释放所述待迁移虚拟机占用的计算资源时,向所述第二云主机发送资源申请请求消息,所述资源申请请求消息包括所述待迁移虚拟机所需要的计算资源数量,所述资源申请请求消息用于所述第二云主机根据所述待迁移虚拟机所需要的计算资源数量为所述待迁移虚拟机申请计算资源。这样可以保证在第二云主机上开启待迁移虚拟机时,有足够计算资源供待迁移虚拟机开启,提高开启速度。
在第二方面的一种可能的实现方式中,所述方法还接收所述客户端发送的虚拟机开启请求消息,所述虚拟机开启请求消息包括待开启虚拟机的标识信息;在所述待开启虚拟机所在的第一云主机未释放所述待开启虚拟机占用的计算资源,或者所述第一云主机已释放所述待开启虚拟机占用的计算资源且所述第一云主机的空闲资源数量大于或等于所述待开启虚拟机所需的计算资源数量时,在所述第一云主机上开启所述待开启虚拟机;在所述第一云主机已释放所述待开启虚拟机占用的计算资源且所述第一云主机的空闲资源数量小于所述待开启虚拟机所需的计算资源数量时,在第三云主机上开启所述待开启虚拟机,所述第三云主机的空闲资源数量减去所述待开启虚拟机所需的计算资源数量后产生的差值大于或等于预设阈值,所述第一云主机和所述第三云主机为两个不同云主机。这样第三云主机开启待开启虚拟机后,第三云主机剩余的空闲资源数量仍大于或等于预设阈值,可以保证第三云主机在开启待开启虚拟机后,还保留一部分不少于预设阈值的空闲资源,当第三云主机中已关闭的部分虚拟机开启时,可以使用保留的空闲资源来开启该部分虚拟机,不会影响该部分虚拟机开启的速度。
在第二方面的一种可能的实现方式中,所述方法接收所述客户端发送的虚拟机删除请求消息,所述虚拟机删除请求消息包括待删除虚拟机的标识信息;在虚拟机的标识信息与设备标识的对应关系中删除包括所述待删除虚拟机的标识信息的对应关系。
第三方面,本申请实施例提供了一种虚拟机的管理装置,用于执行第一方面或第一方面的任意一种可能的实现方式中的方法。具体地,所述装置包括用于执行第一方面或第一方面的任意一种可能的实现方式的方法的单元。
第四方面,本申请实施例提供了一种虚拟机的管理装置,用于执行第二方面或第二方面的任意一种可能的实现方式中的方法。具体地,所述装置包括用于执行第二方面或第二方面的任意一种可能的实现方式的方法的单元。
第五方面,本申请实施例提供了一种虚拟机的管理装置,所述装置包括:收发器、处理器和存储器。其中,所述收发器、所述处理器以及所述存储器之间可以通过总线系统相连。所述存储器用于存储程序、指令或代码,所述处理器用于执行所述存储器中的程序、指令或代码,完成第一方面或第一方面的任意可能的实现方式中的方法或者完成第二方面或第二方面的任意可能的实现方式中的方法。
第六方面,本申请实施例提供了一种计算机程序产品,所述计算机程序产品包括在计算机可读存储介质中存储的计算机程序,并且所述计算程序通过处理器进行加载来实现上述第一方面或第一方面的任意可能的实现方式的方法或者实现上述第二方面或第二方面的任意可能的实现方式的方法。
第七方面,本申请实施例提供了一种非易失性计算机可读存储介质,用于存储计算机程序,所述计算机程序通过处理器进行加载来执行上述第一方面或第一方面的任意可能的实现方式的方法的指令或者执行上述第二方面或第二方面的任意可能的实现方式的方法的指令。
第八方面,本申请实施例提供了一种芯片,所述芯片包括可编程逻辑电路和/或程序指令,当所述芯片运行时用于实现上述第一方面或第一方面的任意可能的实现方式的方法或者实现上述第二方面或第二方面的任意可能的实现方式的方法。
第九方面,本申请实施例提供了一种虚拟机的管理系统,包括如第三方面所述的装置和如第四方面所述的装置。
附图说明
图1是本申请实施例提供的一种系统结构示意图;
图2是本申请实施例提供的一种创建虚拟机的方法流程图;
图3是本申请实施例提供的一种关闭虚拟机的方法流程图;
图4是本申请实施例提供的一种迁移虚拟机的方法流程图;
图5是本申请实施例提供的一种开启虚拟机的方法流程图;
图6是本申请实施例提供的一种删除虚拟机的方法流程图;
图7是本申请实施例提供的一种虚拟机的管理装置结构示意图;
图8是本申请实施例提供的另一种虚拟机的管理装置结构示意图;
图9是本申请实施例提供的另一种虚拟机的管理装置结构示意图;
图10是本申请实施例提供的另一种虚拟机的管理装置结构示意图;
图11是本申请实施例提供的一种虚拟机的管理系统结构示意图。
具体实施方式
下面将结合附图对本申请实施方式作进一步地详细描述。
参见图1,本申请实施例提供了一种系统,该系统包括:
云平台1和多个云主机2;
可选的,云平台1与多个云主机2中的每个云主机2之间建立有网络连接。可选的,该网络连接可以为有线连接或无线连接。
云平台1,可以用于管理云主机2上的虚拟机。
可选的,云平台1对云主机2上的虚拟机进行的管理操作可以包括在云主机2上创建虚拟机,关闭云主机2上的虚拟机、开启云主机2上的虚拟机、迁移云主机2上的虚拟机和删除云主机2上的虚拟机等管理操作中的至少一个。
可选的,云主机2可以为其包括的虚拟机提供运行所需要的计算资源,该计算资源可以包括CPU和内存空间等。
对于在云主机2上创建虚拟机的操作,可以为:
云平台1可以用于接收客户端发送的虚拟机创建请求消息,该虚拟机创建请求消息包括待创建虚拟机的配置信息,该配置信息至少包括待创建虚拟所需要的计算资源数量;根据该配置信息在多个云主机2中确定目标云主机,其中,目标云主机当前剩余的空闲资源数量减去该计算资源数量后产生的差值大于或等于预设阈值;分配用于标识待创建虚拟机的标识信息,向目标云主机发送包括待创建虚拟机的标识信息和配置信息的虚拟机创建请求消息。
其中,目标云主机接收该虚拟机创建请求消息,创建待创建虚拟机,根据该虚拟机创建 请求消息携带的计算资源数量为待创建虚拟机分配计算资源,向云平台1发送虚拟机创建完成消息。
云平台1接收该虚拟机创建完成消息,并确定目标云主机创建完待创建虚拟机。
可选的,云平台1中还用于存储虚拟机的标识信息与云主机的设备标识的对应关系,云主机的设备标识与资源数量的对应关系,和/或,虚拟机的标识信息与资源数量的对应关系。
可选的,云平台1在目标云主机上创建完待创建虚拟机后,可以将待创建虚拟机的标识信息和目标云主机的设备标识对应保存在虚拟机的标识信息与设备标识的对应关系中。
待创建虚拟机的标识信息可以包括待创建虚拟机的通用唯一识别码(Universally Unique Identifier,UUID)等信息,目标云主机的设备标识可以包括目标云主机的网络之间互连的协议(Internet Protocol,IP)地址和/或媒体介入控制层(Media Access Control,MAC)地址等信息。
例如,假设待创建虚拟机的标识信息为UUID1,目标云主机的设备标识为IP1,云平台1在目标云主机1上创建完待创建虚拟机后,可以将待创建虚拟机的标识信息UUID1和目标云主机的设备标识IP1对应保存在如表1所示的虚拟机的标识信息与设备标识的对应关系中。
表1
虚拟机的标识信息 设备标识
UUID1 IP1
…… ……
可选的,云平台1在目标云主机上创建完待创建虚拟机后,还可以在设备标识与资源数量的对应关系中更新目标云主机对应的资源数量。其中,目标云主机对应的资源数量可以包括目标云主机当前剩余的空闲资源数量和目标云主机包括的总资源数量,在实现时,将设备标识与资源数量的对应关系中保存的目标云主机的设备标识对应的空闲资源数量更新为该差值。
例如,参见下表2所示的设备标识与资源数量的对应关系,假设,目标云主机的设备标识为IP1,目标云主机当前剩余的空闲资源数量为30。假设待创建虚拟机所需要的计算资源数量为5,则计算出来的差值为25,所以在如表2所示的设备标识与资源数量的对应关系中将目标云平台的设备标识IP1对应的空闲资源数量30更新为该差值25,得到如表3所示的设备标识与资源数量的对应关系。
表2
Figure PCTCN2019091085-appb-000001
表3
Figure PCTCN2019091085-appb-000002
对于在云主机2上关闭虚拟机的操作,可以为:
云主机1接收客户端发送的虚拟机关闭请求消息,该虚拟机关闭请求消息包括待关闭虚拟机的标识信息,根据待关闭虚拟机的标识信息,从虚拟机的标识信息与设备标识的对应关系中获取待关闭虚拟机所在的云主机2的设备标识,向该设备标识对应的云主机2转发该虚拟机关闭请求消息。
该云主机2可以接收该虚拟机关闭请求消息,根据该虚拟机关闭请求消息包括的待关闭虚拟机的标识信息,获取用于管理待关闭虚拟机占用的计算资源的资源管理策略;关闭待关闭虚拟机,且在关闭待关闭虚拟机后根据该资源管理策略管理待关闭虚拟机占用的计算资源。
可选的,云主机2中存储有虚拟机的类型与资源管理策略的对应关系。所以云主机2可以根据待关闭虚拟机的标识信息,获取待关闭虚拟机的类型;根据待关闭虚拟机的类型,从虚拟机的类型与资源管理策略的对应关系中获取对应的资源管理策略。
参见下表4,表4是虚拟机的类型与资源管理策略的对应关系。如表4所示,虚拟机的类型包括第一类型虚拟机,第二类型虚拟机和第三类型虚拟机。第一类型虚拟机是占用云主机的硬盘的虚拟机,第一类型虚拟机对应的资源管理策略为第一资源管理策略,第一资源管理策略指示云主机在关闭第一类型虚拟机后不释放第一类型虚拟机占用的计算资源。其中,第一类型虚拟机由于占用云主机的硬盘,通常第一类型虚拟机在云主机上运行时会在该云主机的硬盘上存储用户数据,第一类型虚拟机在关闭后重新开启时会使用到该用户数据。如果第一类型虚拟机在开启时,云主机上没有足够计算资源供第一类型云主机使用,这样第一类型云主机就会被迁移到其他云主机上开启,由于其他云主机的硬盘上没有保存供第一类型云主机开启所需要的该用户数据,使得第一类型虚拟机在其他云主机上无法开启。
为了解决该问题,在本申请实施例中,当第一类型虚拟机关闭后,使云主机根据第一资源管理策略不释放第一类型虚拟机占用的计算资源,从而保证云主机上有计算资源供第一类型虚拟机开启,且在第一类型虚拟机开启时可以使用到存储在云主机硬盘上的用户数据,保证第一类型虚拟机能够重新开启。
第二类型虚拟机是贵宾(Very Important People,VIP)用户的虚拟机,第二类型虚拟机对应的资源管理策略为第二资源管理策略,第二资源管理策略指示云主机在关闭虚拟机后不释放该虚拟机占用的计算资源;VIP用户通常是付费用户,为了留住付费用户以及提高付费用户的使用体验,则需要减小第二类型虚拟机在关闭后开启所需要的时间。为此在本申请实施例中,当第二类型虚拟机关闭后,使云主机根据第二资源管理策略不释放第二类型虚拟机占用的计算资源,从而保证云主机上有计算资源供第二类型虚拟机快速开启。
第三类型虚拟机是除第一类型虚拟机和第二类型虚拟机以外的其他类型虚拟机,第三类型虚拟机对应的资源管理策略为第三资源管理策略,第三资源管理策略包括预设时间阈值,用于指示云主机在关闭第三类型虚拟机后等待并在等待的时间达到预设时间阈值时释放第三类型虚拟机占用的计算资源。
云主机在关闭第三类型虚拟机后,可能很快又开启第三类型虚拟机,所以第三资源管理策略包括预设时间阈值,用于指示云主机在关闭第三类型虚拟机后等待,而不立即释放第三类型虚拟机占用的计算资源。这样如果在等待的时间内云主机需要开启第三类型虚拟机,则云主机不需要申请计算资源,可以直接使用未释放的计算资源开启第三类型虚拟机,提高开 启速度。
其中,第二类型虚拟机和第三类型虚拟机所使用到的硬盘,往往不是云主机本地的硬盘,而是位于网络中的共享硬盘。这样当第二类型虚拟机开启时第二类型虚拟机可以从共享硬盘中读取其存储的数据,以及当第三类型虚拟机被迁移到其他云主机上开启时,第三类型虚拟机也可以从共享硬盘中读取其存储的数据。
表4
虚拟机类型 资源管理策略
第一类型虚拟机 第一资源管理策略
第二类型虚拟机 第二资源管理策略
第三类型虚拟机 第三资源管理策略
对于迁移云主机2上的虚拟机的操作,可以为:
云平台1接收客户端发送的虚拟机迁移请求消息,该虚拟机迁移请求消息包括待迁移虚拟机的标识信息;在虚拟机的标识信息与设备标识的对应关系中,将待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识,第一云主机是迁移前待迁移虚拟机所在的云主机,第二云主机是迁移后待迁移虚拟机所在的云主机。
可选的,在第一云主机未释放待迁移虚拟机占用的计算资源时,云平台1还可以向第二云主机发送资源申请请求消息,该资源申请请求消息包括待迁移虚拟机所需要的计算资源数量,该资源申请请求消息用于第二云主机根据待迁移虚拟机所需要的计算资源数量为待迁移虚拟机申请计算资源。
对于在云主机2上开启虚拟机的操作,可以为:
云平台1接收客户端发送的虚拟机开启请求消息,该虚拟机开启请求消息包括待开启虚拟机的标识信息,根据待开启虚拟机的标识信息,从虚拟机的标识信息与设备标识的对应关系中获取待开启虚拟机所在的第一云主机的设备标识,向该设备标识对应的第一云主机发送该虚拟机开启请求消息。
第一云主机接收该虚拟机开启请求消息,根据该虚拟机开启请求消息包括的待开启虚拟机的标识信息,确定待开启虚拟机;如果第一云主机包括的空闲资源数量大于或等于待开启虚拟机所需要的计算资源数量且第一云主机已释放待开启虚拟机占用的计算资源,或者第一云主机没有释放待开启虚拟机占用的计算资源,则开启待开启虚拟机,向云平台1发送虚拟机开启完成消息。如果第一云主机包括的空闲资源数量小于待开启虚拟机所需要的计算资源数量且第一云主机已释放待开启虚拟机占用的计算资源,则向云平台1发送虚拟机开启失败消息。
云平台1当接收到虚拟机开启完成消息时,确定成功开启待开启虚拟机;当接收到到虚拟机开启失败消息,则根据待开启虚拟机所需要的计算资源数量,在多个云主机2中确定第三云主机,其中,第三云主机当前剩余的空闲资源数量减去该计算资源数量后产生的差值大于或等于预设阈值;向第三云主机发送包括待开启虚拟机的标识信息和配置信息的虚拟机开启请求消息,该配置信息至少包括待开启虚拟机所需要的计算资源数量。
第三云主机接收该虚拟机开启请求消息,创建待开启虚拟机,根据该虚拟机开启请求消息携带的计算资源数量为待开启虚拟机分配计算资源,向云平台1发送虚拟机开启成功消息。 云平台1接收该虚拟机开启成功消息,确定成功开启待开启虚拟机。
对于删除云主机2上的虚拟机的操作,可以为:
云平台1接收客户端发送的虚拟机删除请求消息,该虚拟机删除请求消息包括待删除虚拟机的标识信息;根据待删除虚拟机的标识信息,从虚拟机的标识信息与设备标识的对应关系中删除包括待删除虚拟机的标识信息的对应关系。
可选的,在该云主机未释放待删除虚拟机占用的计算资源时,云平台1根据该云主机的设备标识,向该云主机发送资源释放请求消息,该资源释放请求消息包括待删除虚拟机的标识信息,该资源释放请求消息用于该云主机根据待删除虚拟机的标识信息,释放待删除虚拟机占用的计算资源。
可选的,对于每个云主机2,该云主机2可以获取自己剩余的空闲资源数量,并向云平台1上报其剩余的空闲资源数量。其中,云主机2可以确定当前未被释放计算资源的虚拟机,根据确定的各虚拟机所占用的计算资源数量,计算出已被占用计算资源总数目,根据其包括的计算资源总数和已被占用计算资源总数目,获取其剩余的空闲资源数量。
可选的,云平台1可以接收云主机2发送的空闲资源数量,在设备标识与资源数量的对应关系中将该云主机2的设备标识对应的空闲资源数量更新为接收的空闲资源数量。
云主机2可以在其包括的虚拟机发生变化时就获取其空闲资源数量,例如,云主机2在关闭某个虚拟机,在创建某个虚拟机或在开启某个虚拟机等情况时获取其空闲资源数量。或者,云主机2可以周期性地获取其空闲资源数量。
参见图2,本申请实施例提供了一种对虚拟机的管理方法,该管理方法可以用于执行上述在云主机上创建虚拟的操作,且可以应用于图1所示的系统。该方法包括:
步骤201:云平台接收客户端发送的虚拟机创建请求消息,该虚拟机创建请求消息包括待创建虚拟机的配置信息,该配置信息至少包括待创建虚拟所需要的计算资源数量。
用户当需要创建虚拟机时,为了便于说明称该虚拟机为待创建虚拟机,用户可以向客户端输入待创建虚拟机的配置信息。然后客户端获取待创建虚拟机的配置信息,向云平台发送包括待创建虚拟机的配置信息的虚拟机创建请求消息。
步骤202:云平台根据该配置信息在多个云主机中确定目标云主机,其中,目标云主机当前剩余的空闲资源数量减去该计算资源数量后产生的差值大于或等于预设阈值。
计算出的差值等于在目标云主机上创建待创建虚拟机后目标云主机剩余的空闲资源数量,这样可以保证目标云主机在创建待创建虚拟机后,还保留一部分不少预设阈值的空闲资源,如此对于目标云主机中已关闭的虚拟机,当已关闭的部分虚拟机开启时,可以使用保留的空闲资源来开启该部分虚拟机,目标云主机上的虚拟机在目标云主机上开启的速度较快,可以提高开启虚拟机的速度。
可选的,在本步骤中列举了如下两种方式来确定目标云主机,对于其他的方式不再一一列举。对于该两种方式分别为:
第一种方式可以使目标云主机保留的空闲资源数量大于或等于预设阈值。该方式在实现时,可以获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括该设备标识对应的云主机当前剩余的空闲资源数量;将各设备标识对应的空闲资源数量分别减去该计算资源数量,得到各设备标识对应的差值;从差值大于或等于预设阈值的设备标识中选择一设备标识,将选择的设备标识对应的云主机确定为目标云主 机。
可选的,对于差值大于或等于预设阈值的每个设备标识,可以根据每个设备标识对应的云主机的负载来选择一个设备标识,例如可以选择负载最轻的一个云主机的设备标识。
第二种方式可以使目标云主机保留的空闲资源的比例大于或等于预设比例阈值。该方式在实现时,可以获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括该设备标识对应的云主机的资源总量和当前剩余的空闲资源数量;将各设备标识对应的空闲资源数量分别减去该计算资源数量,得到各设备标识对应的差值;根据各设备标识对应的资源总量和差值,分别计算各设备标识对应的空闲资源比例;从空闲资源比例大于或等于预设比例阈值的设备标识中选择一设备标识,将选择的设备标识对应的云主机确定为目标云主机。
可选的,对于空闲资源比例大于或等于预设比例阈值的每个设备标识,可以根据每个设备标识对应的云主机的负载来选择一个设备标识,例如可以选择负载最轻的一个云主机的设备标识。
步骤203:分配用于标识待创建虚拟机的标识信息,向目标云主机发送包括待创建虚拟机的标识信息和配置信息的虚拟机创建请求消息。
待创建虚拟机的标识信息用于唯一标识待创建虚拟机,待创建虚拟机的标识信息可以包括待创建虚拟机的UUID等信息。
步骤204:目标云主机接收该虚拟机创建请求消息,创建待创建虚拟机,向云平台发送虚拟机创建完成消息。
可选的,目标云主机接收该虚拟机创建请求消息,该虚拟机创建请求消息包括待创建虚拟机的标识信息和计算资源数量,创建待创建虚拟机,设置待创建虚拟机与待创建虚拟机的标识信息相对应,根据该待创建虚拟机的计算资源数量为待创建虚拟机分配计算资源,以完成创建待创建虚拟机。
步骤205:云平台接收该虚拟机创建完成消息,向客户端发送包括待创建虚拟机的标识信息的第一通知消息,以通知客户端创建完待创建虚拟机。
可选的,客户端接收第一通知消息,可以保存第一通知消息包括的待创建虚拟机的标识信息,以便后续请求关闭虚拟机、开启虚拟机、迁移虚拟机和/或删除虚拟机时使用。
可选的,云平台在接收到该虚拟机创建完成消息后,还可以将待创建虚拟机的标识信息和目标云主机的设备标识对应保存在虚拟机的标识信息与设备标识的对应关系中;和/或,
将设备标识与资源数量的对应关系中保存的目标云主机的设备标识对应的空闲资源数量更新为该差值;和/或,
将待创建虚拟机的标识信息和计算资源数量对应保存在虚拟机的标识信息与计算资源数量的对应关系中。
在本申请实施例中,在确定出目标云主机,由于在目标云主机上创建待创建虚拟机后目标云主机剩余的空闲资源数量大于或等于预设阈值,这样可以保证目标云主机在创建待创建虚拟机后,还保留一部分不少于预设阈值的空闲资源,如此当目标云主机中已关闭的部分虚拟机开启时,可以使用保留的空闲资源来开启该部分虚拟机,不会影响该部分虚拟机开启的速度。
参见图3,本申请实施例提供了一种对虚拟机的管理方法,该管理方法可以用于执行上述在云主机上关闭虚拟的操作,且可以应用于图1所示的系统。该方法包括:
步骤301:云平台接收客户端发送的虚拟机关闭请求消息,该虚拟机关闭请求消息包括待关闭虚拟机的标识信息。
用户当需要关闭虚拟机时,为了便于说明称该虚拟机为待关闭虚拟机,用户可以向客户端输入待关闭虚拟机的标识信息。然后客户端获取待关闭虚拟机的标识信息,向云平台发送包括待关闭虚拟机的标识信息的虚拟机关闭请求消息。
步骤302:云平台根据待关闭虚拟机的标识信息,向待关闭虚拟机所在的云主机转发该虚拟机关闭请求消息。
本步骤可以为:云平台根据该待关闭虚拟机的标识信息,从虚拟机的标识信息与设备标识的对应关系中获取待关闭虚拟机所在的云主机的设备标识,向该设备标识对应的云主机转发该虚拟机关闭请求消息。
步骤303:云主机接收该虚拟机关闭请求消息,根据该虚拟机关闭请求消息包括的待关闭虚拟机的标识信息,获取用于管理待关闭虚拟机占用的计算资源的资源管理策略。
云主机中存储有虚拟机的类型与资源管理策略的对应关系。所以云主机可以根据待关闭虚拟机的标识信息,获取待关闭虚拟机的类型;根据待关闭虚拟机的类型,从虚拟机的类型与资源管理策略的对应关系中获取对应的资源管理策略。
可选的,在执行本步骤之前,云平台可以向每个云主机发送虚拟机的类型与资源管理策略的对应关系。对于每个云主机,该云主机接收并保存虚拟机的类型与资源管理策略的对应关系。
可选的,虚拟机的类型与资源管理策略的对应关系可以由云平台创建的。
在本步骤中,假设虚拟机的类型与资源管理策略的对应关系如表4所示,当待关闭虚拟机的类型为第一类型虚拟机,则获取的资源管理策略为第一资源管理策略;当待关闭虚拟机的类型为第二类型虚拟机,则获取的资源管理策略为第二资源管理策略;当待关闭虚拟机的类型为第三类型虚拟机,则获取的资源管理策略为第三资源管理策略。
步骤304:云主机关闭待关闭虚拟机,且在关闭待关闭虚拟机后根据该资源管理策略管理待关闭虚拟机占用的计算资源。
当该资源管理策略为第一资源管理策略或第二资源管理策略时,云主机在关闭待关闭虚拟机后,不释放待关闭虚拟机占用的计算资源。
当该资源管理策略为第三资源管理策略时,云主机在关闭待关闭虚拟机后等待并在等待的时间达到预设时间阈值时释放待关闭虚拟机占用的计算资源。
可选的,如果云主机在等待的过程接收到云平台发送的用于请求开启待关闭虚拟机的虚拟机开启请求消息时,则不释放待关闭虚拟机占用的计算资源,而是直接使用该计算资源开启待关闭虚拟机,从而提高开启速度。
可选的,云主机还可以向云平台发送虚拟机关闭完成消息,该虚拟机关闭完成消息还可以包括状态标识信息,该状态标识信息用于标识云主机是否释放待关闭虚拟机占用的计算资源。云平台接收该虚拟机关闭完成消息,可以将待关闭虚拟机的标识信息和该虚拟机关闭完成消息包括的状态标识信息对应保存在虚拟机的标识信息与状态标识信息的对应关系中,以及向客户端发送第二通知消息,以通知客户端已关闭待关闭虚拟机。
可选的,对于每个云主机,该云主机可以获取自己剩余的空闲资源数量,并向云平台上报其剩余的空闲资源数量。其中,云主机可以确定当前未被释放计算资源的虚拟机,根据确定的各虚拟机所占用的计算资源数量,计算出已被占用计算资源总数目,根据其包括的计算资源总数和已被占用计算资源总数目,获取其剩余的空闲资源数量。
可选的,云平台可以接收云主机发送的空闲资源数量,在设备标识与资源数量的对应关系中将该云主机的设备标识对应的空闲资源数量更新为接收的空闲资源数量。
云主机可以在其包括的虚拟机发生变化时就获取其空闲资源数量,例如,云主机在关闭某个虚拟机,在创建某个虚拟机或在开启某个虚拟机等情况时获取其空闲资源数量。或者,云主机可以周期性地获取其空闲资源数量。
在本申请实施例中,由于云主机根据待关闭虚拟机的标识信息,获取待关闭虚拟机对应的资源管理策略,这样在关闭待关闭虚拟机后,根据该资源管理策略管理待关闭虚拟机占用的计算资源,从而针对每个虚拟机,采用与该虚拟机相对应的资源管理策略来管理该虚拟机占用的计算资源,丰富了对虚拟机的管理方式。
参见图4,本申请实施例提供了一种对虚拟机的管理方法,该管理方法可以用于执行上述在云主机上迁移虚拟机的操作,且可以应用于图1所示的系统。该方法包括:
步骤401:云平台接收客户端发送的虚拟机迁移请求消息,该虚拟机迁移请求消息包括待迁移虚拟机的标识信息。
用户当需要迁移虚拟机时,为了便于说明称该虚拟机为待迁移虚拟机,用户可以向客户端输入待迁移虚拟机的标识信息。然后客户端获取待迁移虚拟机的标识信息,向云平台发送包括待迁移虚拟机的标识信息的虚拟机迁移请求消息。
步骤402:云平台在虚拟机的标识信息与设备标识的对应关系中,将待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识,其中,第一云主机是迁移前待迁移虚拟机所在的云主机,第二云主机是迁移后待迁移虚拟机所在的云主机。
可选的,用户还可以向客户端输入第二云主机的设备标识,这样虚拟机迁移请求消息可以包括第二云主机的设备标识,云平台可以从该虚拟机迁移请求消息中获取第二云主机的设备标识;或者,
当用户没有向客户端输入第二云主机的设备标识,即虚拟机迁移请求消息不包括第二云主机的设备标识,这样云平台可以从多个云主机中选择一个与第一云主机不同的另一个云主机作为第二云主机。
可选的,云平台在选择第二云主机时,如果第一云主机已释放待迁移虚拟机占用的计算资源,则云平台可以从多个云主机中随机选择一个与第一云主机不同的另一个云主机作为第二云主机;如果第一云主机没有释放待迁移虚拟机占用的计算资源,则云平台可以从多个云主机中选择一个包括空闲资源数量大于或等于待迁移虚拟机所需的计算资源数量且与第一云主机不同的另一个云主机作为第二云主机。
可选的,云台平可以根据待迁移虚拟机的标识信息,从虚拟机的标识信息与状态标识信息的对应关系中获取对应的状态标识信息,该状态标识信息用于标识待迁移虚拟机占用的计算资源是否被释放,所以云平台可以根据该状态标识信息确定第一云主机是否释放待迁移虚拟机占用的计算资源。
可选的,云平台还可以根据待迁移虚拟机的标识信息,从虚拟机的标识信息与计算资源数量的对应关系中获取待迁移虚拟机所需要的计算资源数量。
步骤403:在第一云主机未释放待迁移虚拟机占用的计算资源时,云平台向第二云主机发送资源申请请求消息,该资源申请请求消息包括待迁移虚拟机的标识信息和所需要的计算资源数量。
可选的,云平台还可以向第一云主机发送资源释放请求消息,该资源释放请求消息包括待迁移虚拟机的标识信息,这样第一云主机接收该资源释放请求消息,根据该资源释放请求消息包括的待迁移虚拟机的标识信息释放待迁移虚拟机占用的计算资源。
步骤404:第二云主机接收该资源申请请求消息,根据该资源申请请求消息为待迁移虚拟机申请计算资源。
该资源申请请求消息包括待迁移虚拟机的标识信息和所需要的计算资源数量,第二云主机根据该计算资源数量分配计算资源,设置该计算资源与该标识信息相对应。这样当在第二云主机上开启待迁移虚拟机时,第二云主机可以获取与待迁移虚拟机的标识信息相对应的计算资源,使用该计算资源开启待迁移虚拟机。
可选的,在完成迁移后,云平台还可以向客户端发送第三通知消息,以通知客户端已完成迁移待迁移虚拟机。
在本申请实施例中,在迁移待迁移虚拟机时,云平台可以在虚拟机的标识信息与设备标识的对应关系中,将所述待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识,就可以实现虚拟机迁移,提高迁移效率。
参见图5,本申请实施例提供了一种对虚拟机的管理方法,该管理方法可以用于执行上述在云主机上开启虚拟的操作,且可以应用于图1所示的系统。该方法包括:
步骤501:云平台接收客户端发送虚拟机开启请求消息,该虚拟机开启请求消息包括待开启虚拟机的标识信息。
用户当需要开启某个已关闭的虚拟机时,为了便于说明称该虚拟机为待开启虚拟机,用户可以向客户端输入待开启虚拟机的标识信息。然后客户端获取待开启虚拟机的标识信息,向云平台发送包括待开启虚拟机的标识信息的虚拟机开启请求消息。
步骤502:云平台根据待开启虚拟机的标识信息,向待开启虚拟机所在的第一云主机转发该虚拟机开启请求消息。
本步骤可以为:根据待开启虚拟的标识信息,从虚拟机的标识信息与设备标识的对应关系中获取待开启虚拟机所在的第一云主机的设备标识,向该设备标识对应的第一云主机发送该虚拟机开启请求消息。
步骤503:第一云主机接收该虚拟机开启请求消息,根据该虚拟机开启请求消息确定是否能够开启待开启虚拟机,如果能够,则执行步骤504,如果不能够,则执行步骤505。
第一云主机根据该虚拟机开启请求消息包括的待开启虚拟机的标识信息,确定待开启虚拟机,获取待开启虚拟机占用的计算资源数量,如果第一云主机没有释放待开启虚拟机占用的计算资源,则确定能够开启待开启虚拟机;如果第一云主机已释放待开启虚拟机占用的计算资源且待开启虚拟机所需要的计算资源数量小于或等于第一云主机当前剩余的空闲资源数量,则确定能够开启待开启虚拟机;如果第一云主机已释放待开启虚拟机占用的计算资源且 待开启虚拟机所需要的计算资源数量大于第一云主机当前剩余的空闲资源数量,则确定不能够开启待开启虚拟机。
步骤504:第一云主机开启待开启虚拟机,向云平台发送虚拟机开启完成消息,执行步骤509。
步骤505:第一云主机向云平台发送虚拟机开启失败消息,执行步骤506。
步骤506:云平台接收虚拟机开启失败消息,根据待开启虚拟机的标识信息,在多个云主机中确定第三云主机,其中,第三云主机当前剩余的空闲资源数量减去待开启虚拟机所需要的计算资源数量后产生的差值大于或等于预设阈值。
可选的,云平台可以根据待开启虚拟机的标识信息,从虚拟机的标识信息与计算资源数量的对应关系中获取待开启虚拟机所需的计算资源数量,根据该计算资源数量,在多个云主机中确定第三云主机。
可选的,在本步骤中列举了如下两种方式来确定第三云主机,对于其他的方式不再一一列举。对于该两种方式分别为:
第一种方式可以使第三云主机保留的空闲资源数量大于或等于预设阈值。该方式在实现时,可以获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括该设备标识对应的云主机当前剩余的空闲资源数量;将各设备标识对应的空闲资源数量分别减去该计算资源数量,得到各设备标识对应的差值;从差值大于或等于预设阈值的设备标识中选择一设备标识,将选择的设备标识对应的云主机确定为第三云主机。
可选的,对于差值大于或等于预设阈值的每个设备标识,可以根据每个设备标识对应的云主机的负载来选择一个设备标识,例如可以选择负载最轻的一个云主机的设备标识。
第二种方式可以使第三云主机保留的空闲资源的比例大于或等于预设比例阈值。该方式在实现时,可以获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括该设备标识对应的云主机的资源总量和当前剩余的空闲资源数量;将各设备标识对应的空闲资源数量分别减去计算资源数量,得到各设备标识对应的差值;根据各设备标识对应的资源总量和差值,分别计算各设备标识对应的空闲资源比例;从空闲资源比例大于或等于预设比例阈值的设备标识中选择一设备标识,将选择的设备标识对应的云主机确定为第三云主机。
可选的,对于空闲资源比例大于或等于预设比例阈值的每个设备标识,可以根据每个设备标识对应的云主机的负载来选择一个设备标识,例如可以选择负载最轻的一个云主机的设备标识。
步骤507:云平台向第三云主机发送包括待开启虚拟机的标识信息和配置信息的虚拟机开启请求消息,该配置信息至少包括待开启虚拟机所需要的计算资源数量。
步骤508:第三云主机接收该虚拟机开启请求消息,创建待开启虚拟机,向云平台发送虚拟机开启完成消息。
在本步骤中,第三云主机接收该虚拟机开启请求消息,创建待开启虚拟机,设置待开启虚拟机与该虚拟机开启请求消息中的待开启虚拟机的标识信息相对应,根据该虚拟机开启请求消息包括的计算资源数量为待开启虚拟机分配计算资源,向云平台发送虚拟机开启完成消息,以实现开启待开启虚拟机。
步骤509:云平台接收虚拟机开启完成消息,向客户端发送第四通知消息,以通知客户端完成开启待开启虚拟机。
第一云主机和/或第三云主机可以获取其剩余的空闲资源数量并上报给云平台,详细实现过程可以参见图3所示实施例中的相关内容,在此不再详细说明。
在本申请实施例中,由于第三云主机上开启待开启虚拟机后,第三云主机剩余的空闲资源数量大于或等于预设阈值,这样可以保证第三云主机在开启待开启虚拟机后,还保留一部分不少于预设阈值的空闲资源,如此当第三云主机中已关闭的部分虚拟机开启时,可以使用保留的空闲资源来开启该部分虚拟机,不会影响该部分虚拟机开启的速度。
参见图6,本申请实施例提供了一种对虚拟机的管理方法,该管理方法可以用于执行上述删除云主机上的虚拟机的操作,且可以应用于图1所示的系统。该方法包括:
步骤601:云平台接收客户端发送的虚拟机删除请求消息,该虚拟机删除请求消息包括待删除虚拟机的标识信息。
用户当需要删除虚拟机时,为了便于说明称该虚拟机为待删除虚拟机,用户可以向客户端输入待删除虚拟机的标识信息。然后客户端获取待删除虚拟机的标识信息,向云平台发送包括待删除虚拟机的标识信息的虚拟机删除请求消息。
步骤602:云平台根据待删除虚拟机的标识信息,从虚拟机的标识信息与设备标识的对应关系中删除包括待删除虚拟机的标识信息的对应关系。
在本步骤中:云平台根据待删除虚拟机的标识信息,从虚拟机的标识信息与设备标识的对应关系中获取待删除虚拟机所在云主机的设备标识,从虚拟机的标识信息与设备标识的对应关系中删除包括待删除虚拟机的标识信息和该云主机的设备标识的对应关系。
步骤603:在该云主机未释放待迁移虚拟机占用的计算资源时,云平台向待删除虚拟机所在的云主机发送资源释放请求消息,该资源申请请求消息包括待删除虚拟机的标识信息。
在本步骤中,云平台根据该云主机的设备标识,向该云主机发送资源释放请求消息,该资源释放请求消息包括待删除虚拟机的标识信息。
可选的,云台平可以根据待删除虚拟机的标识信息,从虚拟机的标识信息与状态标识信息的对应关系中获取对应的状态标识信息,该状态标识信息用于标识待删除虚拟机占用的计算资源是否被释放,所以云平台可以根据该状态标识信息确定云主机是否释放待删除虚拟机占用的计算资源。
步骤604:云主机接收该资源释放请求消息,根据根据待删除虚拟机的标识信息,释放待删除虚拟机所占用的计算资源。
可选的,在完成删除后,云平台还可以向客户端发送第五通知消息,以通知客户端已完成删除待删除虚拟机。
参见图7,本申请实施例提供了一种虚拟机的管理装置700,云平台用于管理所述装置700,所述装置700可以为图1至6所示的任一实施例中的云主机或云主机中的部分,包括:
接收单元701,用于接收云平台发送的虚拟机关闭请求消息,该虚拟机关闭请求消息包括待关闭虚拟机的标识信息;
处理单元702,用于根据待关闭虚拟机的标识信息,获取用于管理待关闭虚拟机占用的计算资源的资源管理策略;关闭待关闭虚拟机,且在关闭待关闭虚拟机后根据该资源管理策略管理待关闭虚拟机占用的计算资源。
可选的,所述处理单元702,用于:
根据待关闭虚拟机的标识信息,获取待关闭虚拟机的类型;
根据待关闭虚拟机的类型,从虚拟机的类型与资源管理策略的对应关系中获取对应的资源管理策略。
可选的,在待关闭虚拟机为占用所述装置的硬盘的第一类型虚拟机或者待关闭虚拟机为属于VIP用户的第二类型虚拟机时,该资源管理策略用于指示所述装置700不释放待关闭虚拟机占用的计算资源;
在待关闭虚拟机为除第一类型虚拟机和第二类型虚拟机以外的其他类型虚拟机时,该资源管理策略用于指示所述装置700在关闭待关闭虚拟机后等待并在等待的时间达到预设时间阈值时释放待关闭虚拟机占用的计算资源。
可选的,接收单元701,还用于:
接收云平台发送的虚拟机的类型与资源管理策略的对应关系。
在本申请实施例中,由于所述装置根据待关闭虚拟机的标识信息,获取待关闭虚拟机对应的资源管理策略,这样在关闭待关闭虚拟机后,根据该资源管理策略管理待关闭虚拟机占用的计算资源,从而针对每个虚拟机,采用与该虚拟机相对应的资源管理策略来管理该虚拟机占用的计算资源,丰富了对虚拟机的管理方式。
参见图8,本申请实施例提供了一种虚拟机的管理装置800,所述装置800用于管理多个云主机,所述装置800可以为图1至6所示的任一实施例中的云平台或云平台中的部分,包括:
接收单元801,用于接收客户端发送的虚拟机创建请求消息,该虚拟机创建请求消息包括待创建虚拟机的配置信息,该配置信息至少包括待创建虚拟所需要的计算资源数量;
处理单元802,用于根据该配置信息在多个云主机中确定目标云主机,其中,目标云主机当前剩余的空闲资源数量减去该计算资源数量后产生的差值大于或等于预设阈值;
发送单元803,用于向目标云主机发送该虚拟机创建请求消息,该虚拟机创建请求消息用于请求目标云主机创建待创建虚拟机。
可选的,所述处理单元802,用于:
获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括该设备标识对应的云主机当前剩余的空闲资源数量;
将各设备标识对应的空闲资源数量分别减去该计算资源数量,得到各设备标识对应的差值;
从差值大于或等于预设阈值的设备标识中选择一设备标识,将选择的设备标识对应的云主机确定为目标云主机。
可选的,所述处理单元802,用于:
获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括该设备标识对应的云主机的资源总量和当前剩余的空闲资源数量;
将各设备标识对应的空闲资源数量分别减去该计算资源数量,得到各设备标识对应的差值;
根据各设备标识对应的资源总量和差值,分别计算各设备标识对应的空闲资源比例;
从空闲资源比例大于或等于预设比例阈值的设备标识中选择一设备标识,将选择的设备 标识对应的云主机确定为目标云主机。
可选的,所述处理单元802,还用于将待创建虚拟机的标识信息和目标云主机的设备标识对应保存在虚拟机的标识信息与设备标识的对应关系中,和/或,将设备标识与资源数量的对应关系中保存的目标云主机的设备标识对应的空闲资源数量更新为目标云主机的设备标识对应的差值。
可选的,所述接收单元801,还用于接收客户端发送的虚拟机迁移请求消息,该虚拟机迁移请求消息包括待迁移虚拟机的标识信息;
所述处理单元802,还用于在虚拟机的标识信息与设备标识的对应关系中,将待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识,第一云主机是迁移前待迁移虚拟机所在的云主机,第二云主机是迁移后待迁移虚拟机所在的云主机。
可选的,所述发送单元803,还用于在第一云主机未释放待迁移虚拟机占用的计算资源时,向第二云主机发送资源申请请求消息,该资源申请请求消息包括待迁移虚拟机所需要的计算资源数量,该资源申请请求消息用于第二云主机根据待迁移虚拟机所需要的计算资源数量为待迁移虚拟机申请计算资源。
可选的,所述接收单元801,还用于接收客户端发送的虚拟机开启请求消息,该虚拟机开启请求消息包括待开启虚拟机的标识信息;
所述处理单元802,还用于在待开启虚拟机所在的第一云主机未释放待开启虚拟机占用的计算资源,或者第一云主机已释放待开启虚拟机占用的计算资源且第一云主机的空闲资源数量大于或等于待开启虚拟机所需的计算资源数量时,在第一云主机上开启待开启虚拟机;在第一云主机已释放待开启虚拟机占用的计算资源且第一云主机的空闲资源数量小于待开启虚拟机所需的计算资源数量时,在第三云主机上开启待开启虚拟机,第三云主机的空闲资源数量减去待开启虚拟机所需的计算资源数量后产生的差值大于或等于预设阈值,第一云主机和第三云主机为两个不同云主机。
可选的,所述接收单元801,还用于接收客户端发送的虚拟机删除请求消息,该虚拟机删除请求消息包括待删除虚拟机的标识信息;
所述处理单元802,还用于在虚拟机的标识信息与设备标识的对应关系中删除包括待删除虚拟机的标识信息的对应关系。
在本申请实施例中,在处理单元确定出目标云主机,由于目标云主机对应的差值大于或等于预设阈值,这样可以保证目标云主机在创建待创建虚拟机后,还保留一部分不少于预设阈值的空闲资源,如此当目标云主机中已关闭的部分虚拟机开启时,可以使用保留的空闲资源来开启该部分虚拟机,不会影响该部分虚拟机开启的速度。
参见图9,图9所示为本申请实施例提供的一种虚拟机的管理装置900示意图。该装置900包括至少一个处理器901,总线系统902,存储器903以及至少一个收发器904。
该装置900是一种硬件结构的装置,可以用于实现图7所述的装置中的功能单元。例如,本领域技术人员可以想到图7所示的装置700中的处理单元702可以通过该至少一个处理器901调用存储器903中的代码来实现,图7所示的装置700中的接收单元701可以通过该至少一个收发器904来实现。
可选的,该装置900还可用于实现如图1至6所述的任一实施例中云主机的功能。
可选的,上述处理器901可以是一个通用中央处理器(central processing unit,CPU), 微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制本申请方案程序执行的集成电路。
上述总线系统902可包括一通路,在上述组件之间传送信息。
上述收发器904,用于与其他设备或通信网络通信,如以太网,无线接入网(radio access network,RAN),无线局域网(wireless local area networks,WLAN)等。
上述存储器903可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过总线与处理器相连接。存储器也可以和处理器集成在一起。
其中,存储器903用于存储执行本申请方案的应用程序代码,并由处理器901来控制执行。处理器901用于执行存储器903中存储的应用程序代码,从而实现本专利方法中的功能。
在具体实现中,作为一种实施例,处理器901可以包括一个或多个CPU,例如图9中的CPU0和CPU1。
在具体实现中,作为一种实施例,该装置900可以包括多个处理器,例如图9中的处理器901和处理器907。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。
在具体实现中,作为一种实施例,该装置900还可以包括输出设备905和输入设备906。输出设备905和处理器901通信,可以以多种方式来显示信息。例如,输出设备905可以是液晶显示器(liquid crystal display,LCD),发光二级管(light emitting diode,LED)显示设备,阴极射线管(cathode ray tube,CRT)显示设备,或投影仪(projector)等。输入设备906和处理器901通信,可以以多种方式接受用户的输入。例如,输入设备906可以是鼠标、键盘、触摸屏设备或传感设备等。
参见图10,图10所示为本申请实施例提供的一种虚拟机的管理装置1000示意图。该装置1000包括至少一个处理器1001,总线系统1002,存储器1003以及至少一个收发器1004。
该装置1000是一种硬件结构的装置,可以用于实现图8所述的装置中的功能单元。例如,本领域技术人员可以想到图8所示的装置800中的处理单元802可以通过该至少一个处理器1001调用存储器1003中的代码来实现,图8所示的装置800中的接收单元801和/或发送单元803可以通过该至少一个收发器1004来实现。
可选的,该装置1000还可用于实现如图1至6所述的任一实施例中云平台的功能。
可选的,上述处理器1001可以是一个通用中央处理器(central processing unit,CPU),微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制本申请方案程序执行的集成电路。
上述总线系统1002可包括一通路,在上述组件之间传送信息。
上述收发器1004,用于与其他设备或通信网络通信,如以太网,无线接入网(radio access  network,RAN),无线局域网(wireless local area networks,WLAN)等。
上述存储器1003可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过总线与处理器相连接。存储器也可以和处理器集成在一起。
其中,存储器1003用于存储执行本申请方案的应用程序代码,并由处理器901来控制执行。处理器1001用于执行存储器1003中存储的应用程序代码,从而实现本专利方法中的功能。
在具体实现中,作为一种实施例,处理器1001可以包括一个或多个CPU,例如图9中的CPU0和CPU1。
在具体实现中,作为一种实施例,该装置1000可以包括多个处理器,例如图10中的处理器1001和处理器1007。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。
在具体实现中,作为一种实施例,该装置1000还可以包括输出设备1005和输入设备1006。输出设备1005和处理器1001通信,可以以多种方式来显示信息。例如,输出设备1005可以是液晶显示器(liquid crystal display,LCD),发光二级管(light emitting diode,LED)显示设备,阴极射线管(cathode ray tube,CRT)显示设备,或投影仪(projector)等。输入设备1006和处理器1001通信,可以以多种方式接受用户的输入。例如,输入设备1006可以是鼠标、键盘、触摸屏设备或传感设备等。
参见图11,本申请实施例提供了一种虚拟机的管理系统1100,所述系统包括如图7或图9所述的装置和如图8或图10所述的装置。其中,图7或图9所述的装置可以为云主机1101,图8或图10所述的装置可以为云平台1102。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本申请的可选实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (25)

  1. 一种虚拟机的管理方法,其特征在于,应用于云主机,云平台用于管理所述云主机,所述方法包括:
    所述云主机接收所述云平台发送的虚拟机关闭请求消息,所述虚拟机关闭请求消息包括待关闭虚拟机的标识信息;
    所述云主机根据所述待关闭虚拟机的标识信息,获取用于管理所述待关闭虚拟机占用的计算资源的资源管理策略;
    所述云主机关闭所述待关闭虚拟机,且在关闭所述待关闭虚拟机后根据所述资源管理策略管理所述待关闭虚拟机占用的计算资源。
  2. 如权利要求1所述的方法,其特征在于,所述根据所述待关闭虚拟机的标识信息,获取用于管理所述待关闭虚拟机占用的计算资源的资源管理策略,包括:
    根据所述待关闭虚拟机的标识信息,获取所述待关闭虚拟机的类型;
    根据所述待关闭虚拟机的类型,从虚拟机的类型与资源管理策略的对应关系中获取对应的资源管理策略。
  3. 如权利要求1或2所述的方法,其特征在于,在所述待关闭虚拟机为占用所述云主机的硬盘的第一类型虚拟机或者所述待关闭虚拟机为属于贵宾VIP用户的第二类型虚拟机时,所述资源管理策略用于指示所述云主机不释放所述待关闭虚拟机占用的计算资源;
    在所述待关闭虚拟机为除所述第一类型虚拟机和所述第二类型虚拟机以外的其他类型虚拟机时,所述资源管理策略用于指示所述云主机在关闭所述待关闭虚拟机后等待并在等待的时间达到预设时间阈值时释放所述待关闭虚拟机占用的计算资源。
  4. 如权利要求2所述的方法,其特征在于,所述根据所述待关闭虚拟机的类型,从虚拟机的类型与资源管理策略的对应关系中获取对应的资源管理策略之前,还包括:
    接收所述云平台发送的所述虚拟机的类型与资源管理策略的对应关系。
  5. 一种虚拟机的管理方法,其特征在于,应用于云平台,所述云平台用于管理多个云主机,所述方法包括:
    所述云平台接收客户端发送的虚拟机创建请求消息,所述虚拟机创建请求消息包括待创建虚拟机的配置信息,所述配置信息至少包括所述待创建虚拟所需要的计算资源数量;
    所述云平台根据所述配置信息在所述多个云主机中确定目标云主机,其中,所述目标云主机当前剩余的空闲资源数量减去所述计算资源数量后产生的差值大于或等于预设阈值;
    所述云平台向所述目标云主机发送所述虚拟机创建请求消息,所述虚拟机创建请求消息用于请求所述目标云主机创建所述待创建虚拟机。
  6. 如权利要求5所述的方法,其特征在于,所述根据所述配置信息在所述多个云主机中确定目标云主机,包括:
    获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括所述设备标识对应的云主机当前剩余的空闲资源数量;
    将所述各设备标识对应的空闲资源数量分别减去所述计算资源数量,得到所述各设备标识对应的差值;
    从差值大于或等于预设阈值的设备标识中选择一设备标识,将所述选择的设备标识对应的云主机确定为目标云主机。
  7. 如权利要求5所述的方法,其特征在于,所述根据所述配置信息在所述多个云主机中确定目标云主机,包括:
    获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括所述设备标识对应的云主机的资源总量和当前剩余的空闲资源数量;
    将所述各设备标识对应的空闲资源数量分别减去所述计算资源数量,得到所述各设备标识对应的差值;
    根据所述各设备标识对应的资源总量和差值,分别计算所述各设备标识对应的空闲资源比例;
    从空闲资源比例大于或等于预设比例阈值的设备标识中选择一设备标识,将所述选择的设备标识对应的云主机确定为目标云主机。
  8. 如权利要求5至7任一项所述的方法,其特征在于,所述根据所述配置信息在所述多个云主机中确定目标云主机之后,还包括:
    将所述待创建虚拟机的标识信息和所述目标云主机的设备标识对应保存在虚拟机的标识信息与设备标识的对应关系中,和/或,将设备标识与资源数量的对应关系中保存的所述目标云主机的设备标识对应的空闲资源数量更新为所述目标云主机的设备标识对应的差值。
  9. 如权利要求5至8任一项所述的方法,其特征在于,所述方法还包括:
    接收所述客户端发送的虚拟机迁移请求消息,所述虚拟机迁移请求消息包括待迁移虚拟机的标识信息;
    在虚拟机的标识信息与设备标识的对应关系中,将所述待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识,所述第一云主机是迁移前所述待迁移虚拟机所在的云主机,所述第二云主机是迁移后所述待迁移虚拟机所在的云主机。
  10. 如权利要求9所述的方法,其特征在于,所述将所述待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识之后,还包括:
    在所述第一云主机未释放所述待迁移虚拟机占用的计算资源时,向所述第二云主机发送资源申请请求消息,所述资源申请请求消息包括所述待迁移虚拟机所需要的计算资源数量,所述资源申请请求消息用于所述第二云主机根据所述待迁移虚拟机所需要的计算资源数量为所述待迁移虚拟机申请计算资源。
  11. 如权利要求5至10任一项所述的方法,其特征在于,所述方法还包括:
    接收所述客户端发送的虚拟机开启请求消息,所述虚拟机开启请求消息包括待开启虚拟机的标识信息;
    在所述待开启虚拟机所在的第一云主机未释放所述待开启虚拟机占用的计算资源,或者所述第一云主机已释放所述待开启虚拟机占用的计算资源且所述第一云主机的空闲资源数量大于或等于所述待开启虚拟机所需的计算资源数量时,在所述第一云主机上开启所述待开启虚拟机;
    在所述第一云主机已释放所述待开启虚拟机占用的计算资源且所述第一云主机的空 闲资源数量小于所述待开启虚拟机所需的计算资源数量时,在第三云主机上开启所述待开启虚拟机,所述第三云主机的空闲资源数量减去所述待开启虚拟机所需的计算资源数量后产生的差值大于或等于预设阈值,所述第一云主机和所述第三云主机为两个不同云主机。
  12. 如权利要求5至11任一项所述的方法,其特征在于,所述方法还包括:
    接收所述客户端发送的虚拟机删除请求消息,所述虚拟机删除请求消息包括待删除虚拟机的标识信息;
    在虚拟机的标识信息与设备标识的对应关系中删除包括所述待删除虚拟机的标识信息的对应关系。
  13. 一种虚拟机的管理装置,其特征在于,云平台用于管理所述装置,所述装置包括:
    接收单元,用于接收所述云平台发送的虚拟机关闭请求消息,所述虚拟机关闭请求消息包括待关闭虚拟机的标识信息;
    处理单元,用于根据所述待关闭虚拟机的标识信息,获取用于管理所述待关闭虚拟机占用的计算资源的资源管理策略;关闭所述待关闭虚拟机,且在关闭所述待关闭虚拟机后根据所述资源管理策略管理所述待关闭虚拟机占用的计算资源。
  14. 如权利要求13所述的装置,其特征在于,所述处理单元,用于:
    根据所述待关闭虚拟机的标识信息,获取所述待关闭虚拟机的类型;
    根据所述待关闭虚拟机的类型,从虚拟机的类型与资源管理策略的对应关系中获取对应的资源管理策略。
  15. 如权利要求13或14所述的装置,其特征在于,在所述待关闭虚拟机为占用所述装置的硬盘的第一类型虚拟机或者所述虚拟机为属于贵宾VIP用户的第二类型虚拟机时,所述资源管理策略用于指示所述装置不释放所述待关闭虚拟机占用的计算资源;
    在所述待关闭虚拟机为除所述第一类型虚拟机和所述第二类型虚拟机以外的其他类型虚拟机时,所述资源管理策略用于指示所述装置在关闭所述待关闭虚拟机后等待并在等待的时间达到预设时间阈值时释放所述待关闭虚拟机占用的计算资源。
  16. 如权利要求14所述的装置,其特征在于,所述接收单元,还用于:
    接收所述云平台发送的所述虚拟机的类型与资源管理策略的对应关系。
  17. 一种虚拟机的管理装置,其特征在于,所述装置用于管理多个云主机,包括:
    接收单元,用于接收客户端发送的虚拟机创建请求消息,所述虚拟机创建请求消息包括待创建虚拟机的配置信息,所述配置信息至少包括所述待创建虚拟所需要的计算资源数量;
    处理单元,用于根据所述配置信息在所述多个云主机中确定目标云主机,其中,所述目标云主机当前剩余的空闲资源数量减去所述计算资源数量后产生的差值大于或等于预设阈值;
    发送单元,用于向所述目标云主机发送所述虚拟机创建请求消息,所述虚拟机创建请求消息用于请求所述目标云主机创建所述待创建虚拟机。
  18. 如权利要求17所述的装置,其特征在于,所述处理单元,用于:
    获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括所述设备标识对应的云主机当前剩余的空闲资源数量;
    将所述各设备标识对应的空闲资源数量分别减去所述计算资源数量,得到所述各设备标识对应的差值;
    从差值大于或等于预设阈值的设备标识中选择一设备标识,将所述选择的设备标识对应的云主机确定为目标云主机。
  19. 如权利要求17所述的装置,其特征在于,所述处理单元,用于:
    获取设备标识与资源数量的对应关系中保存的各设备标识对应的资源数量,设备标识对应的资源数量包括所述设备标识对应的云主机的资源总量和当前剩余的空闲资源数量;
    将所述各设备标识对应的空闲资源数量分别减去所述计算资源数量,得到所述各设备标识对应的差值;
    根据所述各设备标识对应的资源总量和差值,分别计算所述各设备标识对应的空闲资源比例;
    从空闲资源比例大于或等于预设比例阈值的设备标识中选择一设备标识,将所述选择的设备标识对应的云主机确定为目标云主机。
  20. 如权利要求17至19任一项所述的装置,其特征在于,
    所述处理单元,还用于将所述待创建虚拟机的标识信息和所述目标云主机的设备标识对应保存在虚拟机的标识信息与设备标识的对应关系中,和/或,将设备标识与资源数量的对应关系中保存的所述目标云主机的设备标识对应的空闲资源数量更新为所述目标云主机的设备标识对应的差值。
  21. 如权利要求17至20任一项所述的装置,其特征在于,
    所述接收单元,还用于接收所述客户端发送的虚拟机迁移请求消息,所述虚拟机迁移请求消息包括待迁移虚拟机的标识信息;
    所述处理单元,还用于在虚拟机的标识信息与设备标识的对应关系中,将所述待迁移虚拟机的标识信息对应的第一云主机的设备标识更新为第二云主机的设备标识,所述第一云主机是迁移前所述待迁移虚拟机所在的云主机,所述第二云主机是迁移后所述待迁移虚拟机所在的云主机。
  22. 如权利要求21所述的装置,其特征在于,
    所述发送单元,还用于在所述第一云主机未释放所述待迁移虚拟机占用的计算资源时,向所述第二云主机发送资源申请请求消息,所述资源申请请求消息包括所述待迁移虚拟机所需要的计算资源数量,所述资源申请请求消息用于所述第二云主机根据所述待迁移虚拟机所需要的计算资源数量为所述待迁移虚拟机申请计算资源。
  23. 如权利要求17至22任一项所述的装置,其特征在于,
    所述接收单元,还用于接收所述客户端发送的虚拟机开启请求消息,所述虚拟机开启请求消息包括待开启虚拟机的标识信息;
    所述处理单元,还用于在所述待开启虚拟机所在的第一云主机未释放所述待开启虚拟机占用的计算资源,或者所述第一云主机已释放所述待开启虚拟机占用的计算资源且所述第一云主机的空闲资源数量大于或等于所述待开启虚拟机所需的计算资源数量时,在所述第一云主机上开启所述待开启虚拟机;在所述第一云主机已释放所述待开启虚拟机占用的计算资源且所述第一云主机的空闲资源数量小于所述待开启虚拟机所需的计算资源数量时,在第三云主机上开启所述待开启虚拟机,所述第三云主机的空闲资源数量 减去所述待开启虚拟机所需的计算资源数量后产生的差值大于或等于预设阈值,所述第一云主机和所述第三云主机为两个不同云主机。
  24. 如权利要求17至23任一项所述的装置,其特征在于,
    所述接收单元,还用于接收所述客户端发送的虚拟机删除请求消息,所述虚拟机删除请求消息包括待删除虚拟机的标识信息;
    所述处理单元,还用于在虚拟机的标识信息与设备标识的对应关系中删除包括所述待删除虚拟机的标识信息的对应关系。
  25. 一种虚拟机的管理系统,其特征在于,所述系统包括如权利要求13至16任一项所述的装置和如权利要求17至24任一项所述的装置。
PCT/CN2019/091085 2018-06-15 2019-06-13 一种虚拟机的管理方法、装置及系统 WO2019238092A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2020568802A JP7074302B2 (ja) 2018-06-15 2019-06-13 仮想マシン管理方法、仮想マシン管理システム、仮想マシン管理装置、不揮発性コンピュータ可読記憶媒体およびコンピュータプログラム
EP19819001.9A EP3800549A4 (en) 2018-06-15 2019-06-13 ADMINISTRATIVE PROCEDURE, DEVICE AND SYSTEM FOR VIRTUAL MACHINERY
US17/120,735 US20210096902A1 (en) 2018-06-15 2020-12-14 Virtual Machine Management Method, Apparatus, and System

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810623787.5 2018-06-15
CN201810623787.5A CN108984266B (zh) 2018-06-15 2018-06-15 一种虚拟机的管理方法、装置及系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/120,735 Continuation US20210096902A1 (en) 2018-06-15 2020-12-14 Virtual Machine Management Method, Apparatus, and System

Publications (1)

Publication Number Publication Date
WO2019238092A1 true WO2019238092A1 (zh) 2019-12-19

Family

ID=64541395

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/091085 WO2019238092A1 (zh) 2018-06-15 2019-06-13 一种虚拟机的管理方法、装置及系统

Country Status (5)

Country Link
US (1) US20210096902A1 (zh)
EP (1) EP3800549A4 (zh)
JP (1) JP7074302B2 (zh)
CN (1) CN108984266B (zh)
WO (1) WO2019238092A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108984266B (zh) * 2018-06-15 2021-09-03 华为技术有限公司 一种虚拟机的管理方法、装置及系统
CN110795182A (zh) * 2019-09-18 2020-02-14 平安科技(深圳)有限公司 云主机创建方法和系统
CN111104200A (zh) * 2019-12-11 2020-05-05 秒针信息技术有限公司 一种虚拟机管理方法、装置、存储介质及服务器
CN111083160A (zh) * 2019-12-27 2020-04-28 杭州迪普科技股份有限公司 资源信息恢复方法及装置
CN111327509B (zh) * 2020-01-21 2022-07-12 新华三信息安全技术有限公司 一种信息更新方法及装置
CN113312136A (zh) * 2020-02-27 2021-08-27 伊姆西Ip控股有限责任公司 用于控制虚拟机的方法、电子设备和计算机程序产品
CN111611075B (zh) * 2020-05-19 2024-03-05 北京达佳互联信息技术有限公司 虚拟资源请求处理方法、装置、电子设备及存储介质
NL2026462B1 (en) * 2020-09-14 2022-05-12 Microsoft Technology Licensing Llc Reducing placement conflicts between concurrent virtual machine allocations
CN112347009A (zh) * 2020-09-24 2021-02-09 天津市英贝特航天科技有限公司 多个处理器共享硬盘存储的实现装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929689A (zh) * 2012-11-01 2013-02-13 曙光云计算技术有限公司 在云计算系统中创建虚拟机的方法
CN103399781A (zh) * 2013-08-02 2013-11-20 华为技术有限公司 云服务器及其虚拟机管理方法
CN103544064A (zh) * 2013-10-28 2014-01-29 华为数字技术(苏州)有限公司 云计算方法、云管理平台和客户端
CN104410699A (zh) * 2014-12-04 2015-03-11 武汉邮电科学研究院 一种开放式云计算资源管理方法及系统
CN106844035A (zh) * 2017-02-09 2017-06-13 腾讯科技(深圳)有限公司 一种实现云服务器资源释放或恢复的方法及装置
CN108984266A (zh) * 2018-06-15 2018-12-11 华为技术有限公司 一种虚拟机的管理方法、装置及系统

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006331213A (ja) 2005-05-27 2006-12-07 Nec Electronics Corp システムリソース管理装置、システムリソース管理方法及びプログラム
JP5478107B2 (ja) 2009-04-22 2014-04-23 株式会社日立製作所 仮想ストレージ装置を管理する管理サーバ装置及び仮想ストレージ装置の管理方法
JP2014021847A (ja) 2012-07-20 2014-02-03 Mitsubishi Electric Corp リソース管理装置及びリソース管理方法及びプログラム
GB2508231A (en) * 2012-11-27 2014-05-28 Ibm Migration of virtual machines with reassignment of hardware memory segments
US20150067675A1 (en) * 2013-08-27 2015-03-05 Connectloud, Inc. Method and apparatus to remotely park a virtual machine from a software defined cloud
CN104424015B (zh) * 2013-09-11 2018-10-09 华为技术有限公司 一种虚拟机管理方法和装置
US9424065B2 (en) * 2014-06-26 2016-08-23 Vmware, Inc. Methods and apparatus to scale application deployments in cloud computing environments using virtual machine pools
JP2016024697A (ja) 2014-07-23 2016-02-08 株式会社日立製作所 リソース管理システム及びリソース管理方法
US10395219B1 (en) * 2015-12-18 2019-08-27 Amazon Technologies, Inc. Location policies for reserved virtual machine instances
US10782991B2 (en) * 2016-02-26 2020-09-22 Red Hat, Inc. Customizable virtual machine retirement in a management platform
CN106020937A (zh) * 2016-07-07 2016-10-12 腾讯科技(深圳)有限公司 一种创建虚拟机的方法、装置及系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929689A (zh) * 2012-11-01 2013-02-13 曙光云计算技术有限公司 在云计算系统中创建虚拟机的方法
CN103399781A (zh) * 2013-08-02 2013-11-20 华为技术有限公司 云服务器及其虚拟机管理方法
CN103544064A (zh) * 2013-10-28 2014-01-29 华为数字技术(苏州)有限公司 云计算方法、云管理平台和客户端
CN104410699A (zh) * 2014-12-04 2015-03-11 武汉邮电科学研究院 一种开放式云计算资源管理方法及系统
CN106844035A (zh) * 2017-02-09 2017-06-13 腾讯科技(深圳)有限公司 一种实现云服务器资源释放或恢复的方法及装置
CN108984266A (zh) * 2018-06-15 2018-12-11 华为技术有限公司 一种虚拟机的管理方法、装置及系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3800549A4 *

Also Published As

Publication number Publication date
CN108984266B (zh) 2021-09-03
US20210096902A1 (en) 2021-04-01
JP2021526274A (ja) 2021-09-30
EP3800549A4 (en) 2021-08-04
CN108984266A (zh) 2018-12-11
JP7074302B2 (ja) 2022-05-24
EP3800549A1 (en) 2021-04-07

Similar Documents

Publication Publication Date Title
WO2019238092A1 (zh) 一种虚拟机的管理方法、装置及系统
US11418512B2 (en) Method for virtual machine to access physical server in cloud computing system, apparatus, and system
US10701139B2 (en) Life cycle management method and apparatus
US9588789B2 (en) Management apparatus and workload distribution management method
CN111385114B (zh) Vnf服务实例化方法及装置
WO2018024059A1 (zh) 一种虚拟化网络中业务部署的方法和装置
EP3316532A1 (en) Computer device, system and method for implementing load balancing
US9003002B2 (en) Efficient port management for a distributed network address translation
US20110239216A1 (en) Service providing system, a virtual machine server, a service providing method, and a program thereof
WO2020135228A1 (zh) 云平台部署方法、装置、服务器及存储介质
US20180060057A1 (en) Containerized upgrade in operating system level virtualization
US20210326161A1 (en) Apparatus and method for multi-cloud service platform
US20150372935A1 (en) System and method for migration of active resources
US11822970B2 (en) Identifier (ID) allocation in a virtualized computing environment
WO2017144011A1 (zh) 资源分配方法及装置
WO2018107945A1 (zh) 一种实现硬件资源分配的方法、装置及存储介质
JP2016004432A (ja) 仮想マシンマイグレーションプログラム、仮想マシンマイグレーションシステムおよび仮想マシンマイグレーション方法
JP6653710B2 (ja) 計算機および計算機の制御方法
WO2017041650A1 (zh) 用于扩展分布式一致性服务的方法和设备
WO2019109948A1 (zh) PaaS的管理方法、装置及存储介质
WO2017011938A1 (zh) 虚拟网络功能扩容的方法和装置
CN108833169A (zh) 一种节点上线管理方法和节点
WO2020181734A1 (zh) 一种管理网络地址转换nat网关的方法及服务器
CN116510312A (zh) 一种云游戏多开实现方法、装置、设备及存储介质
WO2016179803A1 (zh) 建立vnfm与vim之间的连接的方法、装置及系统

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: 19819001

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020568802

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2019819001

Country of ref document: EP

Effective date: 20201228