Distributed system-oriented vhost-user identity authentication and I / O authentication method

By introducing identity registration and distributed permission control mechanisms in distributed systems, the problems of insufficient identity recognition and lack of I/O permission control in the vhost-user protocol in distributed systems are solved, ensuring data integrity and system availability.

CN120675814AActive Publication Date: 2025-09-19北京志凌海纳科技股份有限公司
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202511132956.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-13
Publication Date
2025-09-19
Estimated Expiration
2045-08-13

AI Technical Summary

Technical Problem

In distributed systems, the vhost-user protocol lacks an effective connection identity recognition mechanism and fine-grained I/O permission control, leading to data pollution and I/O conflicts and data consistency risks during cross-node failover, affecting the availability and data integrity of virtual machines.

Method used

By establishing a Unix Domain Socket connection between the front-end virtual machine process and the back-end vhost-user target process, sending an identity registration message, constructing a connection summary identifier (cgid) generated by the node identifier, network identifier, and process identifier, and performing identity authentication and permission control on the back-end, it ensures that each virtqueue is exclusively bound by a trusted client at any time, and adopts distributed permission control and heartbeat synchronization mechanism to maintain permission consistency.

Benefits of technology

The vhost-user protocol achieves identity recognition accuracy and fine-grained I/O permission control in distributed systems, avoids data pollution and data inconsistency, and improves system availability and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120675814A_ABST
    Figure CN120675814A_ABST
Patent Text Reader

Abstract

The invention discloses a vhost-user identity authentication and I / O (Input / Output) authentication method for a distributed system. The method comprises the following steps: establishing Unix Domain Socket connection between a front-end virtual machine process and a rear-end vhost-user target process; the front end sends an identity registration message to the rear end; a VHOSTUSERSETCONNIDENTITY message is constructed, and a load field of the message comprises a connection abstract identifier generated based on a node identifier, a network identifier and a process identifier; the message is sent through the Socket connection; the back end executes identity authentication; the back end only processes the I / O request of the successfully registered virtual machine process; and for the cross-node I / O conflict scene, executing distributed permission control. According to the vhost-user identity authentication and I / O authentication method oriented to the distributed system, the accuracy of vhost-user identity authentication is guaranteed through protocol extension and a mapping table mechanism, identity confusion is avoided, meanwhile, data conflicts are avoided through distributed permission and migration control, and the user experience is improved. And the availability and the stability of the system are guaranteed by combining the processing of heartbeat synchronization and a consistency algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed system data processing, and in particular to a vhost-user identity authentication and I / O authentication method for distributed systems. Background Art

[0002] Vhost / Vhost-user Protocol: To improve the efficiency of virtual machine processes accessing I / O devices, the industry has proposed various optimization mechanisms. Among them, the vhost protocol, as a communication mechanism for high-performance virtualized device access, has been widely adopted in high-speed paths for virtual machines to access block and network devices. Vhost itself is an implementation framework for accelerating the virtio backend. Its core goal is to bypass the traditional virtualization I / O stack and offload I / O processing logic from the virtual machine program itself to kernel-mode or user-mode programs (storage services) on the host machine. This is implemented as vhost in kernel-mode and vhost-user in user-mode. The virtual machine and vhost share virtqueue memory, allowing the vhost to directly access the virtual machine's physical memory without forwarding through the virtual machine program. An event notification mechanism (eventfd) replaces traditional interrupt notifications, reducing context switching.

[0003] Vhost-user, as a vhost derivative protocol, can be considered a storage protocol. It uses unix domain socket (local domain socket, a means of communication between processes. Processes on the same machine can directly exchange data by reading and writing the same file descriptor. Compared with TCP / IP, unix domain socket does not rely on the network and is more concise and efficient.) to complete event notification and data interaction between processes. Compared with vhost in kernel state, the virtual machine process can share memory with the user-state storage device process instead of the host kernel, reducing the overhead of switching between kernel state and user state while also achieving zero-copy communication between the virtual machine and the host. Event notification is also one of the advantages of vhost-user. In this architecture, the virtual machine process serves as the front end of communication, and the back end is the vhost-user server process, which can be integrated into the storage service process, as shown below. Figure 1 As shown:

[0004] The Vhost-user protocol implements control semantics through control messages. By defining multiple message types, it enables front-end and back-end state synchronization and functional configuration, including block device creation, network device initialization, device feature negotiation, memory mapping management, and virtqueue configuration. These messages are transmitted over Unix Domain Sockets to ensure efficient and reliable communication. Vhost-user messages are a key control method for the Vhost-user protocol.

