CN114237831A - Hot plug method for virtual central processing unit, physical host and storage medium - Google Patents

Hot plug method for virtual central processing unit, physical host and storage medium Download PDF

Info

Publication number
CN114237831A
CN114237831A CN202210179047.3A CN202210179047A CN114237831A CN 114237831 A CN114237831 A CN 114237831A CN 202210179047 A CN202210179047 A CN 202210179047A CN 114237831 A CN114237831 A CN 114237831A
Authority
CN
China
Prior art keywords
virtual machine
hot
vcpu
vcpus
hot plug
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210179047.3A
Other languages
Chinese (zh)
Inventor
吴超
边子政
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Alibaba China Co Ltd
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 Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202210179047.3A priority Critical patent/CN114237831A/en
Publication of CN114237831A publication Critical patent/CN114237831A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a hot plug method for a virtual central processing unit, a physical host and a storage medium, wherein the method comprises the following steps: the virtual machine manager in the physical host can generate a hot plug request and determine the target number of the VCPUs to be processed corresponding to the hot plug request. This target number indicates the number of VCPUs to be plugged in and out in the virtual machine. The virtual machine may obtain the target number through a communication connection between the virtual machine and the virtual machine manager. And then, performing hot plug on the VCPU to be processed according to the target quantity to obtain a hot plug result reflecting whether the hot plug is successful. Finally, the virtual machine feeds back the hot plug result of the VCPU to be processed to the virtual machine manager by means of communication connection between the virtual machine manager and the virtual machine manager, so that the virtual machine manager obtains the hot plug condition of the VCPU. Therefore, the method realizes the hot plug of the VCPU through the direct communication between the virtual machine and the virtual machine manager, and the hot plug process is simple.

Description

