Process management method and device of virtual machine architecture, electronic equipment and storage medium
By introducing IO transmission management services into the virtual machine architecture, monitoring virtual machine management events and managing IO transmission processes, the IO transmission process management problem in virtualization technology is solved and the stable operation of the system is achieved.
Patent Information
- Application Number
- CN202411829101.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-03-21
AI Technical Summary
In the disaster recovery strategy of virtualization technology, how to efficiently manage a large number of IO transmission processes without affecting the operation of the original virtual machine to ensure the stable operation of the system.
By introducing IO transmission management services into the virtual machine architecture, communication and connection with the virtualization management services, monitoring virtual machine management events, determining the target virtual machine process and its status, and managing the life cycle and communication of the target IO transmission process.
It realizes separate management of IO transmission processes in the virtual machine architecture, manages IO transmission processes reasonably and effectively, ensures the stable operation of the system, and solves the problem of difficult management of IO transmission processes in traditional technology.
Smart Images

Figure CN119668783A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of virtualization technology, and in particular to a process management method for a virtual machine architecture, and also to a process management device, an electronic device, and a computer-readable storage medium for a virtual machine architecture. Background Art
[0002] In the disaster recovery strategy of virtualization technology, an important link is to use memory reasonably to efficiently obtain IO data from the qemu (an open source simulator and virtual machine monitor, i.e., virtual machine process) process without affecting the operation of the original virtual machine. In order to transmit this data, one or more IO transmission service processes cdpwork (a disaster recovery service program, i.e., IO transmission process) will be started for each virtual machine. However, for cloud platform services, there will be hundreds of virtual machines, and each virtual machine has one or more disks. Therefore, a large number of cdpwork processes may be generated under a certain disaster recovery solution. If there is no mechanism to manage these processes, unpredictable consequences will occur.
[0003] Therefore, how to reasonably and effectively manage the IO transmission process in the virtual machine architecture to effectively ensure the stable operation of the system is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0004] The purpose of the present application is to provide a process management method for a virtual machine architecture, which can reasonably and effectively manage the IO transmission process in the virtual machine architecture to effectively ensure the stable operation of the system; another purpose of the present application is to provide a process management device, electronic device, computer-readable storage medium and computer program product for a virtual machine architecture, all of which have the above-mentioned beneficial effects.
[0005] In a first aspect, the present application provides a process management method for a virtual machine architecture, which is applied to an IO transmission management service, wherein the IO transmission management service is communicatively connected to a virtualization management service, wherein the IO transmission management service is communicatively connected to each IO transmission process, and wherein the virtualization management service is communicatively connected to each virtual machine process, wherein the method comprises:
[0006] Performing event monitoring on the virtualization management service to obtain virtual machine management events; the virtual machine management events are obtained by the virtualization management service performing event monitoring on each virtual machine process;
[0007] Determine a target virtual machine process and a process state of the target virtual machine process according to the virtual machine management event;
[0008] A target IO transmission process of a target virtual machine to which the target virtual machine process belongs is determined, and the target IO transmission process is managed according to a process state of the target virtual machine process.
[0009] Optionally, managing the target IO transmission process according to the process state of the target virtual machine process includes:
[0010] When the process state of the target virtual machine process is that the target virtual machine is started or the target virtual machine is running, creating the target IO transmission process;
[0011] When the process state of the target virtual machine process is that the target virtual machine is shut down or the target virtual machine is abnormal, destroying the target IO transmission process;
[0012] When the process state of the target virtual machine process is to query the target virtual machine, the process state of the target IO transmission process is queried.
[0013] Optionally, after determining the target IO transmission process of the target virtual machine to which the target virtual machine process belongs, and managing the target IO transmission process according to the process state of the target virtual machine process, the method further includes:
[0014] Determine a target callback function according to the virtual machine management event; the target callback function is a callback function for creating the target IO transmission process, or a callback function for destroying the target IO transmission process, or a callback function for querying the target IO transmission process;
[0015] The target callback function is executed to feed back the management result of the target IO transmission process to the virtualization management service.
[0016] Optionally, when the target callback function is a callback function for creating the target IO transfer process, executing the target callback function to feed back the management result of the target IO transfer process to the virtualization management service includes:
[0017] Executing the callback function to feed back the process information of the target IO transfer process and the shared memory descriptor corresponding to the target IO transfer process to the virtualization management service, so that the virtualization management service feeds back the shared memory descriptor corresponding to the target IO transfer process to the target virtual machine process;
[0018] Accordingly, determining the target IO transmission process of the target virtual machine to which the target virtual machine process belongs includes:
[0019] When the target callback function is a callback function for creating the target IO transfer process, determining the target virtual machine to which the target virtual machine process belongs, so as to execute the step of creating the target IO transfer process;
[0020] When the target callback function is a callback function for destroying the target IO transmission process, or a callback function for querying the target IO transmission process, the target IO transmission process of the target virtual machine to which the target virtual machine process belongs is determined according to the shared memory descriptor in the virtual machine management event.
[0021] Optionally, after creating the target IO transmission process, the process further includes:
[0022] Determine whether the target virtual machine has an existing IO transmission process;
[0023] If the target virtual machine has the original IO transmission process, it is determined whether to close the original IO transmission process according to the IO pressure of the target virtual machine.
[0024] Optionally, the process information of the target IO transfer process includes a combination of one or more of the process name of the target IO transfer process, the process identifier of the target IO transfer process, the virtual machine information of the target virtual machine to which the target IO transfer process belongs, the shared memory descriptor corresponding to the target IO transfer process, the memory information of the shared memory corresponding to the target IO transfer process, and the file descriptor used by the target IO transfer process to communicate with other IO transfer processes.
[0025] Optionally, performing event monitoring on the virtualization management service to obtain virtual machine events includes:
[0026] Event monitoring is performed on the virtualization management service according to a preset time cycle mechanism to obtain the virtual machine event.
[0027] In a second aspect, the present application further discloses a process management device for a virtual machine architecture, which is applied to an IO transmission management service, wherein the IO transmission management service is communicatively connected to a virtualization management service, wherein the IO transmission management service is communicatively connected to each IO transmission process, and wherein the virtualization management service is communicatively connected to each virtual machine process, wherein the device comprises:
[0028] A monitoring module, used to monitor the virtualization management service for events and obtain virtual machine management events; the virtual machine management events are obtained by the virtualization management service performing event monitoring on each virtual machine process;
[0029] A determination module, configured to determine a target virtual machine process and a process state of the target virtual machine process according to the virtual machine management event;
[0030] The management module is used to determine the target IO transmission process of the target virtual machine to which the target virtual machine process belongs, and manage the target IO transmission process according to the process state of the target virtual machine process.
[0031] In a third aspect, the present application further discloses an electronic device, comprising:
[0032] Memory for storing computer programs;
[0033] A processor is used to implement the steps of the process management method of any virtual machine architecture as described above when executing the computer program.
[0034] In a fourth aspect, the present application further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the process management method of any virtual machine architecture as described above are implemented.
[0035] In a fifth aspect, the present invention further discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the process management method of any virtual machine architecture as described above.
[0036] The present application provides a process management method for a virtual machine architecture, which is applied to an IO transmission management service, wherein the IO transmission management service is communicatively connected to a virtualization management service, the IO transmission management service is communicatively connected to each IO transmission process, and the virtualization management service is communicatively connected to each virtual machine process. The method comprises: performing event monitoring on the virtualization management service to obtain virtual machine management events; the virtual machine management events are obtained by the virtualization management service performing event monitoring on each virtual machine process; determining a target virtual machine process and a process state of the target virtual machine process according to the virtual machine management events; determining a target IO transmission process of a target virtual machine to which the target virtual machine process belongs, and managing the target IO transmission process according to the process state of the target virtual machine process.
[0037] By applying the technical solution provided in the present application, an IO transmission management service is constructed to communicate with the virtualization management service. The IO transmission management service is used to manage each IO transmission process in the virtual machine architecture. The virtualization management service is used to manage each virtual machine process in the virtual machine architecture. The virtual machine management events generated by each virtual machine process are monitored by the virtualization management service and transmitted to the IO transmission management service. The IO transmission management service manages the IO transmission process of the virtual machine to which the virtual machine process belongs according to the virtual machine management events, thereby solving the problem of difficulty in managing IO transmission processes created in the virtualization management service in traditional technologies. It can be seen that the present technical solution realizes the separate management of IO transmission processes in the virtual machine architecture by constructing the IO transmission management service, thereby realizing the reasonable and effective management of IO transmission processes in the virtual machine architecture, and further ensuring the stable operation of the system.
[0038] In one embodiment of the present application, after creating a target IO transfer process for a target virtual machine, it can be determined whether the target virtual machine has an original IO transfer process, that is, a virtual machine can correspond to one or more IO transfer processes for implementing IO transfer services. On this basis, when a virtual machine corresponds to multiple IO transfer processes, it can be determined whether to close the original IO transfer process based on the actual IO pressure of the virtual machine. Obviously, when the actual IO pressure of the target virtual machine is large, the original IO transfer process may not be closed; when the actual IO pressure of the target virtual machine is small, the original IO transfer process may be closed. In this way, effective management of the IO transfer process based on the actual load of the virtual machine is achieved. Furthermore, when the original IO transfer process is closed, thermal shrinkage of the shared memory corresponding to the target virtual machine can also be achieved.
[0039] The process management device, electronic device, computer-readable storage medium and computer program product of the virtual machine architecture provided in this application also have the above-mentioned technical effects, and this application will not repeat them here. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.
[0041] Figure 1 A schematic diagram of the structure of a virtual machine architecture provided in this application;
[0042] Figure 2A flowchart of a process management method for a virtual machine architecture provided in this application;
[0043] Figure 3 A schematic diagram of the principle of integrating IO transmission management services in a virtual machine architecture provided by this application;
[0044] Figure 4 A schematic diagram of the structure of another virtual machine architecture provided by this application;
[0045] Figure 5 A distribution diagram of the association relationship between IO transmission processes provided by this application;
[0046] Figure 6 A schematic diagram of the principle of creating an IO transmission process provided by this application;
[0047] Figure 7 A schematic diagram of a multi-IO transmission process using the same shared memory provided by this application;
[0048] Figure 8 A schematic diagram of the structure of a process management device for a virtual machine architecture provided by the present application;
[0049] Fig. 9 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION
[0050] The core of the present application is to provide a process management method for a virtual machine architecture, which can reasonably and effectively manage the IO transmission process in the virtual machine architecture to effectively ensure the stable operation of the system; another core of the present application is to provide a process management device, electronic device, computer-readable storage medium and computer program product for a virtual machine architecture, all of which have the above-mentioned beneficial effects.
[0051] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0052] An embodiment of the present application provides a process management method for a virtual machine architecture.
[0053] First, please refer to Figure 1 , Figure 1The schematic diagram of the structure of a virtual machine architecture provided by the present application includes an IO transmission management service and a virtualization management service, which can be connected to each other in communication, wherein the IO transmission management service is connected to each IO transmission process in communication with each IO transmission process to implement the management of each IO transmission process; the virtualization management service is connected to each virtual machine process in communication with each virtual machine process to implement the management of each virtual machine process. The process management method of the virtual machine architecture provided in the embodiment of the present application is based on Figure 1 The virtual machine architecture shown is implemented.
[0054] For further information, please refer to Figure 2 , Figure 2 A flowchart of a process management method for a virtual machine architecture provided in this application, wherein the process management method for the virtual machine architecture is applied to Figure 1 The IO transmission management service shown may include the following S101 to S103.
[0055] S101: Monitor events of a virtualization management service to obtain virtual machine management events; the virtual machine management events are obtained by the virtualization management service performing event monitoring on each virtual machine process.
[0056] This step aims to realize event monitoring of each virtual machine process through the virtual virtualization management service, and then realize the acquisition of virtual machine management events corresponding to each virtual machine process by the IO transmission management service. As mentioned above, the IO transmission management service and the virtualization management service can be connected in communication, the IO transmission management service is used to realize the management of each IO transmission process, and the virtualization management service is used to realize the management of each virtual machine process. Therefore, the virtualization management service can monitor and obtain the virtual machine management events corresponding to each virtual machine process, and send them to the IO transmission management service, so that the IO transmission management service can manage the IO transmission processes corresponding to each virtual machine process. It can be understood that virtual machine management events can include but are not limited to the creation, closing, destruction and status query of the IO transmission process corresponding to the virtual machine process.
[0057] In one embodiment of the present application, performing event monitoring on a virtualization management service to obtain virtual machine events may include: performing event monitoring on a virtualization management service according to a preset time cycle mechanism to obtain virtual machine events.
[0058] The process management method of the virtual machine architecture provided in the embodiment of the present application can automatically respond to preset timing conditions for the process management operation of the virtual machine architecture. Specifically, it can be implemented based on a preset time loop mechanism, wherein the specific value of the time interval of the preset time loop does not affect the implementation of the present technical solution, and can be set by technical personnel according to actual needs, and the present application does not limit this.
[0059] S102: Determine a target virtual machine process and a process state of the target virtual machine process according to the virtual machine management event.
[0060] This step is intended to determine the target virtual machine process and its process state. It is understandable that the number of virtual machine processes in the virtual machine architecture is not unique, and the same virtual machine process will also generate different virtual machine management events. Therefore, when a virtual machine management event is monitored, the target virtual machine process corresponding to the virtual machine management event can be determined first, that is, the virtual machine process in the virtual machine architecture that generates the virtual machine management event, and its state information, that is, the process state of the above-mentioned target virtual machine process, can be obtained at the same time, so that the corresponding IO transmission process management can be implemented later with reference to the process state of the target virtual machine process.
[0061] S103: Determine a target IO transmission process of a target virtual machine to which the target virtual machine process belongs, and manage the target IO transmission process according to a process state of the target virtual machine process.
[0062] This step aims to achieve the determination of the target IO transfer process and its effective management. It should be noted that the IO transfer process in the virtual machine architecture is mainly used to realize the IO data transmission of the corresponding virtual machine. A virtual machine can correspond to one or more IO transfer processes. On this basis, after determining the target virtual machine process and its process status, the target virtual machine to which the target virtual machine process belongs can be further determined, and then the corresponding target IO transfer process can be determined. Of course, the target IO transfer process can be all or part of the IO transfer process of the target virtual machine, which is determined by the virtual machine management event. In this way, the target IO transfer process can be managed with reference to the process status of the target virtual machine process.
[0063] In one embodiment of the present application, managing the target IO transmission process according to the process state of the target virtual machine process may include:
[0064] When the process state of the target virtual machine process is the target virtual machine starting or the target virtual machine running, a target IO transmission process is created;
[0065] When the process state of the target virtual machine process is that the target virtual machine is shut down or the target virtual machine is abnormal, the target IO transmission process is destroyed;
[0066] When the process state of the target virtual machine process is to query the target virtual machine, the process state of the target IO transmission process is queried.
[0067] The embodiment of the present application provides an implementation method for managing a target IO transfer process according to the process state of a target virtual machine process. Specifically, when the target virtual machine is started or running normally, a target IO transfer process can be created; when the target virtual machine is shut down or running abnormally, the target IO transfer process can be destroyed; when a status query is required, the process state of the target IO transfer process can be queried. It is understandable that different process states of target virtual machine processes can correspond to different target IO transfer process management methods, and the present application does not limit this.
[0068] After creating the target IO transmission process, the following steps may also be included:
[0069] Determine whether the target virtual machine has an existing IO transmission process;
[0070] If the target virtual machine has an original IO transmission process, it is determined whether to close the original IO transmission process according to the IO pressure of the target virtual machine.
[0071] Specifically, after creating a new target IO transfer process, the IO pressure of the target virtual machine can be further referred to to determine whether to close the original IO transfer process corresponding to the target virtual machine. Obviously, when the actual IO pressure of the target virtual machine is large, the original IO transfer process can be kept; when the actual IO pressure of the target virtual machine is small, the original IO transfer process can be closed. Of course, it is also possible to determine whether to continue to create a new IO transfer process based on the IO pressure of the target virtual machine to meet the IO transfer load requirements of the target virtual machine.
[0072] It can be seen that in the embodiment of the present application, after creating the target IO transfer process for the target virtual machine, it can be determined whether the target virtual machine has an original IO transfer process, that is, a virtual machine can correspond to one or more IO transfer processes for implementing IO transfer services. On this basis, when a virtual machine corresponds to multiple IO transfer processes, it can be determined whether to close the original IO transfer process based on the actual IO pressure of the virtual machine. Obviously, when the actual IO pressure of the target virtual machine is large, the original IO transfer process can be left open; when the actual IO pressure of the target virtual machine is small, the original IO transfer process can be closed. Thus, effective management of the IO transfer process based on the actual load of the virtual machine is achieved. Furthermore, when the original IO transfer process is closed, thermal shrinkage of the shared memory corresponding to the target virtual machine can also be achieved.
[0073] It can be seen that the process management method of the virtual machine architecture provided in the embodiment of the present application constructs an IO transmission management service to communicate with the virtualization management service. The IO transmission management service is used to manage each IO transmission process in the virtual machine architecture. The virtualization management service is used to manage each virtual machine process in the virtual machine architecture. The virtual machine management events generated by each virtual machine process are monitored by the virtualization management service and transmitted to the IO transmission management service. The IO transmission management service manages the IO transmission process of the virtual machine to which the virtual machine process belongs according to the virtual machine management events, thereby solving the problem of difficult management of IO transmission processes created in the virtualization management service in the traditional technology. It can be seen that the technical solution realizes the separate management of IO transmission processes in the virtual machine architecture by constructing the IO transmission management service, thereby realizing the reasonable and effective management of IO transmission processes in the virtual machine architecture, and further ensuring the stable operation of the system.
[0074] Based on the above embodiments:
[0075] In one embodiment of the present application, after determining the target IO transmission process of the target virtual machine to which the target virtual machine process belongs, and managing the target IO transmission process according to the process state of the target virtual machine process, the following may also be included:
[0076] Determine a target callback function according to a virtual machine management event; the target callback function is a callback function for creating a target IO transmission process, or a callback function for destroying a target IO transmission process, or a callback function for querying a target IO transmission process;
[0077] The target callback function is executed to feed back the management result of the target IO transfer process to the virtualization management service.
[0078] The process management method of the virtual machine architecture provided in the embodiment of the present application can realize effective feedback of the IO transmission process management result through the callback function. Specifically, multiple callback functions can be preset in the virtual machine architecture in advance, such as the callback function for creating the target IO transmission process, the callback function for destroying the target IO transmission process, the callback function for querying the target IO transmission process, etc., so that the feedback function of the IO transmission process creation result, destruction result, and query result can be realized according to the target callback function carried in the virtual machine management event.
[0079] In one embodiment of the present application, when the target callback function is a callback function for creating a target IO transfer process, executing the target callback function to feed back the management result of the target IO transfer process to the virtualization management service may include:
[0080] Execute the callback function to feed back the process information of the target IO transfer process and the shared memory descriptor corresponding to the target IO transfer process to the virtualization management service, so that the virtualization management service feeds back the shared memory descriptor corresponding to the target IO transfer process to the target virtual machine process;
[0081] Accordingly, determining the target IO transmission process of the target virtual machine to which the target virtual machine process belongs may include:
[0082] When the target callback function is a callback function for creating a target IO transmission process, determining the target virtual machine to which the target virtual machine process belongs, so as to execute the step of creating the target IO transmission process;
[0083] When the target callback function is a callback function for destroying the target IO transmission process, or a callback function for querying the target IO transmission process, the target IO transmission process of the target virtual machine to which the target virtual machine process belongs is determined according to the shared memory descriptor in the virtual machine management event.
[0084] Specifically, for the newly created target IO transfer process, when executing the corresponding callback function of the executor, the process information of the target IO transfer process and its corresponding shared memory descriptor can be fed back to the virtualization management service, so that the virtualization management service can feed back the shared memory descriptor to the target virtual machine process, so that the target virtual machine process and the target IO transfer process can communicate data through the shared memory descriptor. Based on this, when executing the callback function of destroying the target IO transfer process, or querying the callback function of the target IO transfer process, the target IO transfer process can be realized through the shared memory descriptor, thereby realizing the effective management of the target IO transfer process.
[0085] Among them, the process information of the target IO transmission process may include a process name of the target IO transmission process, a process identifier of the target IO transmission process (such as a process number), virtual machine information of the target virtual machine to which the target IO transmission process belongs (such as a target virtual machine name, a target virtual machine identifier, etc.), a shared memory descriptor corresponding to the target IO transmission process, memory information of the shared memory corresponding to the target IO transmission process (such as a memory size, a memory address, etc.), and a combination of one or more of the file descriptors used by the target IO transmission process to communicate with other IO transmission processes.
[0086] It should be noted that the shared memory descriptor corresponding to the target IO transfer process is used to realize data communication between the target IO transfer process and the corresponding virtual machine process; the file descriptor of the target IO transfer process is used to realize data communication between the target IO transfer process and other IO transfer processes. In this way, the accuracy and reliability of data communication between processes can be effectively guaranteed.
[0087] In one embodiment of the present application, the process management method of the virtual machine architecture may further include:
[0088] Receive shared memory sharing information sent by the target IO transmission process; wherein the shared memory sharing information includes shared memory information and shared memory descriptor corresponding to the target IO transmission process;
[0089] The shared memory sharing information is forwarded to other IO transmission processes of the target virtual machine, so that the other IO transmission processes perform IO transmission operations on the shared memory corresponding to the target IO transmission process according to the shared memory sharing information.
[0090] It is understandable that, since the existence of the IO transfer management service can realize mutual communication between IO transfer processes, in some solutions, it is also possible to realize the operation of multiple IO transfer processes sending a shared memory IO to a mixed storage disk. Specifically, the IO transfer process can send the shared memory descriptor to another IO transfer process, set the location where it reads the shared memory and the location where the IO is sent to the cache disk (that is, the above-mentioned shared memory information), and then realize the operation of multiple IO transfer processes sending IO to a shared memory.
[0091] Based on the above embodiments, the embodiment of the present application provides another process management method for a virtual machine architecture.
[0092] First, the embodiment of the present application proposes a method for integrating an IO transmission management service in a virtual machine architecture, and the IO transmission management service can manage a large number of IO transmission processes generated during disaster recovery and monitor their status. It can be understood that the creation and description of the IO transmission process are integrated under the IO transmission management service, which is separated from the previous form of creating the IO transmission process in the virtualization management service (libvirt). Although libvirt can create an IO transmission process, it does not have a way to manage the process. The IO transmission process is separated and handed over to the IO transmission management service for management, making the integrated management in the virtual machine architecture more standardized. Specifically, the IO transmission management service can not only manage the life cycle of the IO transmission process, including the creation, destruction, query, etc. of the IO transmission process, but also realize the management of the communication of the process, such as sending various instructions to the IO transmission process and transmitting information. It can be imagined that in the disaster recovery solution, the life cycle of the IO transmission process can be comparable to that of the qemu process. Therefore, for this long-term process with the same function, it is very necessary to have a framework to manage it. Based on this architecture, the IO transmission process can sense the state of the virtual machine in the qemu process, and can also create multiple IO transmission processes according to the qemu process or disk to improve the efficiency of IO disk placement.
[0093] Based on this, please refer to Figure 3 , Figure 3 The schematic diagram of the principle of integrating IO transmission management service in the virtual machine architecture provided by this application has the following main ideas: create a main_loop service (i.e., a preset time loop mechanism), which can communicate with libvirt through socket, and send information to the service whenever a virtual machine is started and an IO transmission process needs to be started, along with the parameters for starting the instruction. When the IO transmission process is started, the return value of the start completion, i.e., the shared memory descriptor (shared memory fd), can be returned to libvirt, and then libvirt transmits it to the qemu process through the qmp instruction. In addition, a file descriptor can also be created for the IO transmission process to realize data communication between IO transmission processes. On this basis, the specific implementation process of the scheme is as follows:
[0094] 1. Create the main_loop event loop mechanism to monitor a unix communication descriptor (the above shared memory descriptor and file descriptor);
[0095] 2. Set the callback function of Unix communication, including the callback function of creating, destroying, querying status and other IO transmission process interactions;
[0096] 3. Create a connection with libvirt at the created callback function, and execute the qmp instruction to pass the information of the newly created IO transmission process to the qemu process;
[0097] 4. Set the data structure describing the status of the IO transfer process, including the process name of the IO transfer process, the virtual machine to which it belongs, the process number, the file descriptor that communicates with the IO transfer process, the shared memory size, the shared memory file descriptor, etc.;
[0098] 5. When libvirt starts the virtual machine, it creates an interface for interacting with the IO transfer management service and sends instructions to create an IO transfer process;
[0099] 6. Create an interface for interacting with the IO transmission management service in the callback function of libvirt monitoring the virtual machine status, which is used to pass the received qemu status information to the IO transmission management service so that the IO transmission management service can manage the IO transmission process.
[0100] For further information, please refer to Figure 4 , Figure 4A structural diagram of another virtual machine architecture provided for this application. The IO transmission management service, as a client, has a unix socket file descriptor to communicate with each IO transmission process, and has a fixed unix socket file descriptor to communicate with libvirt as a server. Other processes can also communicate with the IO transmission process through this communication method.
[0101] Also, please refer to Figure 5 , Figure 5 A distribution diagram of the association relationship between IO transmission processes provided by this application, for each IO transmission process, a data structure can be used to describe the process, such as the virtual machine to which it belongs, the name, process number, process status, the file descriptor that communicates with the process, the shared memory status corresponding to the process including the shared memory size, shared memory descriptor, shared memory bitmap, etc., and the relationship between the data can be organized using a double linked list. Therefore, when the IO transmission process status is queried externally, a unified interface can be used instead of using a specified Unix communication method for each process. For example, when obtaining the status of IO transmission process 1, "virtual machine name cdpwork1 get_status" can be used, and when creating IO transmission process 1, "virtual machine name cdpwork1 create args" can be used.
[0102] It can be understood that under this IO transmission management service, the IO transmission process can sense the status of the virtual machine, because each IO transmission process has an identification. When the qemu process is closed or a problem occurs in the virtual machine, libvirt can sense it through an event mechanism, and then it can be transmitted to the IO transmission management service through the network interface. After receiving the signal, the IO transmission management service transmits the event to the corresponding IO transmission process. Logically speaking, the IO transmission process is bound to qemu, and the working status of the IO transmission process is strongly related to the working status of the qemu process, because the status of the qemu process directly determines the sending status of the IO data.
[0103] Based on the above virtual machine architecture, a solution for hot modification of the shared memory of the IO transmission process or a method for reducing the IO cache can be implemented. Specifically, in some scenarios, it may be necessary to reduce the shared memory allocation, and the virtual machine business cannot be stopped at this time. Therefore, a new IO transmission process can be created through the IO transmission management service and transmitted to the qemu process to achieve IO data caching in the shared memory corresponding to the new IO transmission process. At the same time, both IO transmission processes will drop IO data to the disaster recovery cache disk, and since the old IO transmission process no longer has new IO data to process, after the old IO transmission process sends all IO data to the cache disk, the old IO transmission process can be closed, thereby achieving hot reduction of the shared memory size. Of course, if the virtual machine IO pressure is high, you can also selectively not close the old IO transmission process, which can not only increase the cache shared memory, but also increase the speed of sending cache IO data to the disaster recovery cache storage pool, because at this time there are two processes sending IO data to the cache storage pool, and qemu IO sends and writes data to the two shared memories alternately. If it is still not enough, you can continue to create a new IO transmission process to work, so that one producer corresponds to multiple consumers, and then quickly write the IO data cache to the disaster recovery cache storage pool, reducing the possibility of disaster recovery degradation. Figure 6 As shown, Figure 6 A schematic diagram of the principle of creating an IO transmission process provided by this application.
[0104] Finally, please refer to Figure 7 , Figure 7 A schematic diagram of multiple IO transfer processes using the same shared memory provided in this application. Since the existence of the IO transfer management service can realize mutual communication between IO transfer processes, in some schemes, it is also possible to realize the operation of multiple IO transfer processes sending a shared memory IO to a mixed storage disk. For example, an IO transfer process can send a shared memory descriptor to another IO transfer process, set the location where it reads the shared memory and the location where the IO is sent to the cache disk, and then realize the operation of multiple IO transfer processes sending IO to a shared memory.
[0105] It can be seen that the process management method of the virtual machine architecture provided in the embodiment of the present application constructs an IO transmission management service to communicate with the virtualization management service. The IO transmission management service is used to manage each IO transmission process in the virtual machine architecture. The virtualization management service is used to manage each virtual machine process in the virtual machine architecture. The virtual machine management events generated by each virtual machine process are monitored by the virtualization management service and transmitted to the IO transmission management service. The IO transmission management service manages the IO transmission process of the virtual machine to which the virtual machine process belongs according to the virtual machine management events, thereby solving the problem of difficult management of IO transmission processes created in the virtualization management service in the traditional technology. It can be seen that the technical solution realizes the separate management of IO transmission processes in the virtual machine architecture by constructing the IO transmission management service, thereby realizing the reasonable and effective management of IO transmission processes in the virtual machine architecture, and further ensuring the stable operation of the system.
[0106] An embodiment of the present application provides a process management device for a virtual machine architecture.
[0107] Please refer to Figure 8 , Figure 8 This is a structural diagram of a process management device of a virtual machine architecture provided by the present application. The process management device of the virtual machine architecture is applied to an IO transmission management service. The IO transmission management service is connected in communication with a virtualization management service. The IO transmission management service is connected in communication with each IO transmission process. The virtualization management service is connected in communication with each virtual machine process. The process management device of the virtual machine architecture may include:
[0108] Monitoring module 1, used to monitor events of the virtualization management service and obtain virtual machine management events; virtual machine management events are obtained by the virtualization management service monitoring events of each virtual machine process;
[0109] Determination module 2, used to determine the target virtual machine process and the process state of the target virtual machine process according to the virtual machine management event;
[0110] The management module 3 is used to determine the target IO transmission process of the target virtual machine to which the target virtual machine process belongs, and manage the target IO transmission process according to the process state of the target virtual machine process.
[0111] It can be seen that the process management device of the virtual machine architecture provided in the embodiment of the present application constructs an IO transmission management service to communicate with the virtualization management service. The IO transmission management service is used to manage each IO transmission process in the virtual machine architecture. The virtualization management service is used to manage each virtual machine process in the virtual machine architecture. The virtual machine management events generated by each virtual machine process are monitored by the virtualization management service and transmitted to the IO transmission management service. The IO transmission management service manages the IO transmission process of the virtual machine to which the virtual machine process belongs according to the virtual machine management events, thereby solving the problem of difficult management of IO transmission processes created in the virtualization management service in the traditional technology. It can be seen that the technical solution realizes the separate management of IO transmission processes in the virtual machine architecture by constructing the IO transmission management service, thereby realizing the reasonable and effective management of IO transmission processes in the virtual machine architecture, and further ensuring the stable operation of the system.
[0112] In one embodiment of the present application, the above-mentioned management module 3 can be specifically used to create a target IO transmission process when the process status of the target virtual machine process is that the target virtual machine is started or the target virtual machine is running; destroy the target IO transmission process when the process status of the target virtual machine process is that the target virtual machine is shut down or the target virtual machine is abnormal; and query the process status of the target IO transmission process when the process status of the target virtual machine process is to query the target virtual machine.
[0113] In one embodiment of the present application, the process management device of the virtual machine architecture may further include a feedback module, which is used to determine the target IO transmission process of the target virtual machine to which the target virtual machine process belongs, and manage the target IO transmission process according to the process state of the target virtual machine process, and then determine the target callback function according to the virtual machine management event; the target callback function is a callback function for creating a target IO transmission process, or a callback function for destroying the target IO transmission process, or a callback function for querying the target IO transmission process; the target callback function is executed to feed back the management result of the target IO transmission process to the virtualization management service.
[0114] In one embodiment of the present application, when the target callback function is a callback function for creating a target IO transfer process, the feedback module can be specifically used to execute the callback function to feed back the process information of the target IO transfer process and the shared memory descriptor corresponding to the target IO transfer process to the virtualization management service, so that the virtualization management service feeds back the shared memory descriptor corresponding to the target IO transfer process to the target virtual machine process;
[0115] Correspondingly, the above-mentioned management module 3 can be specifically used to determine the target virtual machine to which the target virtual machine process belongs when the target callback function is a callback function for creating a target IO transmission process, so as to execute the step of creating a target IO transmission process; when the target callback function is a callback function for destroying the target IO transmission process, or a callback function for querying the target IO transmission process, determine the target IO transmission process of the target virtual machine to which the target virtual machine process belongs according to the shared memory descriptor in the virtual machine management event.
[0116] In one embodiment of the present application, the process management device of the virtual machine architecture may also include a judgment module for judging whether the target virtual machine has an original IO transmission process after the target IO transmission process is created as mentioned above; if the target virtual machine has an original IO transmission process, determining whether to close the original IO transmission process based on the IO pressure of the target virtual machine.
[0117] In one embodiment of the present application, the process information of the target IO transfer process may include a combination of one or more of the following: the process name of the target IO transfer process, the process identifier of the target IO transfer process, the virtual machine information of the target virtual machine to which the target IO transfer process belongs, the shared memory descriptor corresponding to the target IO transfer process, the memory information of the shared memory corresponding to the target IO transfer process, and the file descriptor used by the target IO transfer process to communicate with other IO transfer processes.
[0118] In one embodiment of the present application, the monitoring module 1 can be specifically used to monitor events of a virtualization management service according to a preset time cycle mechanism to obtain virtual machine events.
[0119] For an introduction to the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0120] An embodiment of the present application provides an electronic device.
[0121] Please refer to Fig. 9 , Fig. 9 This is a schematic diagram of the structure of an electronic device provided in this application, and the electronic device may include:
[0122] A memory 11, used for storing computer programs;
[0123] The processor 10 can implement the steps of any of the above-mentioned process management methods of the virtual machine architecture when executing a computer program.
[0124] like Fig. 9, which is a schematic diagram of the composition structure of an electronic device, the electronic device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 all communicate with each other through the communication bus 13.
[0125] In the embodiment of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.
[0126] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in an embodiment of a process management method for a virtual machine architecture.
[0127] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 11 at least stores programs for implementing the following functions:
[0128] Monitor the virtualization management service for events and obtain virtual machine management events; virtual machine management events are obtained by the virtualization management service monitoring the events of each virtual machine process;
[0129] Determine a target virtual machine process and a process state of the target virtual machine process according to the virtual machine management event;
[0130] A target IO transmission process of a target virtual machine to which the target virtual machine process belongs is determined, and the target IO transmission process is managed according to a process state of the target virtual machine process.
[0131] In a possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.
[0132] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0133] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.
[0134] Of course, it should be noted that Fig. 9 The structure shown does not constitute a limitation on the electronic device in the embodiment of the present application. In actual applications, the electronic device may include Fig. 9 More or fewer components than shown, or combinations of certain components.
[0135] An embodiment of the present application provides a computer-readable storage medium.
[0136] The computer-readable storage medium provided in the embodiment of the present application stores a computer program, and when the computer program is executed by a processor, the steps of the process management method of any of the above-mentioned virtual machine architectures can be implemented.
[0137] Among them, the computer-readable storage medium can be any available medium that can be stored in a computer or a data storage device such as a server or data center that includes one or more available media integrated. For example, it can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk) and other media that can store computer program codes.
[0138] For an introduction to the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0139] An embodiment of the present application provides a computer program product.
[0140] The computer program product provided in the embodiments of the present application includes a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the process management method of any of the above-mentioned virtual machine architectures can be implemented.
[0141] Specifically, in the above embodiments, all or part of them can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of them can be implemented in the form of a computer program product.
[0142] Among them, the computer program product may include one or more computer programs / instructions, and when the computer program / instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application may be generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line, etc.) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0143] For an introduction to the computer program product provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate on them here.
[0144] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0145] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0146] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0147] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.
Claims
1. A process management method for a virtual machine architecture, characterized in that: Applied to an IO transmission management service, the IO transmission management service is communicatively connected with a virtualization management service, the IO transmission management service is communicatively connected with each IO transmission process, the virtualization management service is communicatively connected with each virtual machine process, the method comprises: Performing event monitoring on the virtualization management service to obtain virtual machine management events; the virtual machine management events are obtained by the virtualization management service performing event monitoring on each virtual machine process; Determine a target virtual machine process and a process state of the target virtual machine process according to the virtual machine management event; A target IO transmission process of a target virtual machine to which the target virtual machine process belongs is determined, and the target IO transmission process is managed according to a process state of the target virtual machine process.
2. The process management method of the virtual machine architecture according to claim 1, characterized in that: Managing the target IO transmission process according to the process state of the target virtual machine process includes: When the process state of the target virtual machine process is that the target virtual machine is started or the target virtual machine is running, creating the target IO transmission process; When the process state of the target virtual machine process is that the target virtual machine is shut down or the target virtual machine is abnormal, destroying the target IO transmission process; When the process state of the target virtual machine process is to query the target virtual machine, the process state of the target IO transmission process is queried.
3. The process management method of the virtual machine architecture according to claim 2, characterized in that: After determining the target IO transmission process of the target virtual machine to which the target virtual machine process belongs, and managing the target IO transmission process according to the process state of the target virtual machine process, the method further includes: Determine a target callback function according to the virtual machine management event; the target callback function is a callback function for creating the target IO transmission process, or a callback function for destroying the target IO transmission process, or a callback function for querying the target IO transmission process; The target callback function is executed to feed back the management result of the target IO transmission process to the virtualization management service.
4. The process management method of the virtual machine architecture according to claim 3, characterized in that: When the target callback function is a callback function for creating the target IO transfer process, executing the target callback function to feed back the management result of the target IO transfer process to the virtualization management service includes: Executing the callback function to feed back the process information of the target IO transfer process and the shared memory descriptor corresponding to the target IO transfer process to the virtualization management service, so that the virtualization management service feeds back the shared memory descriptor corresponding to the target IO transfer process to the target virtual machine process; Accordingly, determining the target IO transmission process of the target virtual machine to which the target virtual machine process belongs includes: When the target callback function is a callback function for creating the target IO transfer process, determining the target virtual machine to which the target virtual machine process belongs, so as to execute the step of creating the target IO transfer process; When the target callback function is a callback function for destroying the target IO transmission process, or a callback function for querying the target IO transmission process, the target IO transmission process of the target virtual machine to which the target virtual machine process belongs is determined according to the shared memory descriptor in the virtual machine management event.
5. The process management method of the virtual machine architecture according to claim 2, characterized in that: After creating the target IO transmission process, it also includes: Determine whether the target virtual machine has an existing IO transmission process; If the target virtual machine has the original IO transmission process, it is determined whether to close the original IO transmission process according to the IO pressure of the target virtual machine.
6. The process management method of the virtual machine architecture according to claim 4, characterized in that: The process information of the target IO transfer process includes a process name of the target IO transfer process, a process identifier of the target IO transfer process, virtual machine information of a target virtual machine to which the target IO transfer process belongs, a shared memory descriptor corresponding to the target IO transfer process, memory information of a shared memory corresponding to the target IO transfer process, and a combination of one or more of the following file descriptors used by the target IO transfer process to communicate with other IO transfer processes.
7. The process management method of the virtual machine architecture according to claim 1, characterized in that: Performing event monitoring on the virtualization management service to obtain virtual machine events includes: Event monitoring is performed on the virtualization management service according to a preset time cycle mechanism to obtain the virtual machine event.
8. A process management device for a virtual machine architecture, characterized in that: Applied to an IO transmission management service, the IO transmission management service is connected in communication with a virtualization management service, the IO transmission management service is connected in communication with each IO transmission process, the virtualization management service is connected in communication with each virtual machine process, the device comprises: A monitoring module, used to monitor the virtualization management service for events and obtain virtual machine management events; the virtual machine management events are obtained by the virtualization management service performing event monitoring on each virtual machine process; A determination module, configured to determine a target virtual machine process and a process state of the target virtual machine process according to the virtual machine management event; The management module is used to determine the target IO transmission process of the target virtual machine to which the target virtual machine process belongs, and manage the target IO transmission process according to the process state of the target virtual machine process.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the process management method for a virtual machine architecture as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the process management method for the virtual machine architecture according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Virtual machine process monitoring system and method
CN107741876A
Virtual machine high availability implementation method and device and storage medium
CN112637336A
Method for resource management of virtual environment
KR1020180045347A