Virtual machine management method and system, electronic equipment and storage medium
By establishing a virtual queue between the virtual machine and the virtual machine simulator, high-precision operation and maintenance data and resource configuration information are directly transmitted, which solves the problem of the inability to obtain high-precision operation and maintenance data and real-time configuration in the existing technology, and realizes efficient operation and maintenance and resource management of the virtual machine.
Patent Information
- Application Number
- CN202410353466.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-26
- Publication Date
- 2025-09-26
AI Technical Summary
The operation and maintenance and configuration changes of virtual machines in the existing virtualization architecture cannot obtain high-precision operation and maintenance data, and cannot respond to task configurations with severe performance fluctuations in real time.
By establishing a virtual queue between the virtual machine and the virtual machine simulator, high-precision operation and maintenance data and resource configuration information are directly transmitted, avoiding the degradation of the accuracy of the operation and maintenance data, and realizing real-time resource configuration through the virtual queue.
It enables virtual machine operation and maintenance personnel to obtain high-precision operation and maintenance data and update resource configuration in real time to meet the needs of tasks with severe performance fluctuations, significantly improving the operation and maintenance and configuration efficiency of virtual machines.
Smart Images

Figure CN120704793A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a virtual machine management method, system, electronic device, and storage medium. Background Art
[0002] In existing virtualization architectures, virtual machine operation, maintenance, and configuration changes are typically accomplished manually by sending network control commands from the Elastic Compute Service (ECS) console to manipulate the Quick Emulator (QEMU) on the host machine. However, to reduce bandwidth and storage costs, QEMU degrades the accuracy of collected operation and maintenance data (such as processor steal time) before sending it to the ECS console. This prevents operators from obtaining high-precision operation and maintenance data. Furthermore, because virtual machine operation, maintenance, and configuration changes are network-based, real-time configuration cannot be performed for tasks with drastic performance fluctuations when the network fluctuates. Summary of the Invention
[0003] In view of the above problems, the present application provides a virtual machine management method, system, electronic device and storage medium to at least solve the technical problems in related technologies of being unable to obtain high-precision virtual machine operation and maintenance data, and to perform real-time configuration for tasks with large fluctuations in virtual machine performance.
[0004] According to the first aspect of an embodiment of the present application, a virtual machine management method is provided, which is applied to a virtual machine, and the method includes: receiving a communication message sent by an application running on the virtual machine for managing the virtual machine; writing the communication message into a virtual queue so that the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator.
[0005] According to the second aspect of an embodiment of the present application, a virtual machine management method is provided, which is applied to a virtual machine simulator, and a virtual machine is running on a host machine where the virtual machine simulator is located. The method includes: obtaining a communication message for managing the virtual machine from a virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the host machine; and executing a processing strategy corresponding to the communication message.
[0006] According to the third aspect of an embodiment of the present application, a virtual machine is provided, comprising: a receiving unit for receiving a communication message for managing the virtual machine sent by an application running on the virtual machine; a first writing unit for writing the communication message into a virtual queue so that a virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting a driver program of the virtual machine and a driver program of the virtual machine simulator.
[0007] According to the fourth aspect of an embodiment of the present application, a virtual machine simulator is provided, wherein a virtual machine is running on a host machine where the virtual machine simulator is located, and the virtual machine simulator includes: an acquisition unit for acquiring communication messages for managing the virtual machine from a virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator; and an execution unit for executing a processing strategy corresponding to the communication message.
[0008] According to the fifth aspect of the embodiment of the present application, an electronic device is also provided, including a memory, a processor, and a computer program stored on the memory and runnable on the processor, wherein the processor runs the computer program to implement the virtual machine management method of the first aspect or the second aspect mentioned above.
[0009] According to the sixth aspect of the embodiments of the present application, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the virtual machine management method of the first aspect or the second aspect mentioned above when running.
[0010] According to a seventh aspect of the embodiments of the present application, a computer program product includes a computer program, characterized in that the computer program is executed by a processor using the virtual machine management method of the first aspect or the second aspect above.
[0011] In an embodiment of the present application, a communication message for managing the virtual machine sent by an application running on the virtual machine is received; the communication message is written into a virtual queue, and the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator; the present application does not need to downgrade the accuracy of the operation and maintenance data collected by the virtual machine simulator QEMU and can send it to the operation and maintenance personnel through the virtual queue, so that the operation and maintenance personnel can obtain high-precision operation and maintenance data. Moreover, based on the method of carrying the above-mentioned communication messages through the virtual queue, the resources of the virtual machine can also be updated in real time to meet the resource requirements of tasks with severe performance fluctuations in the virtual machine, significantly improving the operation and maintenance and configuration efficiency of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference numerals are used throughout the drawings to represent the same components. In the drawings:
[0013] Figure 1 This is a schematic diagram of an application environment of an optional virtual machine management method in the related art;
[0014] Figure 2 is a flow chart of an optional virtual machine management method according to an embodiment of the present application;
[0015] Figure 3 is a schematic diagram of an application environment of another optional virtual machine management method according to an embodiment of the present application;
[0016] Figure 4 is a flowchart of another optional virtual machine management method according to an embodiment of the present application;
[0017] Figure 5 is a schematic diagram of the structure of an optional virtual machine according to an embodiment of the present application;
[0018] Figure 6 is a schematic structural diagram of an optional virtual machine simulator according to an embodiment of the present application;
[0019] Figure 7 is a schematic structural diagram of an optional virtual machine management system according to an embodiment of the present application;
[0020] Figure 8 1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
[0021] Figure 9 2 is a schematic diagram of the structure of another electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0023] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] like Figure 1 As shown, the operation and maintenance and configuration changes of virtual machines in the virtualization architecture in the related art are usually completed by manually sending network control instructions (operation and maintenance data or configuration instructions) on the cloud server (Elastic Compute Service, ECS) control end to control the virtual machine simulator (Quick Emulator, QEMU) on the host machine; however, in order to reduce bandwidth and storage costs, QEMU will downgrade the accuracy of the collected operation and maintenance data (such as processor stealing time, etc.) and send it to the ECS console, which will cause the operation and maintenance personnel to be unable to obtain high-precision operation and maintenance data; in addition, since the operation and maintenance and configuration changes of virtual machines are based on the network, when the network fluctuates, it is impossible to perform real-time configuration for tasks with drastic performance fluctuations.
[0025] In order to solve the above technical problems, as an optional implementation method, Figure 3 As shown, the embodiment of the present application provides a virtual machine management method, which is applied to a virtual machine and includes the following steps:
[0026] S202: Receive a communication message for managing the virtual machine, sent by an application running on the virtual machine.
[0027] Specifically, in the embodiments of the present application, Figure 3As shown, the application running in the virtual machine can be an application that exclusively occupies the virtual machine in the user space, such as a cloud desktop application, etc., or it can be an application that runs in multiple applications in the virtual machine and is used to manage the configuration of the virtual machine. The communication message used to manage the virtual machine includes a message header and payload data; the above-mentioned message header may include the type of message, such as the message type that requires increasing resources or the message type that requires reducing resources, and the payload data may be the number of resources increased or decreased. The type of the above-mentioned message can also be an operation and maintenance data type, such as the number of read and write operations per second (Input / Output Operations Per Second, IOPS) of the process. The virtual machine transmits the above-mentioned communication message to the driver of the kernel space of the virtual machine through the input / output channel management interface (input / output control, ioctl).
[0028] S304: Write the communication message into a virtual queue, so that the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator.
[0029] Specifically, in an embodiment of the present application, the virtual queue (Vring) for transmitting communication messages is a data link connecting the virtual machine driver and the virtual machine emulator driver. This virtual queue (Vring) can be a message queue in a paravirtualized device (Virtual Input / Output Device). After the virtual machine driver writes the communication message to the virtual queue, the virtual machine emulator (QEMU) can obtain the communication message from the virtual queue (Vring), thereby managing the virtual configuration and obtaining high-precision operation and maintenance data.
[0030] In an embodiment of the present application, a method is adopted for receiving a communication message for managing the virtual machine sent by an application running on the virtual machine; the communication message is written into a virtual queue, and the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a method for connecting the data link of the driver of the virtual machine and the driver of the virtual machine simulator; the present application does not need to downgrade the accuracy of the operation and maintenance data collected by the virtual machine simulator QEMU and can send it to the operation and maintenance personnel through the virtual queue. The operation and maintenance personnel of the virtual machine can obtain high-precision operation and maintenance data, and based on the method of carrying the above-mentioned communication messages through the virtual queue, the resources of the virtual machine can also be updated in real time to meet the task resource requirements with severe performance fluctuations in the virtual machine, and significantly improve the operation and maintenance and configuration efficiency of the virtual machine.
[0031] In one or more embodiments, the communication message carries a message type and payload data, and writing the communication message into the virtual queue includes:
[0032] A communication message body corresponding to the message type and payload data in the communication message is created, and the message body is written into the virtual queue.
[0033] Specifically, in the embodiments of the present application, Figure 3 As shown, the virtual machine driver combines the message type (message header) and payload data (Payload) of the received communication message into a message body, where the message type corresponds to the first sequence data (Sg[0]) of the message body, and the payload data is the second sequence data (Sg[1]) of the message body. The virtual machine driver then writes the message body into the virtual queue Vring.
[0034] In one or more embodiments, after receiving a message sent by an application running on the virtual machine for managing the virtual machine, the method further includes:
[0035] Determine that the communication message is received, call the driver of the virtual machine to apply for memory space from the memory of the virtual machine; and write address information corresponding to the memory space into the effective load data.
[0036] Specifically, in an embodiment of the present application, after the virtual machine receives a communication message sent by an application, the driver of the virtual machine is called to apply for memory space from the memory of the virtual machine. The memory space is a currently unused storage space. After that, the address information corresponding to the memory space applied for by the virtual machine is written into the payload data. The above address information can be passed to the virtual machine simulator QEMU through the virtual queue Vring. It should be noted that the memory space can store the operation and maintenance information (such as IOPS data) sent by the application of the virtual machine, and can also store the operation and maintenance information (such as processor stealing time) generated by the virtual machine simulator. By using this memory space, high-precision operation and maintenance data can be loaded without downgrading the accuracy of the operation and maintenance data, for example, there is no need to save bandwidth and downgrade the processor stealing time from milliseconds to seconds.
[0037] In one or more embodiments, the message type includes a first message type for indicating obtaining operation and maintenance data from a virtual machine simulator, and the method further includes:
[0038] Based on the address information corresponding to the memory space, the operation and maintenance data fed back by the virtual machine simulator for the first message type is read from the memory space.
[0039] Specifically, in an embodiment of the present application, the above-mentioned first message type can be, for example, the processor stealing time or other operation and maintenance data fed back by the virtual machine simulator for the current virtual machine. After the virtual machine simulator QEMU obtains the address information corresponding to the above-mentioned memory space from the virtual machine queue Vring, for example, the processor stealing time or other operation and maintenance data fed back by the virtual machine simulator for the current virtual machine can be written into the above-mentioned memory space, and the virtual machine can read the above-mentioned operation and maintenance data from the memory space.
[0040] In one or more embodiments, the message type includes a second message type for instructing to send operation and maintenance data to the virtual machine simulator, and the method further includes:
[0041] Based on the address information corresponding to the memory space, operation and maintenance data corresponding to the second message type is written into the memory space, so that the virtual machine simulator reads the operation and maintenance data corresponding to the second message type from the memory space.
[0042] Specifically, in an embodiment of the present application, the second message type may be, for example, the number of read and write times per second of a process in the virtual machine, or other operational data reported by the current virtual machine. Based on the address information corresponding to the memory space, the virtual machine may, for example, write the number of read and write times per second of a process, or other operational data reported by the current virtual machine, to the memory space. The virtual machine simulator may then read the operational data from the memory space based on the address information corresponding to the memory space.
[0043] In one or more embodiments, the message type includes a resource configuration type, the payload data includes resource configuration information, and creating a communication message body corresponding to the message type and payload data in the communication message includes:
[0044] Using the resource configuration type as the first sequence data and the resource configuration information as the second sequence data;
[0045] The communication message body is created based on the first sequence data and the second sequence data.
[0046] Specifically, in the embodiment of the present application, the resource configuration type may be, for example, a processor configuration type or a storage space configuration type, or a network configuration type; the resource configuration information may be, for example, an increase or decrease in the number of processors, or an increase or decrease in the size of the memory space; Figure 3As shown, the virtual machine driver uses the received resource configuration type as the first sequence data (Sg[0]) and the resource configuration information as the second sequence data (Sg[1]); and creates the communication message body based on the first sequence data Sg[0] and the second sequence data Sg[1]. When the virtual machine simulator receives the communication message body, it changes the resource configuration of the virtual machine in real time and efficiently based on the resource configuration type and resource configuration information in the message body.
[0047] In one or more embodiments, the resource configuration type includes a computing power configuration type; when a current computing power parameter of the virtual machine meets a preset overload condition, the computing power configuration type is an increase computing power type, and the resource configuration information includes a computing power increase parameter;
[0048] When the current computing power parameter satisfies a preset computing power sufficient condition, the computing power configuration type is a computing power reduction type, and the resource configuration information includes a computing power reduction parameter.
[0049] Specifically, in an embodiment of the present application, for example, if the computing power required by the application running on the current virtual machine is large and the current computing power of the virtual machine is overloaded, the virtual machine needs to transmit the type of computing power increase and the computing power increase parameters to the virtual machine simulator via the above-mentioned communication message body. The virtual machine simulator increases the computing power resources of the virtual machine based on the type of computing power increase and the computing power increase parameters. For example, if the current processor utilization of the virtual machine is greater than the preset utilization, the above-mentioned computing power configuration type is the message type of increasing the processor, and the resource configuration information includes parameters such as the number of processors to be increased.
[0050] For example, if the application running on the current virtual machine is running smoothly and the virtual machine's current computing power is sufficient, the virtual machine needs to transmit the computing power reduction type and computing power reduction parameters to the virtual machine simulator via the above communication message body. The virtual machine simulator reduces the virtual machine's computing power resources based on the computing power reduction type and computing power reduction parameters. For example, if the virtual machine's current processor utilization is less than or equal to the preset utilization rate, the computing power configuration type is the processor reduction message type, and the resource configuration information includes parameters such as the number of processors to be reduced.
[0051] As an optional implementation method, Figure 4 As shown, an embodiment of the present application provides a virtual machine management method, which is applied to a virtual machine simulator, where a virtual machine is running on a host machine where the virtual machine simulator is located, including the following steps:
[0052] S402, obtaining a communication message for managing the virtual machine from a virtual queue; the virtual queue is a data link connecting a driver of the virtual machine and a driver of the host machine;
[0053] S404: Execute a processing strategy corresponding to the communication message.
[0054] Specifically, in the embodiment of the present application, the virtual queue Vring for transmitting communication messages is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator. The virtual queue Vring can be a message queue in a paravirtualized device (Virtual I / O Device). Figure 3 As shown, after the virtual machine driver writes the communication message used to manage the virtual machine into the virtual queue, the virtual machine simulator QEMU obtains the above communication message from the virtual queue Vring to achieve control over the virtual configuration and obtain high-precision operation and maintenance data.
[0055] In an embodiment of the present application, a communication message for managing the virtual machine is obtained from a virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator; a method for executing a processing strategy corresponding to the communication message is adopted; the present application does not need to downgrade the accuracy of the operation and maintenance data collected by the virtual machine simulator QEMU and can send it to the operation and maintenance personnel through the virtual queue. The operation and maintenance personnel of the virtual machine can obtain high-precision operation and maintenance data, and based on the method of carrying the above-mentioned communication messages through the virtual queue, the resources of the virtual machine can also be updated in real time to meet the task resource requirements with severe performance fluctuations in the virtual machine, and significantly improve the operation and maintenance and configuration efficiency of the virtual machine.
[0056] In one or more embodiments, executing the processing strategy corresponding to the communication message includes:
[0057] Determining that the message type carried by the communication message is a first message type, and generating operation and maintenance data corresponding to the first message type; the first message type is used to indicate obtaining operation and maintenance data from a virtual machine simulator;
[0058] Acquire address information corresponding to the memory space from the communication message, and write operation and maintenance data corresponding to the first message type into the memory space; the memory space is the storage space applied for by the driver of the virtual machine from the memory of the virtual machine.
[0059] Specifically, in an embodiment of the present application, the above-mentioned first message type can be, for example, the processor stealing time or other operation and maintenance data fed back by the virtual machine simulator QEMU for the current virtual machine. When the virtual machine simulator QEMU obtains the above-mentioned message type as the type of operation and maintenance message obtained, and the address information corresponding to the memory space from the virtual machine queue Vring, for example, the processor stealing time or other operation and maintenance data fed back by the virtual machine simulator for the current virtual machine can be written into the memory space corresponding to the above-mentioned address information, and the virtual machine can read the above-mentioned operation and maintenance data from the memory space.
[0060] In one or more embodiments, executing the processing strategy corresponding to the communication message includes:
[0061] Determining that the message type carried by the communication message is a second message type, and obtaining address information corresponding to the memory space from the communication message; the second message type is used to indicate sending operation and maintenance data to the virtual machine simulator, and the memory space is a storage space applied for by the driver of the virtual machine from the memory of the virtual machine;
[0062] The operation and maintenance data corresponding to the second message type written by the virtual machine is read from the memory space based on the address information.
[0063] Specifically, in an embodiment of the present application, the second message type may be, for example, the number of read and write times per second of a process in a virtual machine or other operation and maintenance data fed back by the current virtual machine. The virtual machine may, based on the address information corresponding to the memory space, write the number of read and write times per second of a process or other operation and maintenance data fed back by the current virtual machine into the memory space. When the message type of the communication message received by the virtual machine simulator is the type of operation and maintenance data fed back by the current virtual machine, the address information corresponding to the memory space is obtained from the communication message. The virtual machine simulator may then read from the memory space, based on the address information corresponding to the memory space, the operation and maintenance data corresponding to the second message type written by the virtual machine.
[0064] In one or more embodiments, executing the processing strategy corresponding to the communication message further includes:
[0065] Determining a resource configuration type corresponding to the communication message;
[0066] The configuration of the virtual machine is updated according to the resource configuration type and the resource configuration information carried in the communication message.
[0067] In an embodiment of the present application, for example, if the application running on the current virtual machine requires a large number of resources, the virtual machine will increase the resource type and resource increase parameters through the above-mentioned communication message body to the virtual machine simulator, and the virtual machine simulator will increase the resources required by the virtual machine according to the resource configuration type and resource increase parameters.
[0068] For example, if the application running on the current virtual machine runs smoothly and the current resource utilization of the virtual machine is low, the virtual machine will reduce the resource type and resource reduction parameters through the above communication message body to the virtual machine simulator. The virtual machine simulator will reduce the resources required by the virtual machine according to the resource configuration type and resource reduction parameters.
[0069] In one or more embodiments, the resource configuration type includes a computing power configuration type, the resource configuration information includes a computing power increase parameter or a computing power decrease parameter, and updating the configuration of the virtual machine according to the resource configuration type and the configuration information of the computing power resource carried by the communication message includes:
[0070] Determine that the resource configuration type of the communication message is a computing power configuration type, and increase the computing power resources of the virtual machine according to the computing power increase parameter; or, reduce the computing power resources of the virtual machine according to the computing power reduction parameter.
[0071] Specifically, in an embodiment of the present application, for example, if the computing power required by the application running on the current virtual machine is large and the current computing power of the virtual machine is overloaded, the virtual machine needs to transmit the type of computing power increase and the computing power increase parameters to the virtual machine simulator via the above-mentioned communication message body. The virtual machine simulator increases the computing power resources of the virtual machine based on the type of computing power increase and the computing power increase parameters. For example, if the current processor utilization of the virtual machine is greater than the preset utilization, the above-mentioned computing power configuration type is the message type of increasing the processor, and the resource configuration information includes parameters such as the number of processors to be increased.
[0072] For example, if the application running on the current virtual machine is running smoothly and the virtual machine's current computing power is sufficient, the virtual machine needs to transmit the computing power reduction type and computing power reduction parameters to the virtual machine simulator via the above communication message body. The virtual machine simulator reduces the virtual machine's computing power resources based on the computing power reduction type and computing power reduction parameters. If the current processor utilization of the virtual machine is less than or equal to the preset utilization, the computing power configuration type is the message type for reducing processors, and the resource configuration information includes parameters such as the number of processors to be reduced.
[0073] Based on the above embodiment, in an application embodiment, if Figure 3As shown in Figure 1, the application architecture of the virtual machine management method consists of three parts: (1) the application running in the user space of the guest virtual machine (Guest VM); (2) the driver running in the kernel space of the Guest VM; and (3) the virtual machine emulator QEMU running on the host. The Guest VM communicates with the corresponding virtualization driver based on the peripheral component interconnect (PCI) bus, namely the Virtio-pci device.
[0074] The user space application passes a communication message (ioctl cmd message) to the kernel space through the input / output channel control interface (ioctl) ioctl interface. The communication message consists of two parts:
[0075] 1. Message header: fixed 8 bytes, used to mark the type of this message;
[0076] 2. Payload data: of variable length, used to transmit the actual payload information of the message, such as operation and maintenance data or configuration parameters.
[0077] The communication message is passed to the virtual machine controller QEMU on the host through the virtual queue Vring on the kernel space side. The specific process includes: forming the communication message into a message body Sgs (sg[0] and sg[1]), writing the message body Sgs into Vring, adding a buffer to Vring through the vq_add_buff function, and then notifying the virtual machine emulator QEMU on the host to process the message through the Kick function.
[0078] The kernel-space driver transmits messages synchronously. After sending a message, the kernel-space driver blocks subsequent messages until it receives a return value from the virtual machine emulator (QEMU). Only then will it write a second message. When a message arrives at QEMU, QEMU extracts the message and, depending on the message type contained in the header, invokes different processing logic. Finally, it writes the return value to the Vring.
[0079] 2. Operation and maintenance solutions based on communication architecture include:
[0080] 1. In the guest virtual machine, the driver applies for a piece of memory space with continuous addresses;
[0081] 2. The guest virtual machine writes the address and storage capacity of the memory space into the payload data of the communication message, and further passes it to the virtual machine emulator QEMU through Vring.
[0082] Reading and writing operation and maintenance information on the guest virtual machine side: GuestVM writes the information required by QEMU (such as the IOPS of the process in the guest virtual machine) to the agreed location of the memory space, and can also read the operation and maintenance information written by QEMU from the agreed location.
[0083] QEMU reads and writes operation and maintenance information: QEMU writes the operation and maintenance information required by the guest virtual machine (such as processor steal time) to the agreed memory location, and can also read the operation and maintenance information written by the guest virtual machine from the agreed location.
[0084] Through the above technical means, this application can enable the guest virtual machine and the host machine to directly read and write original high-precision and highly effective operation and maintenance data, and realize the exchange of operation and maintenance data through memory mapping, thereby reducing message latency.
[0085] 3. Configuration solutions based on communication architecture include:
[0086] The guest VM informs the virtual machine simulator of its required resources through the above communication framework. The virtual machine simulator dynamically allocates resources to the guest VM according to the policy. The following example uses the processor as an example:
[0087] When an application in a guest VM is running low on computing power, it requests processing resources by sending a message to QEMU, requesting an increase in the number of processors. The message type is stored in the header, and the number of processors requested is stored in the payload. Upon receiving the message, QEMU increases the number of processors in the guest VM based on the number of processors in the payload.
[0088] When applications in a guest VM are running smoothly, they can request processing resources by sending a "reduce processor count" message to QEMU. The message type is stored in the header, and the number of processors requested is stored in the payload. Upon receiving the message, QEMU reduces the number of processors in the guest VM based on the number of processors in the payload.
[0089] Through the above technical means, the present application can realize the real-time resource configuration requirements of the guest virtual machine, and can perform real-time configuration for tasks with severe performance fluctuations of the guest virtual machine.
[0090] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0091] According to another aspect of the embodiment of the present application, a virtual machine for implementing the above virtual machine management method is also provided, such as Figure 5 As shown, the virtual machine includes:
[0092] The receiving unit 502 is configured to receive a communication message sent by an application running on the virtual machine for managing the virtual machine;
[0093] The first writing unit 504 is used to write the communication message into a virtual queue so that the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator.
[0094] In an embodiment of the present application, a method is adopted for receiving a communication message for managing the virtual machine sent by an application running on the virtual machine; the communication message is written into a virtual queue, and the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a method for connecting the data link of the driver of the virtual machine and the driver of the virtual machine simulator; the present application does not need to downgrade the accuracy of the operation and maintenance data collected by the virtual machine simulator QEMU and can send it to the operation and maintenance personnel through the virtual queue. The operation and maintenance personnel of the virtual machine can obtain high-precision operation and maintenance data, and based on the method of carrying the above-mentioned communication messages through the virtual queue, the resources of the virtual machine can also be updated in real time to meet the task resource requirements with severe performance fluctuations in the virtual machine, and significantly improve the operation and maintenance and configuration efficiency of the virtual machine.
[0095] In one or more embodiments, the communication message carries a message type and payload data, and the first writing unit 504 includes:
[0096] A creation module is used to create a communication message body corresponding to the message type and payload data in the communication message, and write the message body into the virtual queue.
[0097] In one or more embodiments, the virtual machine further includes:
[0098] a storage space application unit, configured to determine receipt of the communication message and call a driver of the virtual machine to apply for memory space from a memory of the virtual machine;
[0099] The second writing unit is used to write the address information corresponding to the memory space into the effective load data.
[0100] In one or more embodiments, the message type includes a first message type for indicating obtaining operation and maintenance data from a virtual machine simulator, and the virtual machine further includes:
[0101] A reading unit is used to read the operation and maintenance data fed back by the virtual machine simulator for the first message type from the memory space based on address information corresponding to the memory space.
[0102] In one or more embodiments, the message type includes a second message type for instructing to send operation and maintenance data to a virtual machine simulator, and the virtual machine further includes:
[0103] The third writing unit is used to write the operation and maintenance data corresponding to the second message type into the memory space based on the address information corresponding to the memory space, so that the virtual machine simulator reads the operation and maintenance data corresponding to the second message type from the memory space.
[0104] In one or more embodiments, the message type includes a resource configuration type, the payload data includes resource configuration information, and the creation module includes:
[0105] a processing subunit, configured to use the resource configuration type as a first sequence of data and the resource configuration information as a second sequence of data;
[0106] A creating subunit is used to create the communication message body based on the first sequence data and the second sequence data.
[0107] In one or more embodiments, in the virtual machine, the resource configuration type includes a computing power configuration type;
[0108] When the current computing power parameter of the virtual machine meets the preset overload condition, the computing power configuration type is an increase computing power type, and the resource configuration information includes computing power increase parameters;
[0109] When the current computing power parameter satisfies a preset computing power sufficient condition, the computing power configuration type is a computing power reduction type, and the resource configuration information includes a computing power reduction parameter.
[0110] According to another aspect of the embodiment of the present application, a virtual machine simulator for implementing the above virtual machine management method is also provided. Figure 6As shown, the virtual machine simulator includes:
[0111] An acquiring unit 602 is configured to acquire a communication message for managing the virtual machine from a virtual queue, wherein the virtual queue is a data link connecting a driver of the virtual machine and a driver of the virtual machine simulator;
[0112] The execution unit 604 is configured to execute the processing strategy corresponding to the communication message.
[0113] In an embodiment of the present application, a communication message for managing the virtual machine is obtained from a virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator; a method for executing a processing strategy corresponding to the communication message is adopted; the present application does not need to downgrade the accuracy of the operation and maintenance data collected by the virtual machine simulator QEMU and can send it to the operation and maintenance personnel through the virtual queue. The operation and maintenance personnel of the virtual machine can obtain high-precision operation and maintenance data, and based on the method of carrying the above-mentioned communication messages through the virtual queue, the resources of the virtual machine can also be updated in real time to meet the task resource requirements with severe performance fluctuations in the virtual machine, and significantly improve the operation and maintenance and configuration efficiency of the virtual machine.
[0114] In one or more embodiments, the execution unit 604 includes:
[0115] A determination generating module, configured to determine that the message type carried by the communication message is a first message type, and generate operation and maintenance data corresponding to the first message type; the first message type is used to indicate that the operation and maintenance data is obtained from the virtual machine simulator;
[0116] An acquisition module is used to obtain address information corresponding to the memory space from the communication message and write the operation and maintenance data corresponding to the first message type into the memory space; the memory space is the storage space applied for by the driver of the virtual machine from the memory of the virtual machine.
[0117] In one or more embodiments, the execution unit 604 includes:
[0118] A determination acquisition module is configured to determine that the message type carried by the communication message is a second message type, and obtain address information corresponding to the memory space from the communication message; the second message type is used to indicate that operation and maintenance data is sent to the virtual machine simulator, and the memory space is a storage space applied for by the driver of the virtual machine from the memory of the virtual machine;
[0119] A writing module is used to read the operation and maintenance data corresponding to the second message type written by the virtual machine from the memory space based on the address information.
[0120] In one or more embodiments, the execution unit 604 includes:
[0121] A determination module, configured to determine a resource configuration type corresponding to the communication message;
[0122] The configuration update module is used to update the configuration of the virtual machine according to the resource configuration type and the resource configuration information carried in the communication message.
[0123] In one or more embodiments, the resource configuration type includes a computing power configuration type, the resource configuration information includes a computing power increase parameter or a computing power decrease parameter, and the update configuration module includes:
[0124] An increasing subunit is used to determine that the resource configuration type of the communication message is a computing power configuration type, and to increase the computing power resources of the virtual machine according to the computing power increase parameter; or, a decreasing subunit is used to reduce the computing power resources of the virtual machine according to the computing power reduction parameter.
[0125] According to another aspect of the embodiment of the present application, a virtual machine management system for implementing the above virtual machine management method is also provided. Figure 7 As shown, the system includes: a virtual machine and a virtual machine simulator corresponding to the virtual machine;
[0126] The virtual machine is configured to receive a communication message for managing the virtual machine sent by an application running on the virtual machine; write the communication message into a virtual queue so that the virtual machine simulator obtains the communication message from the virtual queue; the virtual queue is a data link connecting a driver of the virtual machine and a driver of the virtual machine simulator;
[0127] The virtual machine simulator is used to obtain a communication message for controlling the virtual machine from the virtual queue; and execute a processing strategy corresponding to the communication message.
[0128] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned virtual machine management method is also provided. The electronic device can be a virtual machine or a virtual machine simulator as shown in the above example. This embodiment is described by taking the electronic device as a virtual machine as an example. Figure 8 As shown, the electronic device includes a memory 802 and a processor 804. The memory 802 stores a computer program, and the processor 804 is configured to execute the steps in any of the above method embodiments through the computer program.
[0129] Optionally, in this embodiment, the electronic device may be at least one network device among a plurality of network devices of a computer network.
[0130] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0131] S11, receiving a communication message sent by an application running on the virtual machine for managing the virtual machine;
[0132] S12, writing the communication message into a virtual queue, so that the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator.
[0133] Among them, the memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the virtual machine management method and device in the embodiments of the present application. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, that is, implementing the above-mentioned virtual machine management method. The memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include a memory remotely located relative to the processor 804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. Among them, the memory 802 can specifically be used, but is not limited to, to store communication messages sent by applications running in the virtual machine.
[0134] As an example, Figure 8 As shown, the memory 802 may include, but is not limited to, the receiving unit 502 and the first writing unit 504 in the virtual machine management apparatus. In addition, it may also include, but is not limited to, other module units in the virtual machine, which will not be described in detail in this example.
[0135] Optionally, the transmission device 806 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 806 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 806 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0136] In addition, the electronic device further includes: a connection bus 808 for connecting various module components in the electronic device.
[0137] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned virtual machine management method is also provided. The electronic device may be a virtual machine or a virtual machine simulator as shown in the above-mentioned example. This embodiment is described by taking the electronic device as a virtual machine simulator as an example. Figure 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0138] Optionally, in this embodiment, the electronic device may be at least one network device among a plurality of network devices of a computer network.
[0139] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0140] S21, obtaining a communication message for managing the virtual machine from a virtual queue; the virtual queue is a data link connecting a driver of the virtual machine and a driver of the virtual machine simulator;
[0141] S22: Execute a processing strategy corresponding to the communication message.
[0142] Among them, the memory 902 can be used to store software programs and modules, such as the program instructions / modules corresponding to the virtual machine management method and device in the embodiments of the present application. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, that is, implementing the above-mentioned virtual machine management method. The memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely located relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. Among them, the memory 902 can be specifically, but not limited to, used to store communication messages for managing the virtual machine.
[0143] As an example, Figure 9 As shown, the memory 902 may include, but is not limited to, the acquisition unit 602 and the execution unit 604 in the virtual machine simulator. In addition, it may also include, but is not limited to, other module units in the virtual machine simulator, which will not be described in detail in this example.
[0144] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the network may include wired networks and wireless networks. In one embodiment, the transmission device 906 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0145] In addition, the electronic device further includes: a connection bus 908 for connecting various module components in the electronic device.
[0146] In other embodiments, the electronic device may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting multiple nodes via network communication. The nodes may form a peer-to-peer (P2P) network, and any computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0147] In one or more embodiments, the present application further provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned virtual machine management method. The computer program is configured to execute the steps of any of the aforementioned method embodiments when executed.
[0148] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0149] S11, receiving a communication message sent by an application running on the virtual machine for managing the virtual machine;
[0150] S12, writing the communication message into a virtual queue so that the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator. A computer program is also used to perform the following steps:
[0151] S21, obtaining a communication message for managing the virtual machine from a virtual queue; the virtual queue is a data link connecting a driver of the virtual machine and a driver of the virtual machine simulator;
[0152] S22: Execute a processing strategy corresponding to the communication message.
[0153] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0154] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0155] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing one or more computer devices (such as personal computers, servers, or network devices) to execute all or part of the steps of the methods of various embodiments of the present invention.
[0156] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is merely a logical functional division. In actual implementation, there may be other division methods, such as combining or integrating multiple units or components into another system, or ignoring or not implementing some features. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interface, indirect coupling or communication connection of units or modules, and may be electrical or other forms.
[0158] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0159] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0160] The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
[0161] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
Claims
1. A virtual machine management method, characterized in that: Applied to a virtual machine, the method includes: receiving a communication message for managing the virtual machine sent by an application running on the virtual machine; The communication message is written into a virtual queue, so that the virtual machine simulator corresponding to the virtual machine obtains the communication message from the virtual queue; the virtual queue is a data link connecting the driver of the virtual machine and the driver of the virtual machine simulator.
2. The method according to claim 1, characterized in that The communication message carries a message type and payload data, and the writing of the communication message into the virtual queue includes: A communication message body corresponding to the message type and payload data in the communication message is created, and the message body is written into the virtual queue.
3. The method according to claim 2, characterized in that After receiving the information sent by the application running on the virtual machine for managing the virtual machine, the method further includes: Determining that the communication message is received, and calling a driver of the virtual machine to apply for memory space from a memory of the virtual machine; The address information corresponding to the memory space is written into the payload data.
4. The method according to claim 3, characterized in that The message type includes a first message type for indicating obtaining operation and maintenance data from a virtual machine simulator, and the method further includes: Based on the address information corresponding to the memory space, the operation and maintenance data fed back by the virtual machine simulator for the first message type is read from the memory space.
5. The method according to claim 3, characterized in that The message type includes a second message type for instructing to send operation and maintenance data to the virtual machine simulator, and the method further includes: Based on the address information corresponding to the memory space, operation and maintenance data corresponding to the second message type is written into the memory space, so that the virtual machine simulator reads the operation and maintenance data corresponding to the second message type from the memory space.
6. The method according to any one of claims 2 to 5, characterized in that: The message type includes a resource configuration type, the payload data includes resource configuration information, and the creating a communication message body corresponding to the message type and payload data in the communication message includes: Using the resource configuration type as the first sequence data and the resource configuration information as the second sequence data; The communication message body is created based on the first sequence data and the second sequence data.
7. The method according to claim 6, characterized in that The resource configuration type includes a computing power configuration type; When the current computing power parameter of the virtual machine meets the preset overload condition, the computing power configuration type is an increase computing power type, and the resource configuration information includes computing power increase parameters; When the current computing power parameter satisfies the preset computing power sufficient condition, the computing power configuration type is a computing power reduction type, and the resource configuration information includes a computing power reduction parameter.
8. A virtual machine management method, characterized in that: Applied to a virtual machine simulator, where a virtual machine is running on a host machine where the virtual machine simulator is located, the method includes: Acquire a communication message for managing the virtual machine from a virtual queue; the virtual queue is a data link connecting a driver of the virtual machine and a driver of the virtual machine simulator; Execute the processing strategy corresponding to the communication message.
9. The method according to claim 8, characterized in that The executing a processing strategy corresponding to the communication message includes: Determining that the message type carried by the communication message is a first message type, and generating operation and maintenance data corresponding to the first message type; the first message type is used to indicate obtaining operation and maintenance data from a virtual machine simulator; Acquire address information corresponding to the memory space from the communication message, and write operation and maintenance data corresponding to the first message type into the memory space; the memory space is the storage space applied for by the driver of the virtual machine from the memory of the virtual machine.
10. The method according to claim 8, characterized in that The executing a processing strategy corresponding to the communication message includes: Determining that the message type carried by the communication message is a second message type, and obtaining address information corresponding to the memory space from the communication message; the second message type is used to indicate sending operation and maintenance data to the virtual machine simulator, and the memory space is a storage space applied for by the driver of the virtual machine from the memory of the virtual machine; The operation and maintenance data corresponding to the second message type written by the virtual machine is read from the memory space based on the address information.
11. The method according to claim 8, characterized in that The executing of the processing strategy corresponding to the communication message further includes: Determining a resource configuration type corresponding to the communication message; The configuration of the virtual machine is updated according to the resource configuration type and the resource configuration information carried in the communication message.
12. The method according to claim 11, characterized in that The resource configuration type includes a computing power configuration type, the resource configuration information includes a computing power increase parameter or a computing power decrease parameter, and updating the configuration of the virtual machine according to the resource configuration type and the configuration information of the computing power resource carried in the communication message includes: Determine that the resource configuration type of the communication message is a computing power configuration type, and increase the computing power resources of the virtual machine according to the computing power increase parameter; or, reduce the computing power resources of the virtual machine according to the computing power reduction parameter.
13. A virtual machine management system, characterized in that: including a virtual machine and a virtual machine simulator corresponding to the virtual machine; The virtual machine is configured to receive a communication message for managing the virtual machine sent by an application running on the virtual machine; write the communication message into a virtual queue so that the virtual machine simulator obtains the communication message from the virtual queue; the virtual queue is a data link connecting a driver of the virtual machine and a driver of the virtual machine simulator; The virtual machine simulator is used to obtain a communication message for managing the virtual machine from the virtual queue; and execute a processing strategy corresponding to the communication message.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: The processor runs the computer program to implement the method according to any one of claims 1 to 7, or 8 to 12.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method according to any one of claims 1 to 7 or 8 to 12.
16. A computer program product comprising a computer program, characterized in that The computer program is executed by a processor to implement the method according to any one of claims 1 to 7, or 8 to 12.