[0005] The vhost-user protocol was originally designed for local virtualization scenarios. However, with the development of cloud infrastructure and virtual machine scheduling capabilities, vhost-user has also been introduced into distributed systems. The vhost-user server to which a virtual machine connects does not necessarily have to be local to the host machine, and virtual machines can be moved between nodes in a distributed system at any time. Therefore, high availability of the vhost-user server has become particularly important. In the vhost-user architecture, a target typically refers to a device on the vhost-user server. When a virtual machine mounts a vhost-user target, it may appear as a block device from the virtual machine's perspective.

[0006] In a distributed system, high availability of business virtual machines can usually be achieved through the following mechanisms:

[0007] Active / standby switchover. The active vhost-user target server usually handles all requests. A separate service runs externally to continuously monitor the health of the active server through heartbeats. When the active server fails, it quickly brings up the standby vhost-user target server and switches to it. This method is called live recovery within the same node, as shown below. Figure 2 As shown:

[0008] Failover. When a host machine fails (for example, a hardware failure), the virtual machine is quickly rebuilt on another node. This is called cross-node failover, as shown below. Figure 3 The current vhost-user protocol lacks an effective connection identity recognition mechanism and fine-grained I / O permission control during connection establishment, which exposes significant problems in the high-availability scenario of vhost-user in distributed systems:

[0009] Data corruption occurs when the same client establishes multiple vhost-user connections and binds to the virtqueue simultaneously. Vhost-user clients often feature automatic reconnection or multi-channel concurrency to improve fault tolerance and throughput. However, because the vhost-user protocol itself lacks protection or insufficient authentication of connection identities, the same client instance (i.e., the same virtual machine process or its proxy process) may initiate multiple connections within a short period of time. The virtqueue may be corrupted by multiple connections from the frontend, causing multiple threads or processes to consume and write to the same virtqueue, resulting in data overlap, order distortion, memory race conditions, and other issues. This ultimately leads to data corruption and, in severe cases, can cause the virtual machine or vhost-user target to crash.

[0010] I / O conflicts and data consistency risks during cross-node failover: Cross-node failover occurs when a virtual machine is quickly re-established on another physical node after a host node failure. If the vhost-user target lacks proper I / O permission control, the vhost-user target may accept I / O requests from both the old and new nodes simultaneously, as the VM process instances on the old node cannot be fully shut down. This conflict can easily lead to data inconsistency, compromising the VM's data integrity and transaction atomicity, a particularly serious issue in storage virtualization scenarios.

[0011] Therefore, the vhost-user protocol urgently needs to introduce an identity recognition and connection uniqueness verification mechanism and design a fine-grained I / O permission control mechanism in the vhost-user server to ensure that each virtqueue can only be exclusively bound by one trusted client at any time, eliminating the risks of duplicate binding and data inconsistency from the source. Summary of the Invention

[0012] The purpose of the present invention is to provide a vhost-user identity authentication and I / O authentication method for a distributed system, which solves the above-mentioned technical problems pointed out in the prior art.

[0013] The present invention provides a vhost-user identity authentication and I / O authentication method for a distributed system, comprising the following steps:

[0014] S1. Establish a Unix DomainSocket connection between the front-end virtual machine process and the back-end vhost-user target process;

[0015] S2. The front-end sends an identity registration message to the back-end:

[0016] S21. Construct a VHOST_USER_SET_CONN_IDENTITY message, the payload of which contains a connection digest identifier (cgid) generated based on the node identifier, network identifier, and process identifier. Specifically, the message payload contains a 32-byte globally unique digest value generated using the SHA-256 digest algorithm based on the physical host ID and the host network card MAC address, serving as the connection digest identifier (cgid).

[0017] S22, sending the message through the Socket connection;

[0018] S3, backend performs identity authentication:

[0019] S31. Verify whether the digest identifier (cgid) already exists in the mapping table;

[0020] S32. If the entry does not exist, add the entry to the mapping table and return success; otherwise, return failure.

[0021] S4. The backend only processes I / O requests of successfully registered virtual machine processes;

[0022] S5. Implement distributed permission control for cross-node I / O conflict scenarios:

