A virtual machine resource allocation method, computing device and computing system
By using the virtual serial port between the host and the virtual machine to obtain resource usage information and dynamically adjust it, the operational instability caused by insufficient virtual machine resources is solved, and the operation stability and resource allocation success rate of the virtual machine are improved.
Patent Information
- Application Number
- CN202311562575.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2043-11-20
AI Technical Summary
When the amount of available resources on the virtual machine is insufficient, the virtual machine cannot run normally or even goes down, reducing the operating stability of the virtual machine.
Through the virtual serial port, the host obtains the usage information of the target monitoring resources from the target virtual machine, determines the resources to be adjusted (resources to be expanded or reduced), and adjusts its resource amount to meet the current needs of the virtual machine.
Improve the operating stability of the virtual machine, avoid resource allocation errors or failures, and improve the success rate of resource allocation.
Smart Images

Figure CN117827366B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of server technology, and in particular to a resource allocation method for a virtual machine, a computing device, and a computing system. Background Art
[0002] As we all know, a virtual machine (VM) is a virtual computer with an independent operating system (OS) running on a host machine; the host machine can monitor the resource usage of each virtual machine on it through the network connection between the host machine and the virtual machine.
[0003] However, when the available resources on the virtual machine are insufficient, the virtual machine may not be able to operate normally, and in serious cases, the virtual machine may be down, thereby reducing the stability of the operation of the virtual machine. Summary of the invention
[0004] Embodiments of the present application provide a resource allocation method for a virtual machine, a computing device, and a computing system, which are used to improve the stability of the operation of the virtual machine.
[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for allocating resources for a virtual machine, the method comprising: a host machine obtains usage information of a target monitoring resource on a target virtual machine from the target virtual machine through a virtual serial port; the target virtual machine is a virtual machine running on the host machine and needs to obtain usage information of the target monitoring resource, and the target monitoring resource is a resource monitored on the target virtual machine; the usage information comprises: the amount of resources used of the target monitoring resource; the host machine determines that the target monitoring resource is a resource to be adjusted based on the usage information of the target monitoring resource; the resource to be adjusted comprises: resources to be expanded or resources to be reduced; the host machine adjusts the resource amount of the resource to be adjusted.
[0007] The above-mentioned embodiment provides a resource allocation method for a virtual machine, the method comprising: the host machine obtains usage information of a target monitoring resource of the target virtual machine from the target virtual machine running thereon, the usage information including the used resource amount of the target resource; and determines, based on the usage information, that the target monitoring resource is a resource to be adjusted, the resource to be adjusted including a resource to be expanded or a resource to be reduced; then, the host machine adjusts the resource to be adjusted so that the available resource amount of the adjusted resource to be adjusted meets the current demand of the target virtual machine, thereby ensuring the normal operation of the target virtual machine, thereby improving the stability of the operation of the target virtual machine.
[0008] In addition, since in the above-mentioned resource allocation process for the virtual machine, the host machine and the target virtual machine running on it communicate based on the virtual serial port, the problem of resource allocation errors or allocation failures of the virtual machine due to network problems in the resource allocation process for the virtual machine is avoided, thereby improving the success rate of resource allocation for the virtual machine.
[0009] In a possible implementation, the host machine determines the target monitoring resource as a resource to be adjusted based on usage information of the target resource, including: when the amount of used resources of the target monitoring resource is greater than or equal to a first threshold, the host machine determines the target monitoring resource as a resource to be expanded.
[0010] In a possible implementation manner, the host machine adjusts the resource amount of the resource to be adjusted, including: the host machine expands the resource amount of the resource to be expanded.
[0011] In one possible implementation, the host machine determines the target monitoring resource as a resource to be adjusted based on usage information of the target monitoring resource, including: when the amount of used resources of the target monitoring resource is less than or equal to a second threshold, the host machine determines the target monitoring resource as a resource to be reduced; wherein the second threshold is less than the first threshold.
[0012] In a possible implementation manner, the host machine adjusts the resource amount of the resource to be adjusted, including: the host machine reduces the resource amount of the resource to be reduced.
[0013] In the above embodiment, the target virtual machine obtains the used resource amount of the target monitoring resource of the target virtual machine in response to the first acquisition request sent by the host machine, and sends the used resource amount of the target monitoring resource to the host machine. Then, the host machine determines the resources to be expanded and the resources to be reduced according to the used resource amount of the target monitoring resource, and expands the resources to be expanded and reduces the resources to be reduced, thereby realizing the dynamic allocation of virtual machine resources by the host machine.
[0014] In addition, during the entire dynamic allocation process, the target virtual machine is only used to send the used resource amount of the target monitoring resources obtained by the target virtual machine to the host machine, and the target virtual machine is not required to determine the resources to be expanded and reduced. Therefore, the utilization rate of computing resources in the target virtual machine is reduced.
[0015] In one possible implementation, the host machine obtains usage information of target monitoring resources on the target virtual machine from the target virtual machine through a virtual serial port, including: the host machine sends a first acquisition request to the target virtual machine through the virtual serial port; the target virtual machine obtains usage information of the target monitoring resources in response to the first acquisition request; the target virtual machine sends usage information of the target monitoring resources to the host machine through the virtual serial port.
[0016] In a possible implementation, the method further includes: the target virtual machine obtains the current used resource amount of the target monitoring resource; and the target virtual machine updates the used resource amount stored in the resource database according to the current used resource amount of the target monitoring resource.
[0017] The above embodiment is that the target virtual machine stores the used resource amount of the target monitoring resource in the resource database in the target virtual machine. When the target virtual machine needs to obtain the used resource amount of the target monitoring resource, it can directly read it from the resource database, and the target virtual machine does not need to read from each target monitoring resource in turn. Therefore, the efficiency of the target virtual machine in obtaining the used resource amount of the target monitoring resource is improved.
[0018] In one possible implementation, before the target virtual machine obtains the current used amount of resources of the target monitoring resource, the method also includes: the host machine receives a monitoring request sent by a management device, the monitoring request including: an identifier of the target virtual machine and an identifier of the target monitoring resource; the host machine sends the identifier of the target monitoring resource to the target virtual machine through a virtual serial port.
[0019] In the second aspect, an embodiment of the present application provides a resource allocation device, which includes: a transceiver unit and a processing unit; the transceiver unit is used to obtain usage information of a target monitoring resource on a target virtual machine from the target virtual machine through a virtual serial port; the target virtual machine is a virtual machine running on a host machine and needs to obtain usage information of a target monitoring resource, and the target monitoring resource is a resource monitored on the target virtual machine; the usage information includes: the amount of resources used of the target monitoring resource; the processing unit is used to determine that the target monitoring resource is a resource to be adjusted based on the usage information; the resource to be adjusted includes: resources to be expanded or resources to be reduced; the processing unit is also used to adjust the resource amount of the resource to be adjusted.
[0020] In a possible implementation, the processing unit is further configured to determine the target monitoring resource as a resource to be expanded when the used resource amount of the target monitoring resource is greater than or equal to a first threshold.
[0021] In a possible implementation manner, the processing unit is further configured to expand the resource amount of the resources to be expanded.
[0022] In a possible implementation, the processing unit is configured to determine the target monitoring resource as a resource to be reduced when the used resource amount of the target monitoring resource is less than or equal to a second threshold; wherein the second threshold is less than the first threshold.
[0023] In a possible implementation manner, the processing unit is used to reduce the amount of resources to be reduced.
[0024] In one possible implementation, the transceiver unit is used to send a first acquisition request to the target virtual machine through the virtual serial port; the transceiver unit is used to obtain usage information of the target monitoring resource in response to the first acquisition request; the transceiver unit is also used to send usage information to the host machine through the virtual serial port.
[0025] In a possible implementation, the device also includes: a storage unit; a transceiver unit for obtaining the current used resource amount of the target monitoring resource; and a storage unit for updating the used resource amount stored in the resource database according to the current used resource amount of the target monitoring resource.
[0026] In a possible implementation, the transceiver unit is used to receive a monitoring request sent by a management device, the monitoring request including: an identifier of a target virtual machine and an identifier of a target monitoring resource; the transceiver unit is also used to send the identifier of the target monitoring resource to the target virtual machine through a virtual serial port.
[0027] In a third aspect, a computing device is provided, which includes a processor and a memory, wherein the memory and the processor are electrically connected; the memory is used to store program instructions, and the processor executes the program instructions to implement the method of the first aspect and its possible implementation methods.
[0028] In a fourth aspect, a computing system is provided, which includes: a management device and the computing device described in the third aspect; the management device is connected to the computing device through a network; the management device is used to send a monitoring request to the host machine, and the monitoring request includes: an identifier of a target virtual machine and an identifier of a target monitoring resource.
[0029] In a fifth aspect, a computer-readable storage medium is provided, which stores computer instructions. When the computer instructions in the computer-readable storage medium are executed by a computing device, the computing device performs the functions of the apparatus of the first aspect and its possible implementation methods.
[0030] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computing device, enables the computing device to execute the functions of the apparatus of the above-mentioned first aspect and possible implementation methods thereof.
[0031] It should be understood that the beneficial effects achieved by the technical solutions of the second to sixth aspects of the embodiments of the present application and the corresponding possible implementation methods can be referred to the technical effects of the first aspect and its corresponding possible implementation methods mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A schematic diagram of a management system provided in an embodiment of the present application;
[0033] Figure 2A schematic diagram of the hardware structure of a computing device provided in an embodiment of the present application;
[0034] Figure 3 A schematic diagram of a system architecture of a virtual machine and an OS provided in an embodiment of the present application;
[0035] Figure 4 A schematic diagram of a method for allocating resources to a virtual machine provided in an embodiment of the present application;
[0036] Figure 5 A schematic diagram of allocating CPU resources to a virtual machine provided in an embodiment of the present application;
[0037] Figure 6 A schematic diagram of another method for allocating resources to a virtual machine provided in an embodiment of the present application;
[0038] Figure 7 A schematic diagram of an updating method flow chart provided in an embodiment of the present application;
[0039] Figure 8 A schematic diagram of a flow chart of a resource allocation method for a virtual machine provided in an embodiment of the present application;
[0040] Fig. 9 A schematic diagram of a host management interface provided in an embodiment of the present application;
[0041] Fig.10 A schematic diagram of a method for allocating resources to a virtual machine provided in an embodiment of the present application;
[0042] Fig.11 A schematic diagram of the structure of a resource allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0044] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first threshold and a second threshold are used to distinguish different thresholds rather than to describe a specific order of thresholds.
[0045] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0046] First, some concepts involved in a virtual machine resource allocation method, computing device, and computing system provided in an embodiment of the present application are explained:
[0047] Virtual machine: refers to a complete computer system with complete hardware system functions that is simulated by software and runs in a completely isolated environment. Any work that can be done in a physical computer can be done in a virtual machine. When creating a virtual machine in a computer, part of the hard disk and memory capacity of the physical machine needs to be used as the hard disk and memory capacity of the virtual machine. Each virtual machine has an independent hard disk and operating system, and can be operated like a physical machine.
[0048] As described in the background technology, when the amount of available resources on a virtual machine is insufficient, the virtual machine will not be able to operate normally, and in severe cases, the virtual machine will crash, thereby reducing the stability of the virtual machine's operation. In order to solve this problem, an embodiment of the present application provides a resource allocation method for a virtual machine, the method comprising: a host machine obtains usage information of a target monitoring resource of the target virtual machine from the target virtual machine running thereon, the usage information including the amount of used resources of the target resource; and according to the usage information, the target monitoring resource is determined to be a resource to be adjusted, the resource to be adjusted including a resource to be expanded or a resource to be reduced; then, the host machine adjusts the resource to be adjusted so that the available resource amount of the adjusted resource to be adjusted meets the current demand of the target virtual machine, thereby ensuring the normal operation of the target virtual machine, thereby improving the stability of the operation of the target virtual machine.
[0049] The resource allocation method for a virtual machine provided in the embodiment of the present application is applied in the following aspects: Figure 1 In the management system shown, the management system includes: a host machine 101 , a host machine 102 , a host machine 103 and a management device 104 .
[0050] The management device 104 is used to send the identifier of the target virtual machine running on the host machine and the identifier of the target monitoring resource of the target virtual machine to at least one of the host machines 101-103, wherein, taking the host machine 101 as an example, the target virtual machine in the host machine 101 is the virtual machine that needs to monitor the target monitoring resource (such as storage resource) among the multiple virtual machines running on the host machine 101. The management device 104 is connected to the host machines 101-103 respectively through the network; specifically, the management device 104 can be a computing device with processing capabilities such as a server and a computer.
[0051] It should be noted that the target monitoring resources of different target virtual machine pairs may be the same or different; the embodiments of the present application do not specifically limit them.
[0052] The host machine 101 is used to receive a monitoring request sent by the management device 104, and the monitoring request includes: an identifier of a target virtual machine in the host machine 101 and an identifier of a target monitoring resource; then, the host machine 101 sends the identifier of the target monitoring resource to the target virtual machine through a virtual serial port between the host machine 101 and the target virtual machine, so that the host machine 101 monitors the target monitoring resource; when the target monitoring resource contains resources to be adjusted, including resources to be expanded or resources to be reduced, the host machine 101 adjusts the resource amount of the resources to be adjusted in the target virtual machine.
[0053] It should be noted that the virtual machines (such as virtual machine 1012 ) on the host machine 101 all run on the operating system of the host machine 101 , and the virtual machine 1012 communicates with the host machine 101 based on a virtual serial port.
[0054] Among them, multiple virtual machines such as virtual machine 1011, virtual machine 1012, virtual machine ... and virtual machine 101x are running on the host machine 101. The multiple virtual machines can be virtual machines with Windows operating system or virtual machines with Linux operating system. Specifically, the host machine 101 can be a computing device with computing and storage capabilities such as a desktop computer, a notebook, and a server.
[0055] It should be understood that the relevant descriptions of host machines 102 and 103 are similar to the relevant descriptions of the above-mentioned host machine 101. For the specific descriptions of host machines 102 and 103, refer to the relevant descriptions of the above-mentioned host machine 101, which will not be repeated here.
[0056] It should be noted that the resource allocation method for virtual machines provided in the embodiments of the present application is applied to the scenario of monitoring the resources on the virtual machines in the above-mentioned management system; the above-mentioned management system is described by taking the host machines including host machines 101-host machines 103 as an example, and in actual applications, the management system may include at least one host machine; similarly, the management system is described by taking the example of multiple virtual machines running on the host machine, and in actual applications, at least one virtual machine can run on the host machine.
[0057] For example, Figure 2 It is a schematic diagram of a hardware structure of a computing device of the host machine 101, the host machine 102 or the host machine 103. The computing device may specifically be a high-density server, a rack server, a high-performance server or a GPU (graphics processing unit) server.
[0058] The hardware part of the computing device includes a processor (central processing unit, CPU), an out-of-band controller and a memory, and the software part mainly includes an out-of-band management module and an operating system (operating system, OS).
[0059] The out-of-band management module runs in the out-of-band controller, and the OS runs on the processor (such as Figure 2 As shown). The out-of-band management module may be a management unit of a non-business module. For example, the out-of-band management module may remotely maintain and manage the computing device through a dedicated data channel. The out-of-band management module is completely independent of the operating system of the computing device and may communicate with the OS through the out-of-band management interface of the computing device. At least one virtual machine is running in the OS, specifically including: virtual machine_1 to virtual machine_N.
[0060] For example, the system architecture between the virtual machine_1 and the OS running on the CPU of the host machine is as follows: Figure 3 As shown, virtual machine_1 includes a monitoring service, wherein the monitoring service is used to create a virtual serial port between the virtual machine_1 and the OS when the virtual machine_1 is initialized, and receive a query request sent by the OS through the virtual serial port; the monitoring service is also used to send usage information of the target monitoring resource to the OS in response to the query request; wherein the virtual serial port is used to provide a virtual serial port channel for the virtual machine to interact with the host machine.
[0061] A resource allocation service is running in the above OS, and the resource allocation service is used to determine the resources to be adjusted according to the usage information of the target monitoring resources, and the resources to be adjusted include: resources to be expanded or resources to be reduced; and adjust the resource amount of the resources to be adjusted.
[0062] Exemplarily, the out-of-band management module may include a management unit for computing the running status of the device, a management system in a management chip outside the in-band controller, a system management module (system management mode, SMM), etc. It should be noted that the embodiments of the present application do not limit the specific form of the out-of-band management module, and the above is only an exemplary description.
[0063] Among them, the memory, also called internal memory or main memory, is installed in the memory slot on the motherboard of the computing device, and the memory communicates with the memory controller through a memory channel.
[0064] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0065] The present application embodiment provides a method for allocating resources of a virtual machine, such as Figure 4 As shown, the method includes: S110-S130.
[0066] S110 . The host machine obtains usage information of a target monitoring resource on the target virtual machine from the target virtual machine through the virtual serial port.
[0067] At least one virtual machine is running on the host machine, and the at least one virtual machine communicates with the host machine through a virtual serial port; wherein the virtual serial port is a virtual serial port channel created when the virtual machine is initialized and used to provide the virtual machine with the host machine for interaction.
[0068] The above-mentioned target monitoring resources are the resources that need to be monitored in the target virtual machine, wherein the target monitoring resources of different target virtual machines may be the same or different; for example: the target monitoring resources of virtual machine_1 include: the CPU resources of the virtual machine_1 and the solid state disk (SSD) resources of the virtual machine_1; the target monitoring resources of virtual machine_2 are the memory resources of the virtual machine_2 and the hard disk drive (HDD) resources of the virtual machine_2.
[0069] It should be noted that there may be one target monitoring resource or multiple target monitoring resources in the above-mentioned target virtual machine; for the convenience of describing the embodiment of the present application, the example of the existence of one target monitoring resource in the target virtual machine is used for explanation, and no further details will be given later.
[0070] The usage information of the above-mentioned target monitoring resources includes: the identification of the resources to be adjusted, or the used resource amount of the target monitoring resources (that is, the available resource amount of the target monitoring resources); wherein, the resources to be adjusted include: resources to be expanded or resources to be reduced; the resources to be expanded are resources whose available resource amount in the target monitoring resources is insufficient, and the resources to be reduced are resources whose available resource amount in the target monitoring resources is greater than the resource required by the target virtual machine.
[0071] The target virtual machine is the virtual machine for which the usage information of the target monitoring resource needs to be obtained among at least one virtual machine running on the host. For example, assuming that virtual machine_1 and virtual machine_2 are running on the host, when the host needs to obtain the usage information of the target monitoring resource on virtual machine_1, virtual machine_1 is the target virtual machine.
[0072] When there are multiple target virtual machines in the host machine, the host machine obtains usage information of target monitoring resources of each of the multiple target virtual machines, and executes the following S120-S130 based on the usage information of target monitoring resources of each of the multiple target virtual machines.
[0073] S120: The host machine determines, according to usage information of the target monitoring resource, that the target monitoring resource is a resource to be adjusted.
[0074] When the usage information of the target monitoring resources includes the available resource amount of the target monitoring resources, the host machine determines the target monitoring resources whose available resource amount is insufficient among the target monitoring resources as resources to be expanded, or determines the target monitoring resources whose available resource amount is excessive among the target monitoring resources as resources to be reduced; among which, the specific implementation method of the host machine determining the resources to be expanded and the resources to be reduced is shown in the following Example 1, which will not be repeated here.
[0075] When the usage information of the above-mentioned target monitoring resource includes the identifier of the resource to be expanded, the host machine determines the target monitoring resource indicated by the identifier of the resource to be expanded in the usage information as the resource to be expanded, wherein the specific implementation method of the target virtual machine determining the resource to be expanded is shown in the following Example 2, which will not be repeated here.
[0076] When the usage information of the above-mentioned target monitoring resource includes the identifier of the resource to be reduced, the host machine determines the target monitoring resource indicated by the identifier of the resource to be reduced in the usage information as the resource to be reduced, wherein the specific implementation method of the target virtual machine determining the resource to be reduced is shown in the following Example 2, which will not be repeated here.
[0077] S130: The host machine adjusts the resource amount of the resource to be adjusted.
[0078] It should be understood that the resources (such as CPU resources) on the virtual machine are allocated to the virtual machine by the host machine; Figure 5 As shown, taking CPU resources as an example, the allocation process specifically includes: the host machine virtualizes the resources in the hardware CPU (referred to as: target CPU) on it through a virtual machine supervisor (such as: qemu) to obtain multiple virtual CPU resources (such as: virtual CPU resource_1 to virtual CPU resource_N); wherein each virtual CPU resource corresponds to part of the resources in the target CPU; then, the host machine allocates part of the virtual CPU resources (such as: virtual CPU resource_1 and virtual CPU resource_2) among the multiple virtual CPU resources to virtual machine_1, so that virtual machine_1 uses virtual CPU resource_1 and virtual CPU resource_2 as its CPU to run its business.
[0079] The specific implementation of the above S130 includes the following:
[0080] When the above-mentioned resources to be adjusted are resources to be expanded, the host machine allocates part of the available resources in the target resources of the same resource type as the resources to be expanded in the host machine to the resources to be expanded in the target virtual machine, so that the total amount of resources to be expanded after allocation increases.
[0081] For example, assume that virtual machine 1 and virtual machine 2 are running on a host machine; the CPU in the host machine (referred to as target CPU) is an 8-core CPU; wherein the 1st and 2nd cores in the target CPU are used as CPU resources in virtual machine 1, and the 3rd and 4th cores are used as CPU resources in virtual machine 2; the CPU resources corresponding to the 5th to 8th cores are idle. Assume that the CPU usage rate in virtual machine 1 is 90%. When the resource to be expanded in virtual machine 1 is a CPU resource, the CPU resources in virtual machine 1 need to be expanded; the specific expansion process includes: since the CPU resources corresponding to the 5th to 8th cores in the target CPU are idle, the host machine allocates 2 cores of the CPU resources corresponding to the 5th to 8th cores on the target CPU (i.e., the target resources) to the CPU resources in virtual machine 1, so that the total amount of CPU resources in virtual machine 1 after allocation is 4 cores; at this time, the CPU usage rate in virtual machine 1 will be 45%.
[0082] When the above-mentioned resources to be adjusted are resources to be reduced, the host machine releases part of the available resources (i.e., idle resources) in the above-mentioned resources to be reduced, so that the available resources of the released part no longer belong to the resources in the above-mentioned target virtual machine, that is, the available resources of the released part are no longer occupied by the target virtual machine, so that they return to the available resources of the host machine.
[0083] For example, assuming that the target CPU on the host machine is an 8-core CPU, the CPU resources of virtual machine_1 occupy two core CPU resources in the target CPU; assuming that the CPU usage of virtual machine_1 is 20%; then, when the host machine releases the available 1-core CPU resource in virtual machine_1 to the host machine, the CPU resources of virtual machine_1 occupy 1-core CPU resource in the target CPU. At this time, the CPU usage of virtual machine_1 is 40%, and the available CPU resources in the host machine have 1 more core.
[0084] The above-mentioned embodiment provides a resource allocation method for a virtual machine, the method comprising: the host machine obtains usage information of a target monitoring resource of the target virtual machine from the target virtual machine running thereon, the usage information including the used resource amount of the target resource; and determines, based on the usage information, that the target monitoring resource is a resource to be adjusted, the resource to be adjusted including a resource to be expanded or a resource to be reduced; then, the host machine adjusts the resource to be adjusted so that the available resource amount of the adjusted resource to be adjusted meets the current demand of the target virtual machine, thereby ensuring the normal operation of the target virtual machine, thereby improving the stability of the operation of the target virtual machine.
[0085] In addition, since in the above-mentioned resource allocation process for the virtual machine, the host machine and the target virtual machine running on it communicate based on the virtual serial port, the problem of resource allocation errors or allocation failures of the virtual machine due to network problems in the resource allocation process for the virtual machine is avoided, thereby improving the success rate of resource allocation for the virtual machine.
[0086] Based on the above Figure 4 The resource allocation method for the virtual machine shown in the embodiment of the present application provides two implementation methods, see the following embodiment 1 and embodiment 2 for details.
[0087] Example 1
[0088] The present application embodiment provides a method for allocating resources of a virtual machine, such as Figure 6 As shown, including: S210-S290.
[0089] S210: The host machine sends a first acquisition request to the target virtual machine through the virtual serial port.
[0090] The first acquisition request is used to trigger the target virtual machine to execute the following S220-S230.
[0091] Optionally, a resource allocation service is running in the host machine, and a monitoring service is running in each of the at least one virtual machine; the monitoring service creates the virtual serial port when the virtual machine in which it is located is started. The monitoring service in each virtual machine interacts with the resource allocation service in the host machine based on the virtual serial port; based on this, the implementation method of S210 includes: the resource allocation service running in the host machine sends a first acquisition request to the monitoring service running in the target virtual machine through the virtual serial port.
[0092] It should be noted that the above-mentioned resource allocation service can be an independent application in the host machine, or it can be a functional module in an application in the host machine (such as VMtools); similarly, the monitoring service in the virtual machine can be an independent application or process, or it can be a functional module in an application or process in the virtual machine (such as: the internal daemon process qemu-guest-agent, qga), and the specific embodiments of the present application do not specifically limit it.
[0093] S220: The target virtual machine obtains the used resource amount of the target monitoring resource in response to the first acquisition request.
[0094] The used resource amount of the target monitoring resource may be directly obtained by the target virtual machine from the target monitoring resource (eg, read) or may be obtained by the target virtual machine from a resource database in the target virtual machine.
[0095] Among them, the used resource amount of the target monitoring resource can be expressed by the resource utilization rate (such as: CPU utilization rate), or it can be expressed by the total resource amount of the target monitoring resource used in the target monitoring resource (such as: the used storage space amount of SSD is 1T). The specific embodiment of the present application does not limit the specific form of expression of the used resource amount.
[0096] It should be noted that, when the target virtual machine reads the above-mentioned used resource amount from the resource database in the target virtual machine, the target virtual machine needs to update the used resource amount of the target monitoring resource stored in the resource database in real time, so that the used resource amount of the target monitoring resource in the resource database is always consistent with the actual used resource amount of the target monitoring resource. Among them, the specific implementation of the target virtual machine updating the used resource amount of the target monitoring resource in the resource database is shown in the following S310-S320, which will not be repeated here.
[0097] The target virtual machine and the target monitoring resources in the target virtual machine are pre-specified by the user, and the specific specification method is as follows:
[0098] In one implementation, the above-mentioned target virtual machine and the target monitoring resource in the target virtual machine are specified by the user in the host machine, which specifically includes: the user pre-configures the identifier of the target virtual machine and the identifier of the target monitoring resource in the host machine, and then, after the target virtual machine completes the initialization, the host machine sends the identifier of the target monitoring resource of the target virtual machine to the target virtual machine indicated by the identifier of the target virtual machine, so that the target virtual machine stores the identifier of the target monitoring resource.
[0099] In another implementation, the target virtual machine and the target monitoring resource in the target virtual machine are specified by the user through the management device, which is specifically referred to in S410-S430 below and will not be described in detail here.
[0100] It should be noted that the user-specified target virtual machine and the target monitoring resource in the target virtual machine are used to trigger the host machine to periodically execute the above S210; they are also used to trigger the target virtual machine to start continuously updating the used resource amount of the target monitoring resource in the resource database.
[0101] It should be noted that the thread (or process) executing the above S210-S290 is different from the thread (or process) executing the following S310-S320, that is, whether the resources of the virtual machine are allocated successfully or not will not affect the target virtual machine updating and maintaining the data in the resource database thereon.
[0102] S230: The target virtual machine sends usage information of the target monitoring resource to the host machine through the virtual serial port.
[0103] The above usage information includes: the used resource amount of the target monitoring resource.
[0104] It should be noted that after receiving the usage information of the target monitoring resource, the host machine determines whether the target monitoring resource is a resource to be adjusted according to the usage information, as shown in S240 and S260 below.
[0105] S240: The host machine determines whether the used resource amount of the target monitoring resource is greater than or equal to a first threshold.
[0106] It should be noted that the above-mentioned first threshold is the upper limit value of the used resource amount of the preset target monitoring resource. When the used resource amount of the target monitoring resource is greater than or equal to the first threshold, the stability of the target virtual machine during operation is low; when the used resource amount of the target monitoring resource is less than the first threshold, the stability of the target virtual machine during operation is high.
[0107] It should be understood that, when there are multiple target monitoring resources in the target virtual machine, the first thresholds corresponding to different target monitoring resources may be the same or different.
[0108] When the used resource amount of the target monitoring resource is greater than or equal to the first threshold, the host machine executes the following S250.
[0109] When the used resource amount of the target monitoring resource is less than the first threshold, the host machine executes the following S270.
[0110] S250: The host machine determines the target monitoring resource as a resource to be expanded.
[0111] Exemplarily, assume that the target monitoring resources include: CPU, and the CPU utilization rate (i.e., the amount of CPU resources used) in the target virtual machine is 90%; assume that the first threshold value of the CPU is 70%; then, since the CPU utilization rate of 90% is greater than the first threshold value of 70% of the CPU, the host machine determines the CPU in the target virtual machine as a resource to be expanded.
[0112] S260. The host machine expands the resources to be expanded.
[0113] It should be noted that the implementation method of the above S260 is consistent with the implementation method of expanding the resources to be expanded in the above S130. For the specific description of S260, please refer to the above related description of S130, which will not be repeated here.
[0114] S270: The host machine determines whether the used resource amount of the target monitoring resource is less than or equal to a second threshold.
[0115] It should be noted that the above-mentioned second threshold is smaller than the above-mentioned first threshold; the second threshold is the lower limit value of the used resource amount of the preset target monitoring resource. When the used resource amount of the target monitoring resource is less than or equal to the second threshold, it indicates that there are a large number of idle resources in the target monitoring resource, that is, at this time, the available resource amount of the target monitoring resource is in excess (i.e., too much); when the used resource amount of the target monitoring resource is greater than the second threshold, it indicates that there are not a large number of idle resources in the target monitoring resource, that is, there is no problem of excess resources in the target monitoring resource.
[0116] S280: The host machine determines the target monitoring resource as a resource to be reduced.
[0117] Exemplarily, assume that the target monitoring resources include: SSD; wherein, the SSD usage rate in the target virtual machine is 10%; further assume that the second threshold value of the SSD is 20%; then, since the SSD usage rate of 10% is less than the second threshold value of 20% of the SSD; the host machine determines the SSD in the target virtual machine as a resource to be reduced.
[0118] S290: The host machine reduces the amount of resources to be reduced.
[0119] The implementation method of the above S290 is consistent with the implementation method of reducing the resources to be reduced in the above S130. For the specific description of S290, reference may be made to the above related description of S130, which will not be repeated here.
[0120] It should be noted that the host machine may first execute S240-S260 and then S270-S290; or it may first execute S270-S290 and then S240-S260. Specifically, the embodiment of the present application does not limit the execution order of S240-S260 and S270-S290.
[0121] In the above embodiment, the target virtual machine obtains the used resource amount of the target monitoring resource of the target virtual machine in response to the first acquisition request sent by the host machine, and sends the used resource amount of the target monitoring resource to the host machine. Then, the host machine determines the resources to be expanded and the resources to be reduced according to the used resource amount of the target monitoring resource, and expands the resources to be expanded and reduces the resources to be reduced, thereby realizing the dynamic allocation of virtual machine resources by the host machine.
[0122] In addition, during the entire dynamic allocation process, the target virtual machine is only used to send the used resource amount of the target monitoring resources obtained by the target virtual machine to the host machine, and the target virtual machine is not required to determine the resources to be expanded and reduced. Therefore, the utilization rate of computing resources in the target virtual machine is reduced.
[0123] Optionally, in a scenario where the target virtual machine obtains the used resource amount of the target monitoring resource from the resource database thereon, in order to ensure that the used resource amount of the target monitoring resource in the resource database is consistent with the actual used resource amount of the target monitoring resource, it is necessary to continuously update the used resource amount of the target monitoring resource in the resource database. The specific updating method is as follows: Figure 7 As shown, including: S310-S320.
[0124] S310: The target virtual machine obtains the currently used resource amount of the target monitoring resource.
[0125] The specific implementation of the above S310 includes: the target virtual machine obtains the current used resource amount of the target monitoring resource (such as CPU) from the target monitoring resource of the target virtual machine. For example, virtual machine_1 obtains the current usage rate of the CPU from the CPU of virtual machine_1, which is 90%.
[0126] S320: The target virtual machine updates the resource database according to the currently used resource amount of the target monitoring resource.
[0127] The used resource amount of the target monitoring resource in the updated resource database is the current used resource amount of the target monitoring resource obtained in S310.
[0128] Exemplarily, based on the example in S310 above, assume that the CPU usage of virtual machine _1 currently stored in the resource database of virtual machine _1 is 60%; at this time, the current usage of the CPU obtained by virtual machine _1 is 90%; then, virtual machine _1 uses the current usage of the CPU of 90% to update the resource database; so that the CPU usage stored in the updated resource database is 90%.
[0129] It should be noted that the used resource amount of the target monitoring resources in the above-mentioned resource database is continuously updated, and the update strategy can be a periodic update, such as the target virtual machine updates the used resource amount of the target monitoring resources in the resource database on it once every 10 seconds (that is, executes the above-mentioned S310-S320 once); the update strategy can also be a triggered update, such as: when the used resource amount of the target monitoring resources changes, the target virtual machine updates the used resource amount of the target monitoring resources in the resource database on it.
[0130] The above embodiment is that the target virtual machine stores the used resource amount of the target monitoring resource in the resource database in the target virtual machine. When the target virtual machine needs to obtain the used resource amount of the target monitoring resource, it can directly read it from the resource database, and the target virtual machine does not need to read from each target monitoring resource in turn. Therefore, the efficiency of the target virtual machine in obtaining the used resource amount of the target monitoring resource is improved.
[0131] In the scenario where the user specifies the target virtual machine and the target monitoring resource in the target virtual machine through the management device, Figure 7 ,like Figure 8 As shown, before executing the above S210, a resource allocation method for a virtual machine provided in an embodiment of the present application also includes: S410-S430.
[0132] S410: The management device obtains selected information based on the target operation of the user on the host management interface.
[0133] The above-mentioned management device is a device for managing a host machine, wherein the management device interacts with the host machine via a network.
[0134] The above-mentioned host management interface is the interface output (i.e., displayed) by the management device, which includes: all hosts managed by the management device and all virtual machines running on each host managed by the management device, as well as various types of resources in each of the virtual machines.
[0135] The above target operation is an operation in which a user selects a target monitoring resource to be monitored on the host management interface.
[0136] The above selected information includes: an identifier of a target host machine, an identifier of a target virtual machine in the target host machine, and an identifier of a target monitoring resource in the target virtual machine.
[0137] Among them, the target host machine is a host machine among multiple host machines managed by the management device, and the resources of the virtual machines running on it need to be monitored; the target virtual machine is a virtual machine among multiple virtual machines running on the target host machine, and the resources on it need to be monitored.
[0138] For example, assume that the host management interface output by the management device is as follows: Fig. 9 As shown, the management interface includes: a host machine A managed by the management device. Virtual machine_1 and virtual machine_2 are running in the host machine A; wherein, the resource types existing in the virtual machine_1 include: CPU and SSD, and the resource types existing in the virtual machine_2 include: CPU and SSD. When the target operation input by the user on the host machine management interface includes: selecting a resource whose resource type in virtual machine_1 is CPU; the target operation is used to indicate monitoring of the CPU resources on virtual machine_1 running in host machine A, that is, the user specifies the target virtual machine in host machine A as virtual machine_1 through the management device, and specifies the target monitoring resource in virtual machine_1 as CPU. Then, at this time, the target host in the selected information obtained by the management device includes: host machine A, the target virtual machine includes: virtual machine_1; the target monitoring resource in the target virtual machine includes: CPU.
[0139] S420: The management device sends a monitoring request to the target host.
[0140] The monitoring request includes: an identifier of a target virtual machine and an identifier of a target monitoring resource in the target virtual machine; the monitoring request is used to instruct monitoring of the target monitoring resource in the target virtual machine.
[0141] S430: The target host machine sends an identifier of the target monitoring resource to the target virtual machine through the virtual serial port based on the monitoring request.
[0142] It should be noted that after the host machine executes the above S430, the host machine and the target virtual machine periodically execute the above S210-S290, and at the same time, the target virtual machine continuously executes the above S310-S320.
[0143] Example 2
[0144] The present application embodiment provides a method for allocating resources of a virtual machine, such as Fig.10As shown, the method includes: S510-560.
[0145] S510: The host machine sends a second acquisition request to the target virtual machine through the virtual serial port.
[0146] The second acquisition request is used to trigger the target virtual machine to execute the following S520-S550.
[0147] S520: The target virtual machine obtains the used resource amount of the target monitoring resource in response to the second acquisition request.
[0148] It should be noted that the implementation method of the above S520 is consistent with the implementation method of S220. For the specific description of S520, please refer to the above related description of S220, which will not be repeated here.
[0149] S530: The target virtual machine determines, among the target monitored resources, the resources whose used amount is greater than or equal to the first threshold as resources to be expanded.
[0150] S540: The target virtual machine determines the resources whose used resource amount is less than or equal to the second threshold among the target monitoring resources as resources to be reduced.
[0151] It should be noted that the implementation method of the above S530-S540 is similar to the implementation method of S240-S250 and S270-S280. For the specific description of S530-S540, please refer to the above related description of S240-S250 and S270-S280, which will not be repeated here.
[0152] S550: Send usage information of the target monitoring resource to the host machine through the virtual serial port.
[0153] The above usage information includes: identifiers of resources to be expanded and identifiers of resources to be reduced.
[0154] S560: The host machine expands the capacity of the resources to be expanded, and reduces the amount of the resources to be reduced.
[0155] It should be noted that the implementation method of the above S560 is consistent with the implementation method of S260 and S290. For the specific description of S560, please refer to the above related description of S260 and S290, which will not be repeated here.
[0156] In the above embodiment, the target virtual machine responds to the host sending the second acquisition request, obtains the used resource amount of the target monitoring resource, and determines the resources to be expanded and the resources to be reduced according to the used resource amount; then, the host expands the resources to be expanded and reduces the resources to be reduced. It can be seen that in this embodiment, the host is only used to expand the resources to be expanded and reduce the resources to be reduced, and the host does not need to determine the resources to be expanded and the resources to be reduced from multiple target monitoring resources, thereby reducing the utilization rate of computing resources in the host.
[0157] In addition, since the target virtual machine sends the identifiers of the resources to be expanded and the resources to be reduced to the host machine after determining the resources to be expanded and the resources to be reduced, it is not necessary to send the used resource amounts of multiple target monitoring resources to the host machine. Therefore, the load pressure of the virtual serial port between the host machine and the target virtual machine is reduced.
[0158] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0159] The embodiment of the present application can divide the resource allocation device into functional modules according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0160] In the case of dividing each functional module into corresponding functional modules, Fig.11 A possible structural diagram of the resource allocation device involved in the above embodiment is shown. Fig.11 As shown, the resource allocation device includes: a transceiver unit 1101 and a processing unit 1102.
[0161] The transceiver unit 1101 is used to obtain usage information of the to-be-monitored resources of the target virtual machine from the target virtual machine through the virtual serial port; for example, executing step S110 in the above method embodiment.
[0162] The processing unit 1102 is configured to determine, according to the usage information of the target monitoring resource, that the target monitoring resource is a resource to be adjusted; for example, to execute step S120 in the above method embodiment.
[0163] The processing unit 1102 is further configured to adjust the resource amount of the resource to be adjusted; for example, executing step S130 in the above method embodiment.
[0164] Optionally, the processing unit 1102 is specifically configured to determine the target monitoring resource as a resource to be expanded when the used resource amount of the target monitoring resource is greater than or equal to a first threshold; for example, executing steps S240-S250 in the above method embodiment.
[0165] Optionally, the processing unit 1102 is specifically configured to expand the resources to be expanded; for example, execute step S260 in the above method embodiment.
[0166] Optionally, the processing unit 1102 is specifically configured to determine the target monitoring resource as a resource to be reduced when the used resource amount of the target monitoring resource is less than or equal to a second threshold; for example, executing steps S270-S280 in the above method embodiment.
[0167] Optionally, the processing unit 1102 is specifically configured to reduce the amount of resources to be reduced; for example, executing step S290 in the above method embodiment.
[0168] Optionally, the transceiver unit 1101 is configured to send a first acquisition request to the target virtual machine through the virtual serial port; for example, executing step S210 in the above method embodiment.
[0169] The transceiver unit 1101 is further configured to obtain usage information of the target monitoring resource in response to the first acquisition request; for example, executing step S220 in the above method embodiment.
[0170] The transceiver unit 1101 is further configured to send usage information of the target monitoring resource to the host machine through the virtual serial port; for example, executing step S230 in the above method embodiment.
[0171] Optionally, the above-mentioned device further includes: a storage unit 1103; the transceiver unit 1101 obtains the current used resource amount of the target monitoring resource; for example, executes step S310 in the above-mentioned method embodiment.
[0172] The storage unit 1103 is used to update the resource database according to the current used resource amount of the target monitoring resource; for example, executing step S320 in the above method embodiment.
[0173] Optionally, the transceiver unit 1101 is used to receive a monitoring request sent by a management device; for example, execute step S420 in the above method embodiment.
[0174] The transceiver unit 1101 is further configured to send the identifier of the target monitoring resource to the target virtual machine through the virtual serial port; for example, executing step S430 in the above method embodiment.
[0175] Each unit of the resource allocation device may also be used to execute other actions in the method embodiment. All relevant contents of each step involved in the method embodiment may be referred to the functional description of the corresponding functional module and will not be repeated here.
[0176] An embodiment of the present application also provides a computing device, including a memory and a processor, wherein the memory is electrically connected to the processor; the memory is used to store program instructions, and the processor executes the program instructions to implement any one of the above-mentioned host and virtual machine execution methods.
[0177] An embodiment of the present application also provides a computing system, which includes: a management device and a computing device; the management device is connected to the computing device through a network; the computing device is used to execute any one of the methods executed by the above-mentioned host machine and virtual machine; the management device is used to send a monitoring request to the host machine, and the monitoring request includes: an identifier of the target virtual machine and an identifier of the target monitoring resource.
[0178] The embodiment of the present application also provides a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed on a computing device, the computing device executes any one of the methods executed by the host machine and the virtual machine.
[0179] For the explanation of the relevant contents and description of the beneficial effects of any of the above-mentioned computer-readable storage media, reference may be made to the above-mentioned corresponding embodiments, which will not be repeated here.
[0180] An embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute any one of the methods executed by the host machine and the virtual machine.
[0181] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) mode or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a magnetic disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state drive (SSD)).
[0182] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0183] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0184] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0185] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0186] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, or all or part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk, and other media that can store program codes.
[0187] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for allocating resources of a virtual machine, characterized in that: include: The management device obtains selected information based on the target operation of the user on the host management interface; The selected information includes: an identifier of a host machine to be monitored, an identifier of a target virtual machine to be monitored in the host machine, and an identifier of a target monitoring resource to be monitored in the target virtual machine; the host machine is managed by the management device; The management device sends a monitoring request to the host machine; the monitoring request includes: an identifier of the target virtual machine and an identifier of the target monitoring resource; The host machine sends the identifier of the target monitoring resource to the target virtual machine through the virtual serial port based on the monitoring request; The target virtual machine obtains the currently used resource amount of the target monitoring resource; The target virtual updates the used resource amount stored in the resource database according to the current used resource amount of the target monitoring resource; The host machine sends an acquisition request to the target virtual machine through the virtual serial port; The target virtual machine obtains the used resource amount of the target monitoring resource from the resource database in response to the acquisition request; The target virtual machine determines the resources whose used amount among the target monitoring resources is greater than or equal to the first threshold as resources to be expanded, and / or determines the resources whose used amount among the target monitoring resources is less than or equal to the second threshold as resources to be reduced; The target virtual machine sends usage information of the target monitoring resource to the host machine through the virtual serial port, where the usage information includes: an identifier of the resource to be expanded and / or an identifier of the resource to be reduced; The host machine determines, according to the usage information, that the target monitoring resource is a resource to be adjusted; the resource to be adjusted includes: a resource to be expanded and / or a resource to be reduced; The host machine adjusts the resource amount of the resource to be adjusted.
2. The method according to claim 1, characterized in that The host machine determines, according to the usage information, that the target monitoring resource is a resource to be adjusted, including: The host machine determines the target monitoring resource indicated by the identifier of the resource to be expanded in the usage information as the resource to be expanded; and / or; The host machine determines the target monitoring resource indicated by the identifier of the resource to be reduced in the usage information as the resource to be reduced.
3. The method according to claim 2, characterized in that The host machine adjusts the resource amount of the resource to be adjusted, including: The host machine expands the resource amount of the resource to be expanded; The host machine reduces the resource amount of the resource to be reduced.
4. A computing device, characterized in that The computing device comprises a memory and a processor; the memory and the processor are electrically connected; the memory is used to store program instructions, and the processor is used to execute the program instructions, so that the computing device implements the method according to any one of claims 1-3.
5. A computing system, characterized in that: The computing system comprises: a management device and a host machine; the management device and the host machine are connected via a network; The management device is used to obtain selected information based on a target operation of a user on the host management interface; the selected information includes: an identifier of a host to be monitored, an identifier of a target virtual machine to be monitored in the host, and an identifier of a target monitoring resource to be monitored in the target virtual machine; the host is managed by the management device; The management device is used to send a monitoring request to the host machine; the monitoring request includes: an identifier of the target virtual machine and an identifier of the target monitoring resource; The host machine is used to send the identifier of the target monitoring resource to the target virtual machine through the virtual serial port based on the monitoring request; The host machine is used to control the target virtual machine to obtain the current used resource amount of the target monitoring resource; The host machine is used to control the target virtual machine to update the used resource amount stored in the resource database according to the current used resource amount of the target monitoring resource; The host machine is used to send an acquisition request to the target virtual machine through the virtual serial port; The host machine is used to control the target virtual machine to obtain the used resource amount of the target monitoring resource from the resource database in response to the acquisition request; The host machine is used to control the target virtual machine to determine the resources whose used amount among the target monitoring resources is greater than or equal to a first threshold as resources to be expanded, and / or to determine the resources whose used amount among the target monitoring resources is less than or equal to a second threshold as resources to be reduced; The host machine is used to control the target virtual machine to send usage information of the target monitoring resource to the host machine through the virtual serial port, wherein the usage information includes: an identifier of the resource to be expanded and / or an identifier of the resource to be reduced; The host machine is used to determine, according to the usage information, that the target monitoring resource is a resource to be adjusted; the resource to be adjusted includes: a resource to be expanded and / or a resource to be reduced; The host machine is used to adjust the resource amount of the resource to be adjusted.
Citation Information
Patent Citations
Scaling a virtual machine instance
US20140058871A1