A method and apparatus for implementing virtual machine management data communication
By setting up an agent and virtual hardware PCI devices for virtual machines, the isolation between the management network and the business network of cloud desktop virtual machines is simplified, solving the complex network isolation deployment problem in existing technologies and realizing a simple data communication method.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, the deployment of management network data and business network data isolation for cloud desktop virtual machines is complex, requiring two virtual network cards and two virtual switches, resulting in high deployment complexity.
Configure an agent for each virtual machine, create a virtual hardware PCI device for it, install the driver, and communicate with the virtual desktop architecture management platform through the virtual hardware PCI device to manage data, simplifying network isolation.
By using virtual hardware PCI devices to isolate virtual machine management data from business data, network isolation deployment is simplified, avoiding the complex dual-NIC and dual-switch isolation methods of existing technologies.
Smart Images

Figure CN115145686B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the communication technology, in particular to a method and device for realizing virtual machine management data communication. BACKGROUND
[0002] With the increasing demand for remote office, more and more enterprises begin to use VDI (Virtual Desktop Infrastructure) technology to build remote office infrastructure.
[0003] Figure 1 As shown in a common cloud desktop network topology diagram; the cloud desktop client needs to be connected with the VDI management platform, and the cloud desktop client and the VDI management platform communicate and transmit VDI control commands through http messages, such as user authentication, virtual machine information and the like.
[0004] The cloud desktop client is connected with the KVM virtualization host through NAT (Network Address Translation) or gateway (not shown in the figure), and the transmission management data is mainly the data of the VDI protocol, including desktop graphics, voice, keyboard and mouse protocol data. In order to effectively isolate the management data of the management network and the service data of the service network, and ensure the safety of the management data of the VDI management platform, the cloud desktop virtual machine needs to have two virtual network cards for management data communication and service data communication. As shown in Figure 1 The agent of the cloud desktop virtual machine is connected to the management network through a virtual network card with IP address 192.168.124.3, and the other virtual network card is connected to the service switch of the service network with IP address 192.168.100.10, and the cloud desktop virtual machine needs to deploy two virtual switches (VSwitch) to realize the communication of the double virtual network cards, which leads to the complex isolation deployment of the management network data and the service network data of the virtual machine. SUMMARY
[0005] The purpose of the present application is to provide a method and device for realizing virtual machine management data communication, and to realize simple deployment of management network data isolation.
[0006] In order to achieve the above purpose, the present application provides a method for realizing virtual machine management data communication, which comprises: setting an agent for each virtual machine; creating a virtual hardware PCI device for each virtual machine; installing a virtual hardware PCI device driver for each virtual machine; each agent running a virtual hardware PCI device driver to communicate management data with a virtual desktop infrastructure management platform through the corresponding virtual hardware PCI device of the virtual machine.
[0007] To achieve the above object, the application further provides a device for realizing virtual machine management data communication, wherein the device comprises a processor and a memory; the memory is used for storing processor executable instructions; wherein the processor executes the processor executable instructions in the memory to perform the following operations: setting an agent for each virtual machine; creating a virtual hardware PCI device for each virtual machine; installing a virtual hardware PCI device driver for each virtual machine; each agent runs the virtual hardware PCI device driver to communicate with a virtual desktop infrastructure management platform through the corresponding virtual hardware PCI device of the virtual machine.
[0008] The application has the beneficial effect that the agent of each virtual machine connects the VDI management platform through the virtual hardware PCI device, and no longer needs a special management data IP address to communicate with the VDI management platform to manage data, thereby simplifying the isolation of the management network data and the service network data of the virtual machine. BRIEF DESCRIPTION OF DRAWINGS
[0009] Figure 1 A common cloud desktop network topology diagram is shown;
[0010] Figure 2 A flowchart of the method for realizing virtual machine management data communication provided by the embodiment of the application is shown;
[0011] Figure 3 A diagram showing the virtual hardware PCI device of the cloud desktop virtual machine provided by the embodiment of the application establishing a connection is shown;
[0012] Figure 4 A cloud desktop network topology diagram provided by the embodiment of the application is shown;
[0013] Figure 5 A diagram of the device for realizing virtual machine management data communication provided by the embodiment of the application is shown. DETAILED DESCRIPTION
[0014] The examples shown in the multiple drawings will be described in detail. In the following detailed description, multiple specific details are used to provide a comprehensive understanding of the application. Known methods, steps, components and circuits are not described in detail in the examples to avoid making the examples difficult to understand.
[0015] In the used terms, the term "comprises" means including but not limited to; the term "contains" means including but not limited to; the terms "above", "within" and "below" include the number; the terms "greater than", "less than" mean not including the number. The term "based on" means at least based on a part of it.
[0016] Figure 2The flowchart of the method for implementing virtual machine management data communication provided by the embodiment of the present application includes the following steps:
[0017] Step 201, setting an agent for each virtual machine;
[0018] Step 202, creating a virtual hardware PCI device for each virtual machine;
[0019] Step 203, installing a virtual hardware PCI device driver for each virtual machine;
[0020] Step 204, running the virtual hardware PCI device driver by each agent, and communicating management data with the virtual desktop architecture management platform through the corresponding virtual hardware PCI device of the virtual machine.
[0021] Figure 2 The embodiment has the beneficial effect that the agent of each virtual machine connects the VDI management platform through the virtual hardware PCI device, and no longer needs a special management data IP address to communicate management data with the VDI management platform, thus simplifying the isolation of the management network data and the service network data of the virtual machine.
[0022] Figure 3 The figure is a schematic diagram of the virtual hardware PCI device of the cloud desktop virtual machine provided by the embodiment of the present application; on the server 1 carrying the cloud desktop virtual machine, an Agent Com Device (agent serial port device) simulated by a QEMU virtual machine is created on a KVM (Kernel-based Virtual Machine) virtualization platform, the Agent Com Device is a virtual hardware PCI device, an Agent data forwarding thread is added in the QEMU virtual machine, and the Agent data forwarding thread registers an interface to interact with the Agent Com Device.
[0023] After the cloud desktop virtual machine is started, the agent of the cloud desktop virtual machine starts running, the agent opens the Agent Com Device device through the driver interface of the installed Agent COM Device, and sends a connection control command with the IP address of the management platform to the Agent Com Device. After the Agent Com Device receives the connection control command, a socket connection is established with the VDI management platform of the server 2 through the network card of the IP address of the cloud desktop virtual machine, and the agent of the cloud desktop virtual machine communicates management data with the VDI management platform through the socket connection.
[0024] Figure 4 The figure is a cloud desktop network topology schematic diagram provided by the embodiment of the present application.
[0025] Figure 4 In the middle, after the cloud desktop virtual machine 1 starts, the Agent 1 opens the Agent Com Device 1 device through the installed Agent COM Device driver interface, and sends a connection control command with the management platform IP address to the Agent Com Device 1. After the Agent Com Device 1 receives the connection control command, it establishes a Socket connection with the VDI management platform through the virtual network card of the cloud desktop virtual machine IP address 192.168.0.3. The IP address 192.168.0 of the cloud desktop virtual machine 1 virtual network card is connected to the service network switch, and does not forward any management data packets.
[0026] After the cloud desktop virtual machine 2 starts, the Agent 2 opens the Agent Com Device 2 device through the installed Agent COM Device driver interface, and sends a connection control command with the management platform IP address to the Agent Com Device 2. After the Agent Com Device 2 receives the connection control command, it establishes a Socket connection with the VDI management platform through the virtual network card of the cloud desktop virtual machine IP address 192.168.124.1. The IP address 192.168.124.1 of the cloud desktop virtual machine 2 virtual network card is connected to the service network switch, and does not forward any management data packets.
[0027] Agent Com Device 1 and Agent Com Device 2 are virtual PCI devices with Send Buffer (virtual send buffer) and Recv Buffer (virtual receive buffer). The application takes Agent 1 communicating with the VDI management platform through Agent Com Device 1 as an example for illustration.
[0028] When the Agent 1 needs to send management data to the VDI management platform, the Agent reads the maximum cache length register, write address register and read address register of the virtual Send Buffer of the Agent Com Device 1, respectively obtains the maximum cache length (size), Write Index (write address index) and Read Index (read address index) of the virtual Send Buffer.
[0029] Agent 1 calculates the writable length (writable) according to the Write Index and Size of the virtual Send Buffer, and when the management data to be sent is less than the writable length, writes the management data to be sent to the virtual Send Buffer of Agent Com Device 1 according to the write address indicated by the Write Index. Agent 1 updates the Write Index of the write address register according to the new position of the virtual Send Buffer of Agent Com Device 1 being written.
[0030] The Agent 1 data forwarding thread reads the maximum cache length register, write address register and read address register of the virtual Send Buffer of Agent Com Device 1, respectively obtains the maximum cache length, Write Index and Read Index of the virtual Send Buffer.
[0031] The Agent 1 data forwarding thread calculates the length of the management data to be sent according to the Write Index and Read Index of the virtual Send Buffer, reads the management data of cloud desktop virtual machine 1 to be sent from the read address indicated by the Read Index, and sends it to the VDI management platform through the Socket connection. The Agent 1 data forwarding thread updates the Read Index of the read address register of the virtual Send Buffer according to the read address of the virtual Send Buffer of Agent Com Device 1 after being read.
[0032] When the VDI management platform sends management data to cloud desktop virtual machine 1, the VDI management platform sends the management data through the socket connection; the Agent 1 data forwarding thread reads the maximum cache length register, write address register and read address register of the virtual Recv Buffer of Agent Com Device 1, respectively obtains the maximum cache length (size), Write Index (write address index) and Read Index (read address index) of the virtual Recv Buffer.
[0033] The Agent1 data forwarding thread calculates the writable length based on the Write Index and Size of the virtual Recv Buffer. When the management data to be sent is less than the writable length, it writes the management data to be received into the virtual Recv Buffer of Agent Com Device1 according to the write address indicated by the Write Index. The Agent1 data forwarding thread then updates the Write Index of the virtual Recv Buffer's write address memory based on the position after the data is written into the virtual Recv Buffer of Agent Com Device1.
[0034] Agent1 reads the maximum buffer length register, write address register, and read address register of the virtual Recv Buffer from Agent Com Device1 to obtain the maximum buffer length, Write Index, and Read Index of the virtual Recv Buffer, respectively. Agent1 calculates the length of the management data to be read based on the Write Index and Read Index of the virtual Recv Buffer, and starts reading the management data from the read address indicated by the Read Index. The data forwarding thread of Agent1 updates the Read Index of the virtual Recv Buffer's read address memory based on the information obtained after the virtual Recv Buffer of Agent Com Device1 has been read.
[0035] The cloud desktop virtual machine 2 communicates with the VDI management platform through the same virtual hardware PCI device Agent Com Device 2 to manage data, which will not be described again. The cloud desktop virtual machine 2 can communicate with the VDI management platform to manage data through the virtual network card with IP address 192.168.124.1.
[0036] This application Figure 3 and Figure 4 By forwarding management data between the agent of the cloud desktop virtual machine and the VDI management platform through virtual hardware PCI devices, the management network and the business network are isolated. This avoids the complex implementation of isolation and forwarding of cloud desktop virtual machines through two virtual network cards and two virtual switches in the existing technology, and simplifies the isolation of virtual machine management network data and business network data.
[0037] Figure 5The device 50 for implementing virtual machine management data communication provided by the embodiments of the present application includes a processor and a memory. The memory is used to store processor executable instructions. The processor executes the processor executable instructions in the memory to perform the following operations: creating a virtual hardware PCI device for each virtual machine; installing a virtual hardware PCI device driver for each virtual machine; setting an Agent for each virtual machine; and each Agent running the virtual hardware PCI device driver to communicate management data with the virtual desktop architecture management platform through the corresponding virtual hardware PCI device of the virtual machine.
[0038] The processor executes each Agent running the virtual hardware PCI device driver to communicate management data with the virtual desktop architecture management platform through the corresponding virtual hardware PCI device of the virtual machine by running the processor executable instructions in the memory, including: each Agent calling the virtual hardware PCI device driver to open the corresponding virtual hardware PCI device of the virtual machine, and sending a connection control command with the IP address of the virtual desktop architecture management platform; each virtual hardware PCI device establishing a socket connection with the IP address of the virtual desktop architecture management platform using the IP address of the corresponding virtual machine; and each Agent sending and receiving management data through the socket connection established by the corresponding virtual hardware PCI device of the virtual machine.
[0039] The processor executes each Agent sending and receiving management data through the socket connection established by the corresponding virtual hardware PCI device of the virtual machine by running the processor executable instructions in the memory, including: each Agent writing local management data of the virtual machine into the virtual sending buffer of the corresponding virtual hardware PCI device; each virtual hardware PCI device sending the local management data written by the virtual sending buffer of the device through the established socket connection; each virtual hardware PCI device receiving remote management data through the established socket connection and writing the remote management data into the virtual receiving buffer of the device; and each Agent reading the remote management data from the virtual receiving buffer of the corresponding virtual hardware PCI device of the virtual machine.
[0040] The processor executes each Agent to write local management data of the virtual machine where the Agent is located into a virtual send buffer of the corresponding virtual hardware PCI device by running the processor executable instructions in the memory, including: each Agent reading a length and a write address of a virtual send buffer of the corresponding virtual hardware PCI device of the virtual machine where the Agent is located; determining that the local management data to be sent can be written, and writing the local management data to be sent from the write address of the virtual send buffer; and the processor executes each Agent to read remote management data from a virtual receive buffer of the corresponding virtual hardware PCI device of the virtual machine where the Agent is located by running the processor executable instructions in the memory, including: each Agent reading a read address and a write address of a virtual receive buffer of the corresponding virtual hardware PCI device of the virtual machine where the Agent is located, determining a byte number of the remote management data to be read, and reading the remote management data to be read from the read address of the virtual buffer according to the byte number of the remote management data to be read.
[0041] The processor executes each virtual hardware PCI device to send local management data written by the virtual send buffer of the device through the established socket connection by running the processor executable instructions in the memory, including: each virtual hardware PCI device reading a read address and a write address of the virtual send buffer of the device through an Agent data forwarding thread, determining a byte number of the local management data to be sent, reading the local management data to be sent from the read address of the virtual send buffer of the device according to the byte number of the local management data to be sent, and sending through the socket connection; and the processor executes each virtual hardware PCI device to receive remote management data through the established socket connection and write into the virtual receive buffer of the device by running the processor executable instructions in the memory, including: each virtual hardware PCI device starting an Agent data forwarding thread, receiving the remote management data through the socket connection, reading a length and a write address of the virtual receive buffer of the device, determining that the received remote management data can be written, and writing the received remote management data from the write address of the virtual receive buffer.
[0042] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for implementing virtual machine management data communication, characterized in that the method include: Configure an agent for each virtual machine; Create a virtual hardware peripheral component interconnect standard PCI device for each virtual machine; Install virtual hardware PCI device drivers for each of the virtual machines; Each Agent runs the virtual hardware PCI device driver and communicates with the virtual desktop architecture management platform to manage data through the corresponding virtual hardware PCI device of the virtual machine it resides in.
2. The method according to claim 1, characterized in that, Each Agent runs the virtual hardware PCI device driver and communicates with the virtual desktop architecture management platform to manage data through the corresponding virtual hardware PCI device of its virtual machine, including: Each Agent invokes the virtual hardware PCI device driver to open the corresponding virtual hardware PCI device of the virtual machine it resides in, and sends a connection control command with the IP address of the virtual desktop architecture management platform; Each virtual hardware PCI device establishes a socket connection with the IP address of the virtual desktop architecture management platform using the IP address of the corresponding virtual machine; Each Agent sends and receives management data through a socket connection established by the corresponding virtual hardware PCI device of its virtual machine.
3. The method according to claim 1, characterized in that, The sending and receiving of management data by each Agent through the socket connection established by the corresponding virtual hardware PCI device of its virtual machine includes: Each Agent writes the local management data of its virtual machine into the virtual send cache of the corresponding virtual hardware PCI device; Each of the virtual hardware PCI devices sends the local management data written to its virtual send buffer through the established socket connection; Each of the virtual hardware PCI devices receives remote management data through the established socket connection and writes it into the virtual receive buffer of this device; Each Agent reads remote management data from the virtual receive cache of the corresponding virtual hardware PCI device in its virtual machine.
4. The method according to claim 3, characterized in that, The step of each Agent writing local management data of its virtual machine to the virtual send cache of the corresponding virtual hardware PCI device includes: each Agent reading the length and write address of the virtual send cache of the corresponding virtual hardware PCI device of its virtual machine; determining that the local management data to be sent can be written, and writing the local management data to be sent starting from the write address of the virtual send cache; The process of each Agent reading remote management data from the virtual receive cache of the corresponding virtual hardware PCI device of its virtual machine includes: each Agent reading the read address and write address of the virtual receive cache of the corresponding virtual hardware PCI device of its virtual machine, determining the number of bytes of remote management data to be read, and reading from the virtual receive cache read address according to the number of bytes of remote data to be read.
5. The method according to claim 3, characterized in that, The process of each virtual hardware PCI device sending the local management data written to its virtual send cache through the established socket connection includes: each virtual hardware PCI device, through the agent data forwarding thread, reads the read address and write address of its virtual send cache, determines the number of bytes of local management data to be sent, reads the local management data to be sent starting from the read address of its virtual send cache according to the number of bytes of local management data to be sent, and sends it through the socket connection; Each virtual hardware PCI device receives remote management data through an established socket connection and writes it to its virtual receive buffer. Each virtual hardware PCI device starts an agent data forwarding thread, receives remote management data through a socket connection, reads the length and write address of its virtual receive buffer, determines that the received remote management data can be written, and starts writing the received remote management data from the write address of the virtual receive buffer.
6. A device for implementing virtual machine management data communication, characterized in that, The device includes a processor and a memory; the memory stores processor-executable instructions; wherein the processor executes the processor-executable instructions in the memory to perform the following operations: Create a virtual hardware PCI device for each virtual machine; Install virtual hardware PCI device drivers for each of the virtual machines; Configure an agent for each virtual machine; Each Agent runs the virtual hardware PCI device driver and communicates with the virtual desktop architecture management platform to manage data through the corresponding virtual hardware PCI device of the virtual machine it resides in.
7. The device according to claim 6, characterized in that, The processor executes processor-executable instructions in the memory to run the virtual hardware PCI device driver for each Agent, and communicates with the virtual desktop architecture management platform to manage data through the corresponding virtual hardware PCI device of the virtual machine, including: Each Agent invokes the virtual hardware PCI device driver to open the corresponding virtual hardware PCI device of the virtual machine it resides in, and sends a connection control command with the IP address of the virtual desktop architecture management platform; Each virtual hardware PCI device establishes a socket connection with the IP address of the virtual desktop architecture management platform using the IP address of the corresponding virtual machine; Each Agent sends and receives management data through a socket connection established by the corresponding virtual hardware PCI device of its virtual machine.
8. The device according to claim 6, characterized in that, The processor executes processor-executable instructions in the memory to send and receive management data through the socket connection established by each Agent via the corresponding virtual hardware PCI device of its virtual machine, including: Each Agent writes the local management data of its virtual machine into the virtual send cache of the corresponding virtual hardware PCI device; Each of the virtual hardware PCI devices sends the local management data written to its virtual send buffer through the established socket connection; Each of the virtual hardware PCI devices receives remote management data through the established socket connection and writes it into the virtual receive buffer of this device; Each Agent reads remote management data from the virtual receive cache of the corresponding virtual hardware PCI device in its virtual machine.
9. The device according to claim 8, characterized in that, The processor executes processor-executable instructions in the memory to write the local management data of the virtual machine to the virtual send cache of the corresponding virtual hardware PCI device of each Agent. This includes: each Agent reading the length and write address of the virtual send cache of the corresponding virtual hardware PCI device of the virtual machine; determining that the local management data to be sent can be written, and writing the local management data to be sent starting from the write address of the virtual send cache; The processor executes processor-executable instructions in the memory to read remote management data from the virtual receive cache of the corresponding virtual hardware PCI device of the virtual machine by each Agent: each Agent reads the read address and write address of the virtual receive cache of the corresponding virtual hardware PCI device of the virtual machine, determines the number of bytes of remote management data to be read, and reads the data starting from the virtual cache read address according to the number of bytes of remote data to be read.
10. The device according to claim 8, characterized in that, The processor executes processor-executable instructions in the memory to send local management data written to the virtual send cache of each virtual hardware PCI device through an established socket connection. This includes: each virtual hardware PCI device, through an agent data forwarding thread, reads the read address and write address of its virtual send cache, determines the number of bytes of local management data to be sent, reads the local management data to be sent starting from the read address of its virtual send cache according to the number of bytes of local management data to be sent, and sends it through the socket connection. The processor executes processor-executable instructions in the memory to receive remote management data from each of the virtual hardware PCI devices through an established socket connection and write it to the virtual receive cache of the device. This includes: each of the virtual hardware PCI devices starting an Agent data forwarding thread, receiving remote management data through a socket connection, reading the length and write address of the virtual receive cache of the device, determining that the received remote management data can be written, and writing the received remote management data starting from the write address of the virtual receive cache.
Citation Information
Patent Citations
Virtualized security monitoring method and system
CN106850661A
Citizen card system
CN109447876A