[0023] S51. Before processing the target I / O for the first time, the vhost-user server requests vhost-io-permission from the leader node. S52. The leader node decides permission allocation based on the global permission table. S53. The vhost-user server processes or rejects the I / O based on the permission status.

[0024] Preferably, as an implementable embodiment, the structure of the payload field of the message consists of 3 header fields and 1 payload field.

[0025] Preferably, as an implementable method; before S31, verifying whether the summary identifier (cgid) already exists in the mapping table, the method further includes:

[0026] The backend connection management module maintains a mapping table of vhost-user target and summary identifiers of registered connections. The mapping table is saved in the memory address space of the backend process. If it is the first time that the frontend attempts identity registration, the backend will add a new table entry and return a successful registration to the frontend.

[0027] Preferably, as an implementable method, the backend only processes I / O requests of successfully registered virtual machine processes, specifically including:

[0028] For subsequent identity registration requests for the vhost-user target, the backend compares it with the registered mapping. If it matches the existing mapping, the backend will identify the request as a duplicate connection and return a registration failure to the frontend.

[0029] The backend ensures that it only processes I / O requests from registered frontends;

[0030] The backend monitors the frontend to socket connection (socket event) and when the connection is disconnected (the virtual machine is shut down), all mappings of the frontend are removed.

[0031] That is, the backend only processes I / O requests with registered digest identifiers (cgid) in the mapping table, and at the same time monitors virtual machine process disconnection events and removes the mapping table entries corresponding to the digest identifiers (cgid).

[0032] Preferably, as an implementable method, S5 further includes a permission synchronization mechanism:

[0033] S54. Each node vhost-user server requests the leader node to synchronously update the local cached permission table through heartbeat;

[0034] S55. The leader node broadcasts the permission table changes to all nodes in real time.

[0035] Preferably, as an implementable method, when a virtual machine migrates across nodes, the following steps are executed:

[0036] S56, before the virtual machine is rebuilt, the Monitor program sends a request to the leader to revoke the original node's permissions;

[0037] S57: The leader deletes all permission entries of the original node and broadcasts the changes.

[0038] S58. After the original node vhost-user server senses the change, it cancels all inflight I / O.

[0039] Preferably, as an implementable method, the global permission table in S52 maintains consistency based on the Raft or Paxos algorithm, and the leader node is generated through election.

[0040] Preferably, as an implementable method, the VHOST_USER_SET_CONN_IDENTITY message structure in step S21 includes:

[0041] 32-bit request field (value = 44);

[0042] 32-bit flags field (the lowest two bits indicate the version number, and the third bit indicates whether the backend needs to reply);

[0043] The 32-bit size field indicates the payload length;

[0044] The payload field is used to carry the digest identifier (cgid).

[0045] Preferably, as an implementation method, before the leader node makes a decision on the authority allocation according to the global authority table, the leader node checks the global authority table.

[0046] Before the node's vhost-user server processes the current target's I / O for the first time, it first requests the leader for the target's vhost-io-permission. The request should include the node's machine ID, virtual machine UUID, and target UUID:

[0047] ;

[0048] If the machine ID in the target UUID table entry is inconsistent with the requesting node, a permission error is returned.

[0049] It should be noted that if the corresponding target table entry is empty, indicating that no other node is currently accessing the target, a new entry is added and persisted, and a success response is returned. After receiving the response, the vhost-user server caches the vhost-io-permission locally and continues processing the I / O. If the corresponding target table entry is not empty and the machine ID in the entry is not equal to the machine ID of the requesting node, an error is returned. After receiving the response, the vhost-user server returns a permission error and refuses to process the current I / O.

[0050] On the other hand, the present invention also provides a computer storage medium storing a computer program, which, when executed by a computer, implements the above-mentioned vhost-user identity authentication and I / O authentication method for distributed systems.

[0051] Compared with the prior art, the embodiments of the present invention have at least the following technical advantages:

[0052] An analysis of the vhost-user identity authentication and I / O authorization method for distributed systems provided by the present invention shows that, in a specific application, a UnixDomain Socket connection is first established between a front-end virtual machine process and a back-end vhost-user target process. The front-end sends an identity registration message to the back-end, constructs a VHOST_USER_SET_CONN_IDENTITY message, the payload field of which contains a connection summary identifier (cgid) generated based on the node identifier, network identifier, and process identifier. The message is then sent via the socket connection.