Hot plug method for virtual central processing unit, physical host and storage medium
Technical Field
The invention relates to the technical field of virtualization, in particular to a hot plug method of a virtual central processing unit, a physical host and a storage medium.
Background
Virtualization technology is a logical representation of physical resources on a physical host. With the development of virtualization technology, the cost of physical hardware equipment can be greatly reduced, and the waste of physical resources is reduced.
In a virtualized scenario, the number of Virtual Central Processing Units (VCPUs) in a Virtual Machine (VM) needs to be dynamically adjusted to better adapt to sudden increase or decrease of data traffic, that is, the number of VCPUs needs to be scaled. In order to reduce the influence of the expansion and contraction of the number of VCPUs on the normal operation of the virtual machine as much as possible, the dynamic expansion and contraction of the number of VCPUs can be realized by adopting a hot-plug mode.
Therefore, how to implement the hot plug of VCPU becomes an urgent problem to be solved.
Disclosure of Invention
In view of this, embodiments of the present invention provide a hot plug method for a virtual central processing unit, a physical host, and a storage medium, so as to implement hot plug of a VCPU.
In a first aspect, an embodiment of the present invention provides a method for hot-plugging a virtual central processing unit, which is applied to a virtual machine, and includes:
acquiring the target number of Virtual Central Processing Units (VCPUs) to be processed corresponding to the hot plug request according to the communication connection between the virtual machines and a virtual machine manager in the physical host;
hot-plugging the VCPUs to be processed in the virtual machine according to the target quantity;
and sending the hot plug result of the VCPU to be processed to the virtual machine manager according to the communication connection.
In a second aspect, an embodiment of the present invention provides another virtual central processing unit hot plug method, applied to a virtual machine manager in a physical host, including:
determining the target number of to-be-plugged Virtual Central Processing Units (VCPUs) corresponding to hot plugging requests according to the hot plugging requests generated by the virtual machine manager, so that the virtual machines hot plug the to-be-plugged VCPUs in the virtual machines according to the target number;
allocating physical resources in the physical host to the VCPU to be plugged;
and receiving a hot plug result of the VCPU to be plugged, which is sent by the virtual machine, according to the communication connection between the virtual machine and the virtual machine manager.
In a third aspect, an embodiment of the present invention provides another virtual central processing unit hot plug method, applied to a virtual machine manager in a physical host, including:
determining the target number of VCPUs (virtual central processing units) to be unplugged corresponding to the hot-unplugging request according to the hot-unplugging request generated by the virtual machine manager, so that the VCPUs to be unplugged are hot-unplugged in the virtual machine by the virtual machine according to the target number;
receiving a hot plug result of the VCPU to be plugged, which is sent by the virtual machine, according to the communication connection between the virtual machine and the virtual machine manager;
and recovering the physical resources corresponding to the VCPU to be unplugged according to the hot-unplugging result.
In a fourth aspect, an embodiment of the present invention provides a physical host, including: a memory and a processor, and a virtual machine running in an isolated environment constructed by the memory and the processor;
the memory for storing a computer program;
the processor is configured to execute the computer program to implement the method for hot plug of a virtual central processing unit according to the first aspect to the third aspect.
In a fifth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which an executable code is stored, and when the executable code is executed by a processor of an electronic device, the processor is enabled to implement at least the virtual central processing unit hot plug method according to the first to third aspects.
According to the hot plug method for the virtual machine central processing unit provided by the embodiment of the invention, the virtual machine manager in the physical host can generate the hot plug request and determine the target number of the VCPUs to be processed corresponding to the hot plug request. This target number indicates the number of VCPUs to be plugged in and out in the virtual machine. The virtual machine can acquire the target number through communication connection pre-established between the virtual machine and the virtual machine manager. And then, performing hot plug on the VCPU to be processed according to the target quantity to obtain a hot plug result reflecting whether the hot plug is successful. Finally, the virtual machine can feed back the hot plug result of the VCPU to be processed to the virtual machine manager by means of communication connection between the virtual machine manager and the virtual machine manager, so that the virtual machine manager obtains the hot plug condition of the VCPU. Therefore, the method realizes the hot plug of the VCPU through the direct communication between the virtual machine and the virtual machine manager, and the hot plug process is very simple.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a method for hot-plugging a central processing unit of a virtual machine according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of another method for hot-plugging a central processing unit of a virtual machine according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of another method for hot plugging a virtual machine central processing unit according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of another method for hot plugging a virtual machine central processing unit according to an embodiment of the present invention;
fig. 5 is a schematic flowchart of another method for hot plugging a virtual machine central processing unit according to an embodiment of the present invention;
FIG. 6 shows the correspondence between the functions and the VCPU states provided by the embodiment of the present invention;
fig. 7 is a schematic flowchart of another method for hot plugging a virtual machine central processing unit according to an embodiment of the present invention;
fig. 8 is a schematic flowchart of another method for hot plugging a virtual machine central processing unit according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of a physical host according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, and "a" and "an" generally include at least two, but do not exclude at least one, unless the context clearly dictates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
The words "if," "if," as used herein may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a recognition," depending on the context. Similarly, the phrases "if determined" or "if identified (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when identified (a stated condition or event)" or "in response to an identification (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a good or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such good or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a commodity or system that includes the element.
Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The features of the embodiments and examples described below may be combined with each other without conflict between the embodiments. In addition, the sequence of steps in each method embodiment described below is only an example and is not strictly limited.
Fig. 1 is a schematic flowchart of a hot plug method for a virtual central processing unit according to an embodiment of the present invention, where the hot plug method for a virtual central processing unit according to the embodiment of the present invention may be executed by a virtual machine running in an isolation environment constructed by a physical host. As shown in fig. 1, the method comprises the steps of:
s101, according to communication connection between a virtual machine and a virtual machine manager in a physical host, acquiring the target number of the Virtual Central Processing Units (VCPUs) to be processed corresponding to the hot plug request.
A Virtual Machine Manager (VMM) is deployed in the physical host, and the VMM may generate a hot-plug request.
According to an optional generation mode, a user can trigger operation on an operation interface provided by a physical host according to actual requirements, so that the virtual machine manager generates a hot plug request. The user mentioned in the embodiments of the present invention may be a maintenance person of the physical host. In another optional generation mode, the virtual machine manager may further obtain the usage rate of the VCPU currently in the running state in the virtual machine in real time, and automatically generate the hot plug request according to the usage rate. Specifically, the level of the usage can reflect whether the number of VCPUs set in the current virtual machine is appropriate. If the usage rate exceeds the preset value interval, which indicates that the VCPU is set too much or too little, the virtual machine manager may generate a hot-plug request.
For the acquisition of the target number, in an optional manner, the hot plug request may directly include the target number of the VCPUs to be processed, that is, the number of VCPUs that need to be hot plugged or hot unplugged. The virtual machine can acquire the target number of the VCPUs to be processed through communication connection between the virtual machine and the virtual machine manager. This target number may be set by the user at his or her discretion.
Alternatively, the hot plug request may include a total amount of VCPUs to be set in the virtual machine, where the total amount of VCPUs is a number of VCPUs that can guarantee a data processing speed of the virtual machine based on the current data traffic. This amount may be entered by the user on his own at the interface provided by the physical body when the operation is triggered. The difference between the total number of VCPUs and the number of VCPUs in the current virtual machine that are in the operable state is the target number. Wherein the calculation of the target number can be performed by the virtual machine manager. The virtual machine manager may then send the calculated target number to the virtual machine via a communication connection between itself and the virtual machine. Wherein the target number may also be sent to the virtual machine in the form of a request.
Optionally, direct communication between the Virtual Machine and the Virtual Machine manager may be implemented by any one of vsock (Virtual Machine socket), Virtual Input/Output (Virtual Input/Output), mmo (Memory-mapped Input/Output), and pio (Programming Input/Output).
And S102, hot-plugging the VCPUs to be processed in the virtual machine according to the target number.
After the target number is obtained, the virtual machine can perform hot plug of the VCPUs to be processed in the virtual machine according to the target number, so that a hot plug result is obtained. That is, the VCPU is activated or deleted in the virtual machine according to the target number, so as to obtain a hot plug result indicating whether the VCPU is hot plugged successfully.
S103, according to the communication connection, the hot plug result of the VCPU to be processed is sent to the virtual machine manager.
Finally, the virtual machine can feed back the hot plug result to the virtual machine manager by means of the communication connection between the virtual machine manager and the virtual machine manager, so as to complete the hot plug of the VCPU.
In this embodiment, the virtual machine manager in the physical host generates a hot plug request, and obtains a target number of VCPUs to be processed corresponding to the hot plug request. The virtual machine can acquire the target number through communication connection between the virtual machine and the virtual machine manager. And then, performing hot plug on the VCPU to be processed according to the target quantity to obtain a hot plug result reflecting whether the VCPU to be processed is successfully hot plugged. Finally, the virtual machine feeds back the hot plug result to the virtual machine manager by means of communication connection between the virtual machine manager and the virtual machine manager, so that the virtual machine manager obtains the hot plug condition of the VCPU. Therefore, the method realizes the hot plug of the VCPU through the direct communication between the virtual machine and the virtual machine manager, and the hot plug process is simple.
Besides the method in the embodiment shown in fig. 1, another method for implementing VCPU hot plug is as follows: in the process of creating a virtual machine, in addition to conventional memory virtualization and CPU virtualization, an Advanced Configuration and Power Management Interface (ACPI for short) needs to be virtualized. And then, the virtual machine manager informs the virtual machine of the target number of the VCPUs to be processed corresponding to the hot plug request by using the virtualized ACPI interface, so that the virtual machine carries out the hot plug of the VCPUs according to the target number. That is, the ACPI interface is used as a relay to implement communication between the virtual machine and the virtual machine manager, thereby implementing hot plug of the VCPU.
However, virtualization of the ACPI interface not only reduces the weight reduction of the virtual machine, but also extends the startup time of the virtual machine. Therefore, compared with the mode, the embodiment shown in fig. 1 and the following embodiments provided by the present invention do not have a virtualization process for the ACPI interface, but implement hot plug of the VCPU through direct communication between the virtual machine and the virtual machine manager, which not only can ensure light weight of the virtual machine, but also can not prolong the start time of the virtual machine.
The embodiment illustrated in fig. 1 describes the overall process of VCPU hot plug, and the following embodiments may describe the hot plug and hot plug processes of VCPU in detail.
For hot-plug of a VCPU, the process can be described roughly as: and the virtual machine manager generates a hot plug request and obtains the target number of VCPUs to be plugged corresponding to the hot plug request. Then, a target number of VCPU threads are created in the physical host by using a Kernel-Based Virtual Machine (KVM) that is also deployed in the physical host, that is, physical resources in the physical host are allocated to a target number of VCPUs to be inserted. After the thread is established, the virtual machine manager informs the virtual machine of the target number of the VCPUs to be plugged through communication connection between the virtual machine manager and the virtual machine, so that the virtual machine carries out hot plugging on the VCPUs according to the target number, and a hot plugging result indicating that the hot plugging is successful is sent to the virtual machine manager, thereby realizing the hot plugging on the VCPUs. It can be seen that hot-plugging is a process of allocating physical resources first and then activating.
Based on the above description, fig. 2 is a flowchart illustrating another virtual central processing unit hot plug method according to an embodiment of the present invention. This method is effectively a hot-plug method for VCPUs, which can also be performed by a virtual machine running in an isolated environment built by the physical host. As shown in fig. 2, the method may include the steps of:
s201, according to the communication connection between the virtual machine and the virtual machine manager in the physical host, obtaining the target number of VCPUs to be plugged corresponding to the hot plugging request.
The virtual machine manager can generate a hot plug request and obtain the target number of the VCPUs to be plugged corresponding to the hot plug request. Then, the virtual machine may obtain the target number by using a communication connection between the virtual machine manager and the virtual machine itself. Both the generation manner of the hot plug request and the acquisition manner of the target number may refer to the related description in step S101, which is not described herein again.
S202, registering VCPUs to be inserted in the virtual machine according to the target quantity.
S203, activating the VCPU to be inserted after the registration is finished.
The virtual machine may then register and activate a target number of VCPUs to be plugged in the virtual machine to obtain a hot-plug result. The hot plug result may specifically include an acquisition result, a registration result, and an activation result that are respectively obtained by the virtual machine in the processes of acquiring the target number, registering, and activating the VCPU to be plugged. The activation result can directly reflect whether the VCPU to be plugged is successfully hot-plugged. Because the VCPU cannot be further registered and activated when the target number is failed to be obtained, the target number obtaining result can indirectly reflect whether the VCPU to be inserted is successfully hot-plugged. Similarly, the registration result can indirectly reflect whether the VCPU to be inserted is successfully hot-plugged.
And S204, according to the communication connection, sending the hot plug result of the VCPU to be plugged obtained after activation to the virtual machine manager.
Finally, the virtual machine can send the hot plug result to the virtual machine manager according to the communication connection between the virtual machine manager and the virtual machine manager. And the interface provided by the physical host can also display prompt information indicating whether the hot plug is successful or not so as to inform the user whether the hot plug of the VCPU to be plugged is successful or not.
When the VCPU to be plugged in is successfully hot-plugged, the hot-plugging result may include an acquisition result indicating that the target number is successfully acquired, a registration result indicating that the VCPU to be plugged in is successfully registered, and an activation result indicating that the VCPU to be plugged in is successfully activated. Optionally, the virtual machine may also send only the activation result in the hot-plug result to the virtual machine manager by means of the communication connection, so as to reduce unnecessary data transmission and relieve communication pressure between the virtual machine and the virtual machine manager.
And when the VCPU to be inserted fails to be hot-plugged, the failure reason may be any one of the target number acquisition failure, the registration failure, and the activation failure, and optionally, the virtual machine may send an acquisition result indicating the target number acquisition failure, or a registration result indicating the VCPU to be inserted fails to be registered, or an activation result indicating the VCPU to be inserted fails to be activated to the virtual machine manager. Based on the received hot-plug result, the virtual machine manager may generate a hot-plug request corresponding to the hot-plug request in step S201, and log out the VCPU to be plugged in which the hot-plug fails. Then, a hot plug request is generated again, and the VCPU to be plugged is hot plugged again according to the process.
That is, in the hot-plug process of the VCPU, when the VCPU to be plugged fails in any stage of the target quantity acquisition, registration or activation, the VCPU to be plugged may be rolled back to the initial target quantity acquisition stage by using the hot-plug request generated by the virtual machine manager, so as to perform the hot-plug of the VCPU again. Optionally, the hot plug request used in the rollback process may be automatically generated by the virtual machine manager, or may be artificially generated by the user according to a prompt message indicating that the target number acquisition fails, the registration fails, or the activation fails, which is displayed on the virtual machine manager. Similarly, the regenerated hot-plug request may alternatively be generated manually or automatically by the virtual machine manager.
In this embodiment, the target number of the VCPUs to be plugged, and the registration and activation of the VCPUs to be plugged are sequentially completed through direct communication between the virtual machine and the virtual machine manager, so that hot plugging of the VCPUs to be plugged is realized. And when a certain stage in the hot plug process fails, the hot plug process can be rolled back, so that the hot plug of the VCPU is carried out again.
In addition, for the parts of the embodiment not described in detail, reference may be made to the related description of the embodiment shown in fig. 1. The implementation process and technical effect of the technical solution refer to the description in the embodiment shown in fig. 1, and are not described herein again.
In the embodiment shown in fig. 2, the hot plug of the VCPU may include a target number obtaining stage, a registration stage, and an activation stage, and optionally, the execution of each stage may also be implemented by using a function registered in advance in the virtual machine, and then the obtaining result, the registration result, and the activation result in the embodiment shown in fig. 2 may be embodied as a function execution result. And also accompany VCPU state changes during different phases of hot-plug.
Based on this, fig. 3 is a schematic flowchart of another virtual central processing unit hot plug method according to an embodiment of the present invention. The method may comprise the steps of:
s301, according to the communication connection between the virtual machine and the virtual machine manager in the physical host, the target number of the VCPUs to be plugged corresponding to the hot plug request is obtained by calling the hot plug function in the virtual machine.
As can be seen from the description related to the embodiment shown in fig. 1, the target number of VCPUs to be plugged in may be sent to the virtual machine in the form of a request by using a communication connection between the virtual machine and the virtual machine manager, and then the virtual machine may read the target number from the request by executing a hot plug function deployed by the virtual machine. Alternatively, the hot-plug function may be add _ vcpu (). And the VCPU to be inserted is now in an unregistered state.
S302, registering the VCPUs to be plugged in according to the target quantity by calling a registration function in the virtual machine.
And S303, switching the state of the VCPU to be inserted after the registration from the unregistered state to the registered state.
Then, the virtual machine can register the VCPUs to be plugged in according to the target number by calling the registration function deployed by the virtual machine. Alternatively, the registration function may include generic _ processor _ info () and arch _ register _ cpu (). And after executing the registration function, determining whether to switch the state of the VCPU to be inserted according to the function execution result of the registration function, that is, the registration result. Specifically, if the execution result of the function of the registration function is a normal value, which indicates that the VCPU to be inserted is successfully registered, the state of the VCPU to be inserted may be switched from the unregistered state to the registered state.
S304, activating the registered VCPU to be plugged in by calling an activation function in the virtual machine.
S305, the state of the activated VCPU to be inserted is switched to a runnable state from a registered state.
And then, calling an activation function deployed by the virtual machine, and activating the VCPU to be inserted after the registration is finished. Alternatively, the activation function may include cpu _ up (). And determining whether to switch the state of the VCPU to be plugged according to a function execution result of the activation function, namely the activation result. Similarly, if the execution result of the function of the activation function is a normal value, which indicates that the VCPU to be plugged is successfully activated, the state of the VCPU to be plugged may be switched from the registered state to the operable state, which indicates that the VCPU to be plugged is successfully hot-plugged.
The VCPU states mentioned in steps S301 to S305 can be understood as follows: the unregistered state may also be referred to as a poisable state, which indicates that the physical host has allocated resources for the VCPU, but since the VCPU is not registered yet, the virtual machine does not know the existence of the VCPU, and cannot schedule the VCPU. The registered state, which may also be referred to as the Present state, indicates that the VCPU is in a kernel state and the virtual machine is aware of the presence of the VCPU. The runnable state, which may also be referred to as an Online state, indicates that the virtual machine is capable of scheduling this VCPU.
S306, according to the communication connection, the hot plug result of the VCPU to be plugged is sent to the virtual machine manager.
The virtual machine can send function execution results respectively generated by the hot plug function, the register function and the activation function, namely the hot plug results to the virtual machine manager through communication connection, so that the virtual machine manager knows whether the hot plug of the VCPU to be plugged is successful.
Similar to the embodiment shown in fig. 2, when the VCPU to be inserted is successfully hot-plugged, the hot-plugged result may include the function execution result of each function, which is expressed as a normal value.
Optionally, the virtual machine may send the function execution result of each function to the virtual machine manager, so that the virtual machine manager can know the registration condition and the activation condition of the VCPU to be plugged in detail while hot plugging of the VCPU to be plugged in is realized. Alternatively, the virtual machine may send only the function execution result of the activated function indicating successful activation of the VCPU to be plugged to the virtual machine manager via the communication connection, so as to reduce unnecessary data transmission.
When the hot plug of the VCPU to be plugged fails, if one of the function execution results of the hot plug function, the registration function, and the activation function is an abnormal value, the virtual machine may send the abnormal value indicating that the hot plug of the VCPU to be plugged is not successful to the virtual machine manager. Then, the virtual machine may roll back the VCPU to be plugged to the target number obtaining stage by using the hot plug request generated by the virtual machine manager and corresponding to the hot plug request in step S301. And hot plugging the VCPU to be plugged again by means of the regenerated hot plugging request. The specific rollback procedure may also be referred to in connection with the description of the embodiment shown in fig. 2.
Alternatively, the communication connection between the virtual machine and the virtual machine manager may be established in advance, and based on the established communication connection, the hot-plug function, the registration function, and the activation function used in the hot-plug process may be registered in the virtual machine in advance.
In this embodiment, the hot plug is realized by automatically switching the state of the VCPU to be plugged. Compared with a mode that after the VCPU to be plugged completes registration or activation, the corresponding prompt information that registration is successful or activation is successful can be displayed on the interface of the physical host, and the user manually switches the state of the VCPU to be plugged, the state automatic switching in the embodiment can reduce participation of the user in the hot-plug process, enable the hot-plug process to be more intelligent, and meanwhile can shorten the time required by the hot-plug process.
For hot-drawing of VCPU, the process is roughly: and the virtual machine manager generates a hot plug request and obtains the target number of VCPUs to be plugged corresponding to the hot plug request. And then, the virtual machine management informs the target number of the VCPUs to be unplugged corresponding to the hot-unplugging request to the virtual machine through the communication connection between the virtual machine management and the virtual machine, so that the virtual machine logs out and deletes the VCPUs to be unplugged according to the target number, and sends a hot-unplugging result indicating that the hot-unplugging is successful to the virtual machine manager. Then, with the KVM also deployed in the physical host, the physical resource previously allocated to the VCPU to be unplugged is recovered, thereby implementing the hot-unplugging of the VCPU. Therefore, hot-plug is a process of deleting VCPU and then recycling physical resources.
Based on the above description, fig. 4 is a flowchart illustrating another virtual central processing unit hot plug method according to an embodiment of the present invention. This method is effectively a hot-plug method for VCPUs, which can also be performed by a virtual machine running in an isolated environment built by a physical host. As shown in fig. 4, the method may include the steps of:
s401, according to the communication connection between the virtual machine and the virtual machine manager in the physical host, obtaining the target number of VCPUs to be unplugged corresponding to the hot-unplugging request.
The virtual machine manager can generate a hot-plug request and obtain the target number of the VCPUs to be plugged corresponding to the hot-plug request. The virtual machine may then obtain this target number using the communication connection. The specific generation manner of the hot plug request and the obtaining manner of the target number may refer to the related description in step S101, which is not described herein again. The to-be-unplugged request may further include identification information of the to-be-unplugged VCPU, and the identification information may also be sent to the virtual machine. The virtual machine manager may determine, according to the registration time of the VCPU, a target number of newly registered VCPUs as VCPUs to be unplugged, and obtain identification information of the VCPUs.
S402, logging off the VCPUs to be unplugged in the virtual machine according to the target number.
S403, deleting the logged VCPU to be unplugged.
Then, the virtual machine can perform logout and deletion of the VCPU to be unplugged in the virtual machine according to the target number and the identification information, that is, all information related to the VCPU to be unplugged in the virtual machine is deleted, so as to obtain a hot-unplugging result.
The hot-plug result may specifically include an obtaining result, a logout result, and a deletion result that are obtained by the virtual machine in the processes of obtaining the target number, logout, and deleting the VCPU to be unplugged. The deletion result can directly reflect whether the VCPU to be inserted is successfully hot-plugged. Because the target number acquisition fails, the VCPU cannot be further logged out and deleted, and therefore, the target number acquisition result can indirectly reflect whether the VCPU to be plugged is successfully hot-plugged. Similarly, the logout result can indirectly reflect whether the VCPU to be plugged is successfully hot-plugged.
And S404, according to the communication connection, sending the hot-plug result of the VCPU to be plugged obtained after deletion to the virtual machine manager.
And finally, the virtual machine can send the hot plug result to the virtual machine manager according to the communication connection between the virtual machine manager and the virtual machine manager. The user can know whether the VCPU to be unplugged is successfully unplugged according to the prompt message displayed on the physical host computer.
When the VCPU to be unplugged is successfully hot-unplugged, optionally, the obtaining result, the logout result, and the deletion result in the hot-unplugging result may all be sent to the virtual machine manager, so that the virtual machine manager may know the registration condition and the activation condition of the VCPU to be plugged in detail. Optionally, the virtual machine may also send only a deletion result indicating that the deletion of the VCPU to be unplugged is successful to the virtual machine manager, so as to reduce unnecessary data transmission and reduce communication pressure between the virtual machine and the virtual machine manager.
When the VCPU to be unplugged fails in hot-unplugging, the failure reason may be any one of target number acquisition failure, logout failure, and deletion failure, and an acquisition result indicating that the target number acquisition failure, or a logout result indicating that the VCPU to be unplugged fails in logout, or a deletion result indicating that the VCPU to be unplugged fails in deletion may be sent to the virtual machine manager. Further, the virtual machine manager may generate a hot plug request corresponding to the hot plug request in step S401, and roll back the VCPU to be unplugged to the initial target quantity obtaining stage according to the hot plug request, so as to re-perform the hot plug of the VCPU. The specific rollback procedure may refer to the related description in the embodiment shown in fig. 2.
Optionally, the hot-swap request for implementing rollback may be automatically generated by the virtual machine manager, or may be artificially generated by the user according to the prompt information indicating the target number acquisition failure, the logout failure, and the deletion failure displayed on the virtual machine manager. Similarly, the regenerated hot-plug request may also be produced manually or generated automatically by the virtual machine manager.
In this embodiment, the target number of the VCPUs to be unplugged, and the logout and deletion of the VCPUs to be unplugged are sequentially completed through the communication connection between the virtual machine and the virtual machine manager, so that the hot-unplugging of the VCPUs to be unplugged is finally realized. And when a certain stage in the hot drawing process fails, the hot drawing can be realized by performing rollback operation on the hot drawing.
In addition, for the parts of the present embodiment that are not described in detail, reference may be made to the related description of the embodiment shown in fig. 1 or fig. 2. The implementation process and technical effect of the technical solution refer to the description in the embodiment shown in fig. 1 or fig. 2, and are not described herein again.
In the above embodiment shown in fig. 4, the VCPU hot-dialing includes the target number obtaining, logout, and deletion stages, and optionally, the execution of each stage may be implemented by using a function pre-registered in the virtual machine, and the obtaining result, the logout result, and the deletion result included in the hot-dialing result in the embodiment shown in fig. 4 may be embodied as the function execution result. And also accompanied by a change in VCPU state during different stages of hot-drawing.
Based on this, fig. 5 is a schematic flowchart of another virtual central processing unit hot plug method according to an embodiment of the present invention. The method may comprise the steps of:
s501, according to communication connection between the virtual machine and a virtual machine manager in the physical host, the target number of VCPUs to be unplugged corresponding to the request to be unplugged is obtained by calling a hot-plugging function in the virtual machine.
The virtual machine can read the target quantity from the request containing the target quantity by executing the hot-plug function deployed by the virtual machine. Alternatively, the hot-plug function may be del _ vcpu (). At this time, the VCPU to be unplugged is in a runnable state.
S502, the VCPUs to be unplugged are logged out according to the target number by calling a logging-out function in the virtual machine.
S503, switching the state of the VCPU to be unplugged from the operable state to the registered state.
Then, the virtual machine can log out the VCPUs to be unplugged according to the target number by calling a logging-out function deployed by the virtual machine. Alternatively, the logout function may include an arch _ unregister _ cpu (). If the function execution result of the registration function, i.e. the cancellation result, is a normal value, indicating that the VCPU to be plugged is successfully cancelled, the state of the VCPU to be unplugged may be switched from the operable state to the registered state, otherwise, the state switching is not performed.
S504, the state of the VCPU to be unplugged is switched from the registered state to the unregistered state by calling a deleting function in the virtual machine.
And then, calling a deletion function deployed in the virtual machine, and deleting the configuration file and the historical data related to the VCPU to be unplugged in the virtual machine. Alternatively, the delete function may include cpu _ down (). If the function execution result of the activation function, that is, the deletion result, is a normal value, which indicates that the deletion of the VCPU to be unplugged is successful, the state of the VCPU to be unplugged may be switched from the registered state to the unregistered state, which indicates that the VCPU to be plugged is successfully hot-unplugged. Otherwise, no state switching is performed.
And S505, according to the communication connection, sending the hot-unplugging result of the VCPU to be unplugged to the virtual machine manager.
The virtual machine can send the function execution results generated by the hot-plug function, the logout function and the deletion function respectively, namely the hot-plug results to the virtual machine manager through communication connection, so that the virtual machine manager can know whether the VCPU to be unplugged is successfully hot-plugged.
Similar to the embodiment shown in fig. 4, when the VCPU to be unplugged is successfully hot-unplugged, optionally, the virtual machine may send the function execution results of each function to the virtual machine manager, so that the virtual machine manager can know the logout condition and the deletion condition of the VCPU to be plugged in detail while the VCPU to be unplugged is hot-unplugged. Optionally, the virtual machine may send only the function execution result of the deletion function to the virtual machine manager, so as to reduce unnecessary data transmission.
When the VCPU to be unplugged fails in hot-unplugging, any one of function execution results corresponding to the hot-unplugging function, the logout function and the deletion function is an abnormal value, and the virtual machine can send the abnormal value to the virtual machine manager. Then, the virtual machine may switch the state of the VCPU to be unplugged to an operable state by using the hot-plug request generated by the virtual machine manager and corresponding to the hot-unplugging request in step S501, that is, perform state rollback on the VCPU to be unplugged, and a specific rollback process may also refer to relevant descriptions in the foregoing embodiments. When the hot-plug request is regenerated, the hot-plug of the VCPU to be unplugged may be performed again according to the above steps in this embodiment.
Optionally, the hot-plug function, the logout function, and the delete function used in the hot-plug process may also be registered in the virtual machine in advance.
In this embodiment, the VCPU hot-unplugging process is accompanied by automatic switching of the state of the VCPU to be unplugged. Compared with the manual switching state, the automatic switching in the embodiment can reduce the participation of users in the hot plug process, so that the hot plug process is more intelligent, and meanwhile, the time required by the hot plug process can be shortened.
In summary, the hot-plug and hot-plug processes of the VCPU are respectively described in detail in the embodiments shown in fig. 2 to fig. 5, wherein the correspondence between the function call and the state switch can be understood by combining (a) and (b) in fig. 6.
On the basis of the above embodiments, the hot plug process of the VCPU can also be explained from the perspective of the virtual machine manager. Fig. 7 is a flowchart illustrating another virtual central processing unit hot plug method according to an embodiment of the present invention. The hot plug method for the virtual central processing unit provided by the embodiment of the invention can be executed by a physical host with a virtual machine. The method is actually a hot-plug method, and as shown in fig. 7, the method may include the steps of:
s601, according to the hot plug request generated by the virtual machine manager, determining the target number of the VCPUs to be plugged corresponding to the hot plug request, so that the VCPUs to be plugged are hot-plugged in the virtual machine by the virtual machine according to the target number.
S602, physical resources in the physical host are allocated to the VCPU to be plugged.
S603, receiving a hot plug result of the VCPU to be plugged, which is sent by the virtual machine, according to the communication connection between the virtual machine and the virtual machine manager.
The virtual machine manager generates hot plug requests and determines the target number of VCPUs to be plugged corresponding to the requests. The specific request generation manner and the number determination manner may refer to the related description in the embodiment shown in fig. 1, and are not described herein again.
The virtual machine manager may then allocate physical resources to each VCPU to be plugged in via the KVM deployed in the physical host. After the resources are allocated, the virtual machine manager sends the target number of the VCPUs to be plugged to the virtual machine, so that the virtual machine registers and activates the VCPUs to be plugged.
In the hot-plug process of the VCPU, the virtual machine manager may obtain a hot-plug result including an acquisition target number result, a registration result, and an activation result. Optionally, the virtual machine may send the hot plug result to the virtual machine manager, so that the virtual machine manager knows whether the hot plug of the VCPU to be plugged is successful. Optionally, the virtual machine may also send only the activation result in the hot-plug result to the virtual machine manager, so that the virtual machine manager knows whether the hot-plug of the VCPU to be plugged is successful, and meanwhile, unnecessary data transmission is also reduced.
As can be seen from the description of the embodiment shown in fig. 1, the total amount of VCPUs may be included in the hot-plug request, and the total amount may be set by the user according to the current data traffic. At this time, optionally, it may be further determined whether the total amount of VCPUs set by the user exceeds a preset maximum amount corresponding to the virtual machine, so as to determine whether the hot-plug request is valid. If the total number of VCPUs in the hot-plug request does not exceed the preset maximum number, the hot-plug request is valid. At this time, the virtual machine manager may further determine the target number of VCPUs to be plugged according to the valid hot-plug request. Wherein the preset maximum number is related to performance indexes of the virtual machines.
In this embodiment, the hot-plug of the VCPU may be implemented through direct communication between the virtual machine and the virtual machine manager, so that the hot-plug process is very simple. In addition, for parts of the present embodiment that are not described in detail, reference may be made to the related descriptions of the above exemplary embodiments. The implementation process and technical effect of the technical solution refer to the description in the above embodiments, and are not described herein again.
Fig. 8 is a flowchart illustrating another virtual central processing unit hot plug method according to an embodiment of the present invention. The method is actually a hot-plug method, and as shown in fig. 8, the method may include the steps of:
s701, according to the hot plug request generated by the virtual machine manager, determining the target number of VCPUs to be plugged corresponding to the hot plug request, so that the virtual machine can hot plug the VCPUs to be plugged in the virtual machine according to the target number.
S702, according to the communication connection between the virtual machine and the virtual machine manager, receiving a hot plug result of the VCPU to be plugged, which is sent by the virtual machine.
And S703, recovering the physical resources corresponding to the VCPU to be unplugged according to the hot-unplugging result.
The virtual machine manager generates a hot plug request and determines the target number of VCPUs to be plugged corresponding to the request. The specific request generation manner and the number determination manner may refer to the related description in the embodiment shown in fig. 1, and are not described herein again. The virtual machine can perform hot-plug of the VCPUs in the virtual machine according to the target number of the VCPUs to be unplugged. And then, the virtual machine can receive the hot plug result sent by the virtual machine according to the communication connection between the virtual machine and the virtual machine manager. The hot-pull result may include a target number acquisition result, a logout result, and a hot-pull result of a deletion result. If the hot-plug result indicates that the hot-plug is successful, the virtual machine manager may recycle the physical resource corresponding to the VCPU to be plugged with the KVM.
Optionally, the virtual machine manager may also determine validity of the hot-plug request and only respond to the valid hot-plug request.
In this embodiment, the VCPU hot-plug may be implemented through direct communication between the virtual machine and the virtual machine manager, so that the hot-plug process is very simple. In addition, for parts of the present embodiment that are not described in detail, reference may be made to the related descriptions of the above exemplary embodiments. The implementation process and technical effect of the technical solution refer to the description in the above embodiments, and are not described herein again.
Based on the foregoing embodiments, fig. 9 is a schematic structural diagram of a physical host according to an embodiment of the present invention. As shown in fig. 9, the physical host may include: a processor, a memory, and a virtual machine running in an isolated environment constructed by the memory and the processor.
A memory for storing a computer program;
the processor is configured to execute the computer program to implement the virtual central processing unit hot plug method provided in the embodiments shown in fig. 1 to 8.
For convenience of understanding, the specific implementation process of the virtual central processing unit hot plug method provided in the above embodiments is exemplarily described by taking an online shopping scenario as an example.
The physical host can process data generated by the user during shopping by utilizing the self-deployed virtual machine. And the change in data traffic is time-period dependent. The VCPU of the virtual machine needs to be hot-plugged in order to guarantee the normal provision of the shopping service.
For example, during holidays, the shopping demand of the user increases, the data traffic to be processed by the virtual machine increases, and at this time, the VCPU needs to be hot-plugged into the virtual machine.
Alternatively, a maintenance person of the shopping website may trigger a hot-plug operation on an operation interface provided by the physical host to generate a hot-plug request containing a total number (e.g., 10) of VCPUs. The total amount of the VCPUs is based on the data flow during the holiday, and the number of the VCPUs required in the virtual machine with the data processing speed can be guaranteed. And because the total amount of the VCPU is set manually, such as input on an operation interface, before performing VCPU hot plug, the virtual machine manager may further determine whether the hot plug request is valid: if the total number of VCPUs does not exceed a predetermined maximum number (e.g., 15), the hot-plug request is valid. Then, the virtual machine manager calculates a target number (e.g., 5) of VCPUs to be plugged by using the total number of VCPUs and the number (e.g., 5) of VCPUs currently in a runnable state in the virtual machine.
Optionally, the virtual machine manager may also automatically generate a hot-plug request based on the current date. For example, when the virtual machine manager determines that the current day is a holiday according to the date, a hot plug request is automatically generated, the target number of VCPUs to be plugged in included in the hot plug request is located in a preset value interval, and the upper limit of the preset value interval is smaller than the preset maximum number. For such an automatically generated hot-plug request, it is not necessary to determine validity.
The virtual machine manager may then allocate physical resources to the VCPU to be plugged in via the KVM deployed in the physical host. After the resource allocation is completed, the virtual machine manager can also utilize the vsock connection between the virtual machine manager and the virtual machine to send the target number of the VCPUs to be plugged into the virtual machine, so that the virtual machine can perform hot plugging of the VCPUs in the virtual machine according to the target number. Taking the example above, i.e., the virtual machine, requires hot plugging 5 VCPUs.
The hot-plug process includes three phases, and 5 VCPUs to be plugged in still have switching of states in different phases. Specifically, in the target number obtaining stage, the virtual machine may obtain the target number by calling a hot plug function, and at this time, the VCPU to be plugged is in a poisable state. In the registration stage, the virtual machine can realize VCPU registration by calling a registration function, and at the moment, the VCPU to be inserted is switched into a Present state from a Possible state. In the activation phase, the virtual machine may also activate the VCPU by calling an activation function, and at this time, the VCPU to be inserted is switched from the Present state to the Online state.
As can be seen from the above description, the hot plug of the VCPU can be realized by using the direct communication between the virtual machine and the virtual machine manager, the virtual machine is light in weight, and the hot plug process is simple. And the state switching process of the VCPU to be plugged in the hot plugging process is automatically completed, so that the participation of maintenance personnel in the hot plugging process can be reduced, and the intelligent and automatic degree of the hot plugging process is improved.
Finally, the virtual machine can also send a hot plug result generated in the hot plug process to the virtual machine manager by means of the vsock connection between the virtual machine manager and the virtual machine manager, so as to complete the hot plug of the VCPU. Optionally, the hot-plug result may include function execution results of each of the hot-plug function, the registration function, and the activation function, or may include only a function execution result of the activation function.
And when a certain stage in the hot plug process fails, rollback processing can be carried out: the VCPU with the hot plugging failure is hot-pulled firstly, and then the hot plugging is carried out again. The hot plug request and the regenerated hot plug request used in the rollback process can be generated after manual trigger operation or automatically generated by a virtual machine manager. The specific content can be referred to the relevant description in the above embodiments.
After the holiday is finished, the VCPUs in the virtual machine can be hot-pulled, for example, the number of VCPUs in the virtual machine is changed from 10 to 5.
At this time, the virtual machine manager may also generate a hot plug request for operations in response to the maintenance personnel. And after the validity verification of the hot-plug request is passed, the target number, namely 5, corresponding to the VCPUs to be unplugged in the hot-plug request can be sent to the virtual machine, so that the virtual machine performs the hot-plug of the VCPUs according to the target number.
The hot-pull process includes three phases and is also accompanied by a change in the state of the VCPU. Specifically, in the target number obtaining stage, the virtual machine may obtain the target number of the VCPUs to be plugged by calling the hot-plug function, and at this time, the VCPUs to be plugged are in an Online state. In the logout stage, the virtual machine can be realized by calling a logout function, and at the moment, the VCPU to be plugged is switched from the Online state to the Present state. In the deletion phase, the virtual machine can be realized by calling a deletion function, and at the moment, the VCPU to be inserted is switched into the Possible state from the Present state.
Finally, the virtual machine can send the hot plug result generated in the hot plug process to the virtual machine manager by means of the vsock connection between the virtual machine manager and the virtual machine manager. The hot-drawing result may include respective function execution results of the hot-drawing function, the logout function, and the deletion function, or may include only a function execution result of the deletion function. After receiving the hot-plug result, the virtual machine manager recycles the physical resources of the 5 VCPUs to complete the hot-plug of the VCPUs. Wherein, the hot-pulled 5 VCPUs may be the latest 5 VCPUs in creation time.
And when a certain stage in the hot drawing process fails, the rollback processing can be carried out as well.
In addition, an embodiment of the present invention provides a computer storage medium, configured to store computer software instructions for the electronic device, where the computer software instructions include a program for executing the virtual central processing unit hot plug method in the method embodiments shown in fig. 1 to fig. 8.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (14)

1. A hot plug method for a virtual central processing unit is characterized in that the method is applied to a virtual machine and comprises the following steps:
acquiring the target number of Virtual Central Processing Units (VCPUs) to be processed corresponding to the hot plug request according to the communication connection between the virtual machines and a virtual machine manager in the physical host;
hot-plugging the VCPUs to be processed in the virtual machine according to the target quantity;
and sending the hot plug result of the VCPU to be processed to the virtual machine manager according to the communication connection.
2. The method of claim 1, wherein the hot plug request comprises a hot plug request, and the VCPU to be processed comprises a VCPU to be plugged;
hot-plugging the to-be-processed VCPUs in the virtual machine according to the target number, including:
registering the VCPUs to be plugged in the virtual machine according to the target quantity;
and activating the VCPU to be inserted after the registration is completed.
3. The method of claim 2, wherein registering VCPUs to be plugged in the virtual machine according to the target number comprises:
registering the VCPUs to be plugged in according to the target quantity by calling a registration function in the virtual machine;
switching the state of the VCPU to be inserted after the registration from an unregistered state to a registered state;
the VCPU to be inserted with the activated registration completed includes:
activating the registered VCPU to be plugged in by calling an activation function in the virtual machine;
and switching the activated state of the VCPU to be plugged from the registered state to the operable state.
4. The method according to claim 2, wherein the obtaining the target number of the Virtual Central Processing Units (VCPUs) to be processed corresponding to the hot plug request comprises:
and acquiring the target number of the VCPUs to be plugged by calling a hot plug function in the virtual machine.
5. The method of claim 3, further comprising:
according to the communication connection, sending a function execution result indicating that the VCPU to be plugged is not plugged successfully to the virtual machine manager, wherein the function execution result comprises a function execution result of any one of a hot-plugging function, the registration function and the activation function;
switching the state of the VCPU to be plugged to an unregistered state according to a hot plug request corresponding to the hot plug request;
responding to the regenerated hot plug request, and calling a hot plug function, the registration function and the activation function in sequence to carry out hot plug of the VCPU to be plugged again.
6. The method of claim 3, further comprising:
establishing a communication connection between the virtual machine and the virtual machine manager;
registering a hot-plug function, the registration function, and the activation function in the virtual machine.
7. The method of claim 1, wherein the hot plug request comprises a hot plug request, and the VCPU to be processed comprises a VCPU to be plugged;
hot-plugging the to-be-processed VCPUs in the virtual machine according to the target number, including:
logging off the VCPUs to be unplugged in the virtual machine according to the target number;
and deleting the logged VCPU to be unplugged.
8. The method of claim 7, wherein said logging the VCPUs to be unplugged in the virtual machine according to the target number comprises:
logging off the VCPU to be unplugged by calling a logging-off function in the virtual machine;
switching the state of the VCPU to be unplugged from an operable state to a registered state;
and switching the state of the VCPU to be unplugged from a registered state to an unregistered state by calling a deletion function in the virtual machine.
9. The method according to claim 7, wherein the obtaining the target number of the Virtual Central Processing Units (VCPUs) to be processed corresponding to the hot plug request comprises:
and acquiring the target number of the VCPUs to be unplugged by calling a hot-unplugging function in the virtual machine.
10. A hot plug method for a virtual central processing unit is characterized in that a virtual machine manager applied to a physical host comprises the following steps:
determining the target number of to-be-plugged Virtual Central Processing Units (VCPUs) corresponding to hot plugging requests according to the hot plugging requests generated by the virtual machine manager, so that the virtual machines hot plug the to-be-plugged VCPUs in the virtual machines according to the target number;
allocating physical resources in the physical host to the VCPU to be plugged;
and receiving a hot plug result of the VCPU to be plugged, which is sent by the virtual machine, according to the communication connection between the virtual machine and the virtual machine manager.
11. The method of claim 10, wherein the determining the target number of Virtual Central Processing Units (VCPUs) to be plugged in corresponding to the hot-plug request comprises:
determining whether the total amount of VCPUs in the hot plug request exceeds a preset maximum amount corresponding to the virtual machine;
and if the total amount of the VCPUs does not exceed the preset maximum amount, determining the target amount according to the total amount of the VCPUs and the number of the VCPUs in the operable state in the virtual machine.
12. A hot plug method for a virtual central processing unit is characterized in that a virtual machine manager applied to a physical host comprises the following steps:
determining the target number of VCPUs (virtual central processing units) to be unplugged corresponding to the hot-unplugging request according to the hot-unplugging request generated by the virtual machine manager, so that the VCPUs to be unplugged are hot-unplugged in the virtual machine by the virtual machine according to the target number;
receiving a hot plug result of the VCPU to be plugged, which is sent by the virtual machine, according to the communication connection between the virtual machine and the virtual machine manager;
and recovering the physical resources corresponding to the VCPU to be unplugged according to the hot-unplugging result.
13. A physical host, comprising: a memory and a processor, and a virtual machine running in an isolated environment constructed by the memory and the processor;
the memory for storing a computer program;
the processor is configured to execute the computer program to implement the virtual central processing unit hot plug method according to any one of claims 1 to 12.
14. A non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the virtual central processor hot plug method of any of claims 1 to 12.
CN202210179047.3A 2022-02-25 2022-02-25 Hot plug method for virtual central processing unit, physical host and storage medium Pending CN114237831A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210179047.3A CN114237831A (en) 2022-02-25 2022-02-25 Hot plug method for virtual central processing unit, physical host and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210179047.3A CN114237831A (en) 2022-02-25 2022-02-25 Hot plug method for virtual central processing unit, physical host and storage medium

Publications (1)

Publication Number Publication Date
CN114237831A true CN114237831A (en) 2022-03-25

Family

ID=80748390

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210179047.3A Pending CN114237831A (en) 2022-02-25 2022-02-25 Hot plug method for virtual central processing unit, physical host and storage medium

Country Status (1)

Country Link
CN (1) CN114237831A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222014A (en) * 2011-06-16 2011-10-19 华中科技大学 Dynamic memory management system based on memory hot plug for virtual machine
CN102317917A (en) * 2011-06-30 2012-01-11 华为技术有限公司 Hot field virtual machine cpu dispatching method and virtual machine system (vms)
CN103365700A (en) * 2013-06-28 2013-10-23 福建师范大学 Cloud computing virtualization environment-oriented resource monitoring and adjustment system
CN103870332A (en) * 2012-12-13 2014-06-18 中国电信股份有限公司 Virtual machine processor resource adjusting method and device and virtual machine system
CN106648827A (en) * 2016-09-20 2017-05-10 国云科技股份有限公司 Method for online adding virtual machine resources
CN110580195A (en) * 2019-08-29 2019-12-17 上海仪电(集团)有限公司中央研究院 Memory allocation method and device based on memory hot plug
CN110633130A (en) * 2019-08-29 2019-12-31 上海仪电(集团)有限公司中央研究院 Virtual memory management method and device based on memory hot plug technology
CN112114935A (en) * 2020-09-18 2020-12-22 北京金山云网络技术有限公司 Hot plug method and related equipment
CN112286638A (en) * 2020-11-04 2021-01-29 浪潮云信息技术股份公司 Method for realizing hot plug between CPU and memory of Openstack virtual machine
US20210216344A1 (en) * 2020-01-10 2021-07-15 Red Hat, Inc. Managing processor overcommit for virtual machines

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222014A (en) * 2011-06-16 2011-10-19 华中科技大学 Dynamic memory management system based on memory hot plug for virtual machine
CN102317917A (en) * 2011-06-30 2012-01-11 华为技术有限公司 Hot field virtual machine cpu dispatching method and virtual machine system (vms)
CN103870332A (en) * 2012-12-13 2014-06-18 中国电信股份有限公司 Virtual machine processor resource adjusting method and device and virtual machine system
CN103365700A (en) * 2013-06-28 2013-10-23 福建师范大学 Cloud computing virtualization environment-oriented resource monitoring and adjustment system
CN106648827A (en) * 2016-09-20 2017-05-10 国云科技股份有限公司 Method for online adding virtual machine resources
CN110580195A (en) * 2019-08-29 2019-12-17 上海仪电(集团)有限公司中央研究院 Memory allocation method and device based on memory hot plug
CN110633130A (en) * 2019-08-29 2019-12-31 上海仪电(集团)有限公司中央研究院 Virtual memory management method and device based on memory hot plug technology
US20210216344A1 (en) * 2020-01-10 2021-07-15 Red Hat, Inc. Managing processor overcommit for virtual machines
CN112114935A (en) * 2020-09-18 2020-12-22 北京金山云网络技术有限公司 Hot plug method and related equipment
CN112286638A (en) * 2020-11-04 2021-01-29 浪潮云信息技术股份公司 Method for realizing hot plug between CPU and memory of Openstack virtual machine

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
OZGUR KILIC等: ""Overcoming Virtualization Overheads for Large-vCPU Virtual Machines"", 《2018 IEEE 26TH INTERNATIONAL SYMPOSIUM ON MODELING, ANALYSIS, AND SIMULATION OF COMPUTER AND TELECOMMUNICATION SYSTEMS (MASCOTS)》 *
李斌吉: ""云平台应用性能监控与资源扩容机制研究"", 《中国优秀博硕士学位论文全文数据库(硕士) 信息科技辑》 *
赵晋等: ""在JADE环境下面向Agent的Gaia建模"", 《微计算机信息》 *
陆晓雯: ""虚拟机资源监测调整机制研究"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Similar Documents

Publication Publication Date Title
US9223596B1 (en) Virtual machine fast provisioning based on dynamic criterion
US9727358B2 (en) Failover detection and treatment in checkpoint systems
CN109240825B (en) Elastic task scheduling method, device, equipment and computer readable storage medium
JPH10283210A (en) Virtual machine movement control system between virtual machine systems
EP3992805B1 (en) Live migration method for virtual machine and communication device
CN110162397B (en) Resource allocation method, device and system
US20180260257A1 (en) Pld management method and pld management system
US9541980B2 (en) Operation management device, operation management method, and recording medium
EP3879875A1 (en) Resource change method and device, apparatus, and storage medium
CN115988217A (en) Virtualized video coding and decoding system, electronic equipment and storage medium
CN113821308A (en) System on chip, virtual machine task processing method and device, and storage medium
CN115988218A (en) Virtualized video coding and decoding system, electronic equipment and storage medium
CN110609749A (en) Distributed task operation method, system and equipment
WO2011114476A1 (en) Multicore processor system, notification program, and notification method
CN113467884A (en) Resource allocation method and device, electronic equipment and computer readable storage medium
CN114968567A (en) Method, apparatus and medium for allocating computing resources of a compute node
CN112612498A (en) Embedded equipment upgrading method and embedded equipment
CN107783826B (en) Virtual machine migration method, device and system
US20150381766A1 (en) Application transfer system, application transfer method, terminal, and program
CN106325972B (en) Virtual machine management method and network equipment
CN114237831A (en) Hot plug method for virtual central processing unit, physical host and storage medium
CN109284169B (en) Big data platform process management method based on process virtualization and computer equipment
KR20200135138A (en) Method, device, apparatus, and medium for booting a virtual machine
JP6879960B2 (en) Backup control method and system
CN115794306A (en) Resource allocation method and device based on preemption instance, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40070326

Country of ref document: HK

RJ01 Rejection of invention patent application after publication

Application publication date: 20220325

RJ01 Rejection of invention patent application after publication