[0053] Furthermore, the backend performs identity authentication: verifies whether the digest identifier (cgid) already exists in the mapping table; if not, adds the mapping table entry and returns success, otherwise returns failure; the backend only processes I / O requests of the successfully registered virtual machine process;

[0054] To address cross-node I / O conflict scenarios, distributed permission control is implemented: before processing the target I / O for the first time, the vhost-user server requests vhost-io-permission from the leader node; the leader node decides permission allocation based on the global permission table; the vhost-user server processes or rejects the I / O based on the permission status; an embodiment of the present invention provides a vhost-user identity authentication and I / O authorization method for distributed systems, which enhances the vhost-user protocol by adding identity recognition for vhost-user connections and fine-grained I / O permission control. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 This is a schematic diagram of the system architecture of the existing technology;

[0056] Figure 2 This is another system architecture diagram of one of the existing technologies;

[0057] Figure 3 FIG. 1 is another schematic diagram of a system architecture of the prior art;

[0058] Figure 4 This is a schematic diagram of the overall process of a vhost-user identity authentication and I / O authentication method for a distributed system according to the first embodiment of the present invention;

[0059] Figure 5 This is a schematic diagram of the structure of messages in a vhost-user identity authentication and I / O authentication method for a distributed system according to the first embodiment of the present invention;

[0060] Figure 6A schematic diagram of a cross-node failover process of a virtual machine in a vhost-user identity authentication and I / O authentication method for a distributed system according to a first embodiment of the present invention;

[0061] Figure 7 A schematic diagram of a state synchronization mechanism flow in a vhost-user identity authentication and I / O authorization method for a distributed system according to a first embodiment of the present invention;

[0062] Figure 8 This is a schematic diagram of the process of canceling all inflight I / Os in a vhost-user identity authentication and I / O authorization method for a distributed system according to the first embodiment of the present invention. DETAILED DESCRIPTION

[0063] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0064] The present invention will be further described in detail below through specific embodiments in conjunction with the accompanying drawings.

[0065] Example 1

[0066] like Figure 4 As shown, the present invention provides a vhost-user identity authentication and I / O authentication method for a distributed system, including the following steps:

[0067] S1. Establish a Unix DomainSocket connection (hereinafter referred to as Socket connection) between the front-end virtual machine process and the back-end vhost-user target process.

[0068] S2. The front-end sends an identity registration message to the back-end:

[0069] S21. Construct a VHOST_USER_SET_CONN_IDENTITY message (wherein the VHOST_USER_SET_CONN_IDENTITY message may be referred to as a connection identification message). The payload field of the connection identification message includes a connection digest identifier (cgid) generated based on the node identifier, the network identifier, and the process identifier. Specifically, the message payload includes a globally unique 32-byte digest value generated using the SHA-256 digest algorithm based on the physical host ID and the host network card MAC address as the connection digest identifier (cgid).

[0070] S22, sending the message through the Socket connection;

[0071] S3, backend performs identity authentication:

[0072] S31. Verify whether the digest identifier (cgid) already exists in the mapping table;

[0073] S32. If the entry does not exist, add the entry to the mapping table and return success; otherwise, return failure.

[0074] S4. The backend only processes I / O requests of successfully registered virtual machine processes;

[0075] S5. Implement distributed permission control for cross-node I / O conflict scenarios:

[0076] S51. Before processing the target I / O for the first time, the vhost-user server requests vhost-io-permission (i.e., the virtual machine vhost I / O permission cache) from the leader node. S52. The leader node decides permission allocation based on the global permission table. S53. The vhost-user server processes or rejects the I / O based on the permission status.

[0077] In specific applications, a Unix Domain Socket connection is first established between the front-end virtual machine process and the back-end vhost-user target (i.e., back-end) process. The front-end sends an identity registration message to the back-end: a VHOST_USER_SET_CONN_IDENTITY message is constructed, the payload field of which contains a connection summary identifier (cgid) generated based on the node identifier, network identifier, and process identifier. This message is then sent via the socket connection.

[0078] Furthermore, the backend performs identity authentication: verifies whether the digest identifier (cgid) already exists in the mapping table; if not, adds the mapping table entry and returns success, otherwise returns failure; the backend only processes I / O requests of the successfully registered virtual machine process;

[0079] For cross-node I / O conflict scenarios, distributed permission control is implemented: before processing the target I / O for the first time, the vhost-user server requests vhost-io-permission (i.e., virtual host vhost I / O permission information) from the leader node; the leader node decides permission allocation based on the global permission table; the vhost-user server processes or rejects the I / O based on the permission status; an embodiment of the present invention provides a vhost-user identity authentication and I / O authorization method for distributed systems, which enhances the vhost-user protocol by adding identity recognition of vhost-user connections and fine-grained I / O permission control.

[0080] Preferably, as an implementation method, the structure of the payload field of the message consists of 3 header fields and 1 payload field. Figure 5 The first 32-bit field, request, represents an enumeration value of the request type. The protocol defines a unique enumeration value for each message, defining VHOST_USER_SET_CONN_IDENTITY to be 44. The second 32-bit field, flags, is a flag field. The lowest two bits represent the version number, and the third bit indicates whether the backend requires a reply. 0x5 means that the message version number is 1, indicating that the backend requires a reply. The third 32-bit field, size, represents the size of the payload field; the payload field has different meanings depending on the message type.

[0081] The specific structure of the VHOST_USER_SET_CONN_IDENTITY message, including the header fields (request, flags, size) and the payload field (payload), clarifies the meaning and value of each field (such as request=44, flags=0x5, etc.), so that the message has a clear format in the protocol, which is convenient for the front-end and back-end to parse and process according to unified specifications.

[0082] Preferably, as an implementable method; before S31, verifying whether the summary identifier (cgid) already exists in the mapping table, the method further includes:

[0083] The backend connection management module maintains a mapping table of vhost-user target and summary identifiers of registered connections. The mapping table is saved in the memory address space of the backend process. If it is the first time that the frontend attempts identity registration, the backend will add a new table entry and return a successful registration to the frontend.

[0084] The above steps describe that before the backend verifies the cgid, it needs to maintain a mapping table that associates the vhost-usertarget with the registered cgid. When the table entry is added during the first registration, it provides a storage basis for subsequent authentication and ensures that the backend can track the registered connections.

[0085] Preferably, as an implementable method, the backend only processes I / O requests of successfully registered virtual machine processes, specifically including:

[0086] For subsequent identity registration requests for the vhost-user target, the backend compares it with the registered mapping. If it matches the existing mapping, the backend will identify the request as a duplicate connection and return a registration failure to the frontend.

[0087] The backend ensures that it only processes I / O requests from registered frontends. When the backend monitors the frontend-to-Socket connection (socket event) and the connection is disconnected (the virtual machine is shut down), all mappings of the frontend are removed.

[0088] Specifically, the backend only processes I / O requests with a registered digest identifier (cgid) in the mapping table, and simultaneously monitors virtual machine process disconnect events to remove the mapping table entry corresponding to the digest identifier (cgid). Regarding the backend's I / O request processing, it specifies that the backend only processes I / O requests from successfully registered virtual machine processes and removes mapping table entries by monitoring for disconnect events. This ensures that the backend only serves valid, currently active connections, preventing invalid or duplicate connections from occupying resources and ensuring timely resource cleanup.

[0089] The identity recognition mechanism can ensure that the vhost-user target will not submit two front-end I / O requests at the same time in the real-time recovery scenario, but if the virtual machine fails over across nodes, such as Figure 6 As shown in the figure, when a VM fails over across nodes, the hypervisor typically does not immediately terminate the VM process on the old node to ensure fallback to the old node if the VM fails to start on the new node. Furthermore, to minimize service interruption, the hypervisor typically does not wait for I / O requests submitted but not completed on the old node (inflight I / O). Inflight I / O can overwrite new I / O, resulting in a double write (in the example diagram, the next read result is data from B, but data from C is expected). Identity authentication mechanisms cannot effectively address this scenario, requiring a fine-grained distributed I / O permission control mechanism.

[0090] Preferably, as an implementable method, S5 further includes a permission synchronization mechanism:

[0091] S54. Each node vhost-user server requests the leader node to synchronously update the local cached permission table through heartbeat;

[0092] S55. The leader node broadcasts the permission table changes to all nodes in real time. It should be noted that the aforementioned state synchronization mechanism, namely, the vhost-user server utilizes heartbeats to continuously request updates from the leader to its local vhost-io-premission cache, ensuring real-time and consistent permission information across all nodes. This technical solution synchronizes the permission table through the heartbeat mechanism, ensuring consistent permission information across all nodes in real time. This ensures that even if the leader node changes or the network partitions, all nodes can promptly update their permission status, avoiding I / O conflicts caused by inconsistent permission information.

[0093] Regarding the above state synchronization mechanism, it should be noted that the vhost-user server uses heartbeats to continuously request the leader to synchronously update the local vhost-io-premission cache to ensure the real-time and consistency of the permission information of each node.

[0094] The schematic diagram of the above process can be found in Figure 7 ; Figure 7 The cluster shown in the figure consists of three nodes, A, B, and C. C is the leader. The vhost-user server is integrated as a subservice within the storage service process. The leader synchronizes vhost-io-permisson information with other nodes via heartbeats. In addition, each node must run a separate monitoring program, Monitor, which uses heartbeats to monitor the health of the node's storage service.

[0095] Preferably, as an implementable method, when a virtual machine migrates across nodes, the following steps are executed:

[0096] S56, before the virtual machine is rebuilt, the Monitor program sends a request to the leader to revoke the original node's permissions;

[0097] S57: The leader deletes all permission entries of the original node and broadcasts the changes.

[0098] S58. After the original node vhost-user server perceives the change, it cancels all inflight I / Os (i.e., unfinished I / O operations).

[0099] Using the vhost-io-permission I / O permission control mechanism, in scenarios where a VM is hot migrated or rebuilt across nodes, the hypervisor Monitor must first request the leader node to revoke the original node's I / O permissions. This request must be completed before the VM is rebuilt on other nodes. Upon receiving the request, the leader immediately deletes all VhostIOPermission entries related to the old node from the permission table and synchronizes the change with all other nodes. When the vhost-user server on the original node detects the change, it cancels all inflight I / O. For a flowchart, see [http: / / www.rhdl.com / remove-vhost-user-server-remove-vhost-user-server]. Figure 8 .

[0100] Preferably, as an implementable method, the global permission table in S52 maintains consistency based on the Raft or Paxos algorithm, and the leader node is generated through election.

[0101] That is to say, it should be noted that the consistency of the global permission table is maintained by using the Raft or Paxos algorithm, and the leader node is elected. This ensures the high availability and strong consistency of the permission table in a distributed environment and avoids single point failures.

[0102] Preferably, as an implementable embodiment, the VHOST_USER_SET_CONN_IDENTITY message structure in step S21 includes: a 32-bit request field (value = 44); a 32-bit flags field (the lowest two bits of which indicate the version number, and the third bit indicates whether the backend needs to reply); a 32-bit size field indicating the load length; and a payload field used to carry the summary identifier (cgid).

[0103] Preferably, as an implementation method, before the leader node makes a decision on the authority allocation according to the global authority table, the leader node checks the global authority table.

[0104] Before the node's vhost-user server processes the current target's I / O for the first time, it first requests the leader for the target's vhost-io-permission. The request should include the node's machine ID, virtual machine UUID, and target UUID:

[0105] ;

[0106] If the machine ID in the target UUID table entry is inconsistent with the requesting node, a permission error is returned.

[0107] It should be noted that if the corresponding target table entry is empty, indicating that no other node is currently accessing the target, a new entry is added and persisted, and a success response is returned. After receiving the response, the vhost-user server caches the vhost-io-permission locally and continues processing the I / O. If the corresponding target table entry is not empty and the machine ID in the entry is not equal to the machine ID of the requesting node, an error is returned. After receiving the response, the vhost-user server returns a permission error and refuses to process the current I / O.

[0108] Example 2

[0109] The second embodiment of the present invention further provides a computer storage medium storing a computer program. When the computer program is executed by a computer, the vhost-user identity authentication and I / O authentication method for a distributed system provided in the first embodiment above is implemented.

[0110] In summary, the vhost-user identity authentication and I / O authentication method for distributed systems proposed in the example of the present invention ensures the accuracy of vhost-user identity authentication through protocol extension and identity mapping table mechanism, avoids identity confusion, avoids data conflicts through distributed permissions and migration control, and ensures system availability and stability in combination with heartbeat synchronization and consistency algorithm processing.

[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. A person skilled in the art may modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A vhost-user identity authentication and I / O authorization method for distributed systems, characterized in that: The steps are as follows: S1. Establish a Unix Domain Socket connection between the front-end virtual machine process and the back-end vhost-user target process; S2. The front-end sends an identity registration message to the back-end: S21. Construct a VHOST_USER_SET_CONN_IDENTITY message, wherein the payload field of the message includes a connection summary identifier generated based on the node identifier, the network identifier, and the process identifier; S22, sending the message through the Socket connection; S3, backend performs identity authentication: S31, verifying whether the summary identifier already exists in the mapping table; S32. If the entry does not exist, add the entry to the mapping table and return success; otherwise, return failure. S4. The backend only processes I / O requests of successfully registered virtual machine processes; S5. Implement distributed permission control for cross-node I / O conflict scenarios: S51. Before processing the target I / O for the first time, the vhost-user server requests vhost-io-permission from the leader node. S52. The leader node decides permission allocation based on the global permission table. S53. The vhost-user server processes or rejects the I / O based on the permission status.

2. A vhost-user identity authentication and I / O authentication method for a distributed system according to claim 1, characterized in that: The structure of the payload field of the message consists of 3 header fields and 1 payload field.

3. A vhost-user identity authentication and I / O authentication method for a distributed system according to claim 1, characterized in that: Before verifying whether the summary identifier exists in the mapping table, the method further includes: The backend connection management module maintains a mapping table of vhost-user target and summary identifiers of registered connections. The mapping table is saved in the memory address space of the backend process. If it is the first time that the frontend attempts identity registration, the backend will add a new table entry and return a successful registration to the frontend.

4. A vhost-user identity authentication and I / O authentication method for a distributed system according to claim 1, characterized in that: The backend only processes I / O requests from successfully registered virtual machine processes, including: For subsequent identity registration requests for the vhost-user target, the backend compares it with the registered mapping. If it matches the existing mapping, the backend will identify the request as a duplicate connection and return a registration failure to the frontend. The backend ensures that it only processes I / O requests from registered frontends; When the backend monitors the frontend's socket connection and the connection is disconnected (the virtual machine is shut down), all mappings of the frontend are removed. That is, the backend only processes I / O requests with registered digest identifiers in the mapping table, and at the same time monitors virtual machine process disconnection events and removes the mapping table entries corresponding to the digest identifiers.

5. A vhost-user identity authentication and I / O authentication method for a distributed system according to claim 3, characterized in that: S5 also includes a permissions synchronization mechanism to handle operations: S54. Each node vhost-user server requests the leader node to synchronously update the local cached permission table through heartbeat; S55. The leader node broadcasts the permission table changes to all nodes in real time.

6. A vhost-user identity authentication and I / O authentication method for distributed systems according to claim 3, characterized in that: When migrating a VM across nodes, execute: S56, before the virtual machine is rebuilt, the Monitor program sends a request to the leader to revoke the original node's permissions; S57: The leader deletes all permission entries of the original node and broadcasts the changes. S58. After the original node vhost-user server senses the change, it cancels all inflight I / O.

7. A vhost-user identity authentication and I / O authentication method for distributed systems according to claim 3, characterized in that: The global permission table in S52 maintains consistency based on the Raft or Paxos algorithm, and the leader node is elected.

8. A vhost-user identity authentication and I / O authorization method for distributed systems according to claim 3, characterized in that: The VHOST_USER_SET_CONN_IDENTITY message structure in step S21 includes: 32-bit request field; 32-bit flags field; The 32-bit size field indicates the payload length; The payload field is used to carry the summary identifier.

9. A vhost-user identity authentication and I / O authorization method for distributed systems according to claim 8, characterized in that: Before the leader node makes a decision on permission allocation based on the global permission table, the leader node checks the global permission table, including the following steps: Before the node's vhost-user server processes the current target's I / O for the first time, it first requests the leader for the target's vhost-io-permission. The request should carry the node's machine ID, virtual machine UUID, and target UUID: If the target UUID table entry is empty, add a key-value pair (key=target UUID, value=node machine ID+virtual machine UUID) and persist it, returning success; If the machine ID in the target UUID table entry is inconsistent with the requesting node, a permission error is returned.

10. A computer storage medium, characterized in that A computer program is stored, and when the computer program is executed by a computer, the vhost-user identity authentication and I / O authentication method for a distributed system as described in any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Unified para-virtualization framework for heterogeneous encryption and decryption computing resources

    CN116032638A

  • Universal distributed digital identity authentication management method and system with high integration

    CN119011163A

  • Network communication method, device and equipment between virtual machine and host machine

    CN119201341A

  • Elastic cardboard pad for maintaining spacing between fruits in packaging boxes

    KR102720047B1

  • Techniques for identity authentication of virtualized machines

    US20100023996A1