A port connection method, device, apparatus and storage medium
Patent Information
- Application Number
- CN202210753281.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-06-29
AI Technical Summary
[0004]NVMe技术处于刚起步发展阶段,其稳定性还有待进一步提升,同时主机与存储不能够自动建立链接,不支持即插即用,易用性相对较差,针对NVMe over RDMA(RoCE v2)链路连接中,主机无法与存储自动建立连接;同时手动建链,参数容易输入错误,且当链路发生故障(如交换机故障、端口网线拔出等)时,链路无法自动切换
[0047]可见,本申请提供了一种端口连接方法,包括:基于预设的交互协议构建主机端报文,并将所述主机端报文发送至交换机;接收所述交换机发送的目标存储端报文;其中,所述目标存储端报文为所述交换机从存储端发送的全部存储端报文中确定的与所述主机端报文处于同一个业务域内的报文;解析所述目标存储端报文,以获得解析后报文信息;将所述解析后报文信息发送至预创建的子线程,以便在所述子线程中进行对应的端口连接或断开操作。由此可见,本申请通过将预设的交互协议构建主机端报文发送至交换机,以获取到处于同一个业务域内的目标存储端报文,然后将目标存储端报文中包含的信息发送至子线程,基于上述信息进行对应的端口连接或断开操作,避免了手动连接,提高了带宽及错误冗余。
Smart Images

Figure CN115145764B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a port connection method, apparatus, device, and storage medium. Background Technology
[0002] NVMe (Non-Volatile Memory express) is a method for linking and transferring data between a host and a target storage system. NVMe is designed to use faster storage media with non-volatile memory, such as flash memory devices. This type of storage enables low latency, low CPU utilization, and high performance, and is often used as an alternative to SCSI (Small Computer System Interface) storage.
[0003] NVMe storage can be directly connected to the host using a PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) interface, or it can be connected to the host through different architecture transmission media, such as NVMe over Fibre Channel and NVMe over RDMA (Remote Direct Memory Access) (using RoCE v2 technology). NVMe over RDMA (RoCE v2) technology enables remote direct memory access (RDMA) transfers between two systems on a network, allowing data exchange in main memory, thus bypassing the operating system or the processor of either system.
[0004] NVMe technology is in its early stages of development, and its stability needs further improvement. At the same time, the host and storage cannot automatically establish a connection, it does not support plug and play, and its ease of use is relatively poor. In NVMe over RDMA (RoCE v2) link connections, the host cannot automatically establish a connection with the storage; in addition, manual link establishment is prone to parameter input errors, and the link cannot automatically switch when a link fails (such as switch failure, port cable unplugging, etc.). Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a port connection method, apparatus, device, and storage medium that can avoid manual connection and improve bandwidth and error redundancy. The specific solution is as follows:
[0006] In a first aspect, this application discloses a port connection method applied to a host, comprising:
[0007] A host-side message is constructed based on a preset interaction protocol, and the host-side message is sent to the switch;
[0008] Receive the target storage terminal message sent by the switch; wherein, the target storage terminal message is the message that is determined from all storage terminal messages sent by the switch from the storage terminal and is in the same service domain as the host terminal message;
[0009] Parse the target storage terminal message to obtain the parsed message information;
[0010] The parsed message information is sent to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread.
[0011] Optionally, before constructing the host-side message based on a preset interaction protocol, the method further includes:
[0012] The host computer sends first time information to the switch via an automatic connection device; the switch simultaneously receives second time information sent by the storage terminal; the second time information includes a second message notification time interval and a second message validity period.
[0013] Determine the communication protocol and port IP; the port IP includes the host port IP and the storage port IP.
[0014] The preset interaction protocol is determined based on the first time information, the second time information, the communication protocol, and the port IP.
[0015] Optionally, the step of constructing a host-side message based on a preset interaction protocol and sending the host-side message to the switch includes:
[0016] In the packet sending thread, obtain all network card port information of the host and determine the port to be connected according to the preset filtering rules;
[0017] Obtain the host port IP corresponding to the port to be connected;
[0018] The host-side message is constructed based on the first time information, the port to be connected, and the host port IP, and the host-side message is sent to the switch; the first time information includes the first message notification time interval and the first message validity period.
[0019] Optionally, receiving the target storage terminal message sent by the switch includes:
[0020] The target storage terminal message sent by the switch is received in the packet receiving thread;
[0021] The accuracy of the target storage terminal message is determined based on preset message verification rules.
[0022] If the target storage terminal message is accurate, then send message accuracy information to the switch.
[0023] Optionally, parsing the target storage message to obtain parsed message information includes:
[0024] Parse the target storage terminal message to obtain the parsed host port IP, the parsed storage port IP, and the action status bit corresponding to the parsed storage port IP;
[0025] Determine whether the parsed host port IP is consistent with the current host port IP;
[0026] If they match, then proceed with the step of sending the parsed message information to the pre-created sub-thread.
[0027] If there is a discrepancy, the target storage message will be deleted.
[0028] Optionally, sending the parsed message information to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread includes:
[0029] When the parsed host port IP matches the current host port IP, a child thread of the packet receiving thread is created to obtain the pre-created child thread;
[0030] The parsed message information is sent to the pre-created sub-thread;
[0031] When the action status bit indicates that the storage port is online, the automatic connection device queries the preset storage system to see if a connection has been established between the storage port and the host port; the storage port is the port corresponding to the resolved storage port IP, and the host port is the port corresponding to the resolved host port IP;
[0032] If no connection is established between the storage port and the host port, the corresponding connection will be established automatically; if a connection has already been established between the storage port and the host port, it will be maintained.
[0033] When the action status bit indicates that the storage port is offline, the automatic connection device queries the preset storage system for the link controller corresponding to the storage port and the host port. If the link controller is found, the connection is broken.
[0034] Optionally, before constructing the host-side message based on a preset interaction protocol, the method further includes:
[0035] The probe thread periodically queries the port information of the host;
[0036] When the port information changes, the host-side message is updated using the latest port information to obtain an updated message, so that the host can send the updated message to the switch.
[0037] The system detects whether there is any abnormality in the host port. If so, it queries all the link controllers corresponding to the host port in the preset storage system through the automatic connection device, and disconnects all the link controllers concurrently through the sub-thread.
[0038] Secondly, this application discloses a port connection device applied to a host, comprising:
[0039] The first message construction module is used to construct a host-side message based on a preset interaction protocol and send the host-side message to the switch;
[0040] The second message receiving module is used to receive the target storage end message sent by the switch; wherein, the target storage end message is the message determined by the switch from all storage end messages sent from the storage end that is in the same service domain as the host end message;
[0041] The message parsing module is used to parse the target storage message to obtain the parsed message information;
[0042] The information sending module is used to send the parsed message information to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread.
[0043] Thirdly, this application discloses an electronic device, comprising:
[0044] Memory, used to store computer programs;
[0045] A processor for executing the computer program to implement the steps of the port connection method disclosed above.
[0046] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the port connection method disclosed above.
[0047] As can be seen, this application provides a port connection method, including: constructing a host-side message based on a preset interaction protocol and sending the host-side message to a switch; receiving a target storage-side message sent by the switch; wherein the target storage-side message is a message determined by the switch from all storage-side messages sent from the storage end that is in the same service domain as the host-side message; parsing the target storage-side message to obtain parsed message information; and sending the parsed message information to a pre-created sub-thread so that corresponding port connection or disconnection operations can be performed in the sub-thread. Therefore, this application avoids manual connection and improves bandwidth and error redundancy by constructing a host-side message based on a preset interaction protocol and sending it to the switch to obtain a target storage-side message in the same service domain, and then sending the information contained in the target storage-side message to a sub-thread to perform corresponding port connection or disconnection operations based on the above information. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0049] Figure 1 This is a flowchart of a port connection method disclosed in this application;
[0050] Figure 2 This is a schematic diagram of the location of a network topology disclosed in this application;
[0051] Figure 3 This is a flowchart of a specific port connection method disclosed in this application;
[0052] Figure 4 This is a flowchart of a specific port connection method disclosed in this application;
[0053] Figure 5 A schematic diagram of the port connection device structure provided in this application;
[0054] Figure 6 This application provides a structural diagram of an electronic device. Detailed Implementation
[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] Currently, NVMe technology is in its early stages of development, and its stability needs further improvement. Furthermore, hosts and storage cannot automatically establish connections, and plug-and-play functionality is not supported, resulting in relatively poor usability. Specifically, in NVMe over RDMA (RoCEv2) link connections, hosts cannot automatically establish connections with storage; manual link establishment is prone to parameter errors, and the link cannot automatically switch over when a failure occurs, such as a switch failure or unplugging of the port cable. Therefore, this application provides a port connection method that avoids manual connection, improving bandwidth and error redundancy.
[0057] This invention discloses a port connection method, see [link to relevant documentation]. Figure 1 As shown, applied to a host, the method includes:
[0058] Step S11: Construct a host-side message based on a preset interaction protocol and send the host-side message to the switch.
[0059] In this embodiment, a host-side message is constructed based on a preset interaction protocol and sent to the switch. First, an automatic connection device is deployed on the host side, for example, an NVMe over RDMA (RoCE v2) based automatic connection device is set up on the host side. The network topology location of the above device is as follows... Figure 2 As shown, the interaction between the host and storage is achieved through a switch, meaning the host cannot directly interact with the high-performance storage. The host includes an Application, Operating System (OS), multipath software, an auto-connection device, and a RoCE (RDMA over Converged Ethernet) network interface card. The switch deploys lossless Ethernet. The high-performance storage includes a storage front-end interface and NVMe over RoCE. Understandably, the preset interaction protocol includes information reported by the auto-connection device, the switch, and the storage. The host constructs a host-side message based on the preset interaction protocol and sends it to the switch. Similarly, the storage constructs a storage-side message based on the preset interaction protocol and sends it to the switch.
[0060] Step S12: Receive the target storage terminal message sent by the switch; wherein, the target storage terminal message is the message determined by the switch from all storage terminal messages sent from the storage terminal that is in the same service domain as the host terminal message.
[0061] In this embodiment, the switch receives a target storage terminal message sent by the switch. The target storage terminal message is a message determined by the switch from all storage terminal messages sent by the storage terminal that is within the same service domain as the host terminal message. It can be understood that the switch receives host terminal messages sent by the host terminal and storage terminal messages sent by the storage terminal, then determines the message within the same service domain as the host terminal message from the storage terminal messages, identifies this message as the target storage terminal message, and then sends the target storage terminal message to the host. It should be noted that the specific operation process in the storage terminal is similar to that in the host terminal, but the storage terminal only performs the sending part of the operation and does not perform the receiving part of the operation; that is, the storage terminal only sends the generated storage terminal message to the switch and does not receive information from the storage terminal.
[0062] Understandably, the packet sending thread constructs a host-side message based on a preset interaction protocol and sends the host-side message to the switch; the packet receiving thread receives the target storage-side message sent by the switch; and the probe thread periodically queries the port information of the host. The packet sending thread, packet receiving thread, and probe thread are synchronous threads and do not interfere with each other. It should be noted that after receiving the target storage-side message sent by the switch in the packet receiving thread, it determines whether the target storage-side message is accurate based on preset message verification rules. If the target storage-side message is accurate, it sends message accuracy information to the switch. After receiving the message accuracy information, the switch will not resend the same information, avoiding duplicate transmission. The preset message verification rules can be based on agreed-upon rules to verify the format of the target storage-side message, or other pre-agreed verification methods.
[0063] Step S13: Parse the target storage terminal message to obtain the parsed message information.
[0064] In this embodiment, after receiving the target storage terminal packet sent by the switch, the target storage terminal packet is parsed to obtain the parsed packet information. It can be understood that parsing the target storage terminal packet yields the storage terminal port information corresponding to the host terminal port.
[0065] Step S14: Send the parsed message information to the pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread.
[0066] In this embodiment, after parsing the target storage terminal message to obtain the parsed message information, the parsed message information is sent to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread. It can be understood that the sub-thread that creates the packet receiving thread has already obtained the pre-created sub-thread, sends the parsed message information to the pre-created sub-thread, then determines the action status bit of the corresponding storage terminal interface based on the obtained parsed message, and then performs the corresponding port connection or disconnection operation based on the action status bit.
[0067] Understandably, in this solution, the automatic connection device on the host periodically sends host-side packets to the switch via a packet sending thread. These host-side packets contain the ports involved in the connection on each host within the entire service domain and their corresponding port IPs. Then, a packet receiving thread receives online / offline notifications for the target storage ports sent by the switch and performs corresponding operations, thereby achieving rapid connection establishment and automatic fault switching. A probe thread periodically monitors the port status on the host side. When the port status changes, the host-side packets are updated in a timely manner. When a host port fails, the faulty connection is disconnected in a timely manner, thereby achieving rapid switching of service data.
[0068] As can be seen, this application provides a port connection method, including: constructing a host-side message based on a preset interaction protocol and sending the host-side message to a switch; receiving a target storage-side message sent by the switch; wherein the target storage-side message is a message determined by the switch from all storage-side messages sent from the storage end that is in the same service domain as the host-side message; parsing the target storage-side message to obtain parsed message information; and sending the parsed message information to a pre-created sub-thread so that corresponding port connection or disconnection operations can be performed in the sub-thread. Therefore, this application avoids manual connection and improves bandwidth and error redundancy by constructing a host-side message based on a preset interaction protocol and sending it to the switch to obtain a target storage-side message in the same service domain, and then sending the information contained in the target storage-side message to a sub-thread to perform corresponding port connection or disconnection operations based on the above information.
[0069] See Figure 3 As shown, this embodiment of the invention discloses a port connection method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0070] Step S21: The first-time information is sent to the switch through the automatic connection device in the host.
[0071] In this embodiment, the first time information is sent to the switch via the automatic connection device in the host. It is understood that the switch simultaneously receives the second time information sent by the storage terminal. Specifically, the first time information includes a first message notification time interval and a first message validity period, and the second time information includes a second message notification time interval and a second message validity period. The first and second message notification time intervals are custom time intervals, i.e., the time interval for sending the corresponding message to the switch and the validity period corresponding to the aforementioned message. For example, when the validity period of the message obtained by the switch indicates that the message has expired, the switch stops using the expired message for subsequent actions.
[0072] Step S22: Determine the communication protocol and port IP; the port IP includes the host port IP and the storage port IP.
[0073] In this embodiment, the communication protocol and port IP are determined; the port IP includes the host port IP and the storage port IP. It can be understood that if a host-side message is generated on the host side, the port IP contained in the host-side message is the host port IP; if a storage-side message is generated on the storage side, the port IP contained in the storage-side message is the storage port IP.
[0074] Step S23: Determine the preset interaction protocol based on the first time information, the second time information, the communication protocol, and the port IP.
[0075] In this embodiment, the preset interaction protocol is determined based on the first time information, the second time information, the communication protocol, and the port IP. It is understood that the host and storage terminals need to use the preset interaction protocol when generating corresponding messages; that is, the final generated messages all contain information about the preset interaction protocol.
[0076] It should be noted that this solution comprises four parts: interaction protocol agreement, packet sending thread function, packet receiving thread function, and probe thread function. The interaction protocol agreement includes the aforementioned time information, the aforementioned communication protocol, and the aforementioned port IP.
[0077] Step S24: Construct a host-side message based on a preset interaction protocol and send the host-side message to the switch.
[0078] In this embodiment, a host-side message is constructed based on a preset interaction protocol and sent to the switch. It can be understood that in the packet sending thread, all network interface card (NIC) port information of the host is obtained, and the port to be connected is determined according to a preset filtering rule. That is, ports matching the current connection are identified as the ports to be connected. Then, the host port IP corresponding to the port to be connected is obtained. The host-side message is then constructed based on the first time information, the port to be connected, and the host port IP, and sent to the switch. The first time information includes a first message notification time interval and a first message validity period.
[0079] It should be noted that, since the first time information includes the first message notification time interval, the specific information corresponding to the port to be connected is obtained every first message notification time interval (i.e., timed interval), and then a new host-side message is generated based on the above specific information and sent to the switch.
[0080] Step S25: Receive the target storage terminal message sent by the switch.
[0081] Step S26: Parse the target storage terminal message to obtain the parsed message information.
[0082] Step S27: Send the parsed message information to the pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread.
[0083] For details regarding steps S25 to S27, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0084] As can be seen, this embodiment of the application sends first-time information to the switch via an automatic connection device in the host; determines the communication protocol and port IP; the port IP includes the host port IP and the storage port IP; determines the preset interaction protocol based on the first-time information, the second-time information, the communication protocol, and the port IP; constructs a host-side message based on the preset interaction protocol and sends the host-side message to the switch; receives the target storage-side message sent by the switch; parses the target storage-side message to obtain parsed message information; and sends the parsed message information to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread, avoiding manual connection and improving bandwidth and error redundancy.
[0085] See Figure 4 As shown, this embodiment of the invention discloses a port connection method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0086] Step S31: Periodically query the port information of the host in the probe thread.
[0087] In this embodiment, the probe thread periodically queries the host's port information. It is understood that the host's port information may change, therefore the probe thread needs to periodically query the host's port information to promptly detect changes and perform corresponding update operations. It should be noted that the probe thread executes more frequently than the packet sending and receiving threads.
[0088] Step S32: When the port information changes, the host-side message is updated using the latest port information to obtain the updated message, so that the host can send the updated message to the switch.
[0089] In this embodiment, when the probe thread detects a change in the host's port information, it updates the host-side message with the latest port information to obtain an updated message, which the host then sends to the switch. It should be noted that the probe thread can also detect any abnormalities in the host port. If an abnormality is found, the automatic connection device queries the preset storage system for all link controllers corresponding to the host port (or host port IP), and the sub-thread concurrently disconnects all link controllers.
[0090] Step S33: Receive the target storage terminal message sent by the switch.
[0091] Step S34: Parse the target storage terminal message to obtain the parsed host port IP, the parsed storage port IP, and the action status bit corresponding to the parsed storage port IP.
[0092] In this embodiment, after receiving the target storage terminal packet sent by the switch, the target storage terminal packet is parsed to obtain the parsed host port IP, the parsed storage port IP, and the corresponding action status bit of the parsed storage port IP contained in the target storage terminal packet. The parsed host port IP can also be called the destination port IP, and the parsed storage port IP can also be called the source port IP. That is, the target storage terminal packet contains the IP of the storage port itself and the IP of the host port to which the storage port is to connect.
[0093] Step S35: Determine whether the parsed host port IP is consistent with the current host port IP.
[0094] In this embodiment, after obtaining the parsed host port IP, the parsed storage port IP, and the corresponding action status bit of the parsed storage port IP, it is determined whether the parsed host port IP is consistent with the current host port IP. It can be understood that by determining whether the parsed host port IP is consistent with the current host port IP, it is determined whether the host port currently receiving the parsed information is the target port that the storage port corresponding to the target storage terminal packet wants to connect to. If the parsed host port IP is inconsistent with the current host port IP, it indicates that the current host port is not the target port that the storage port wants to connect to, and at this time, the current host port deletes the target storage terminal packet. It should be noted that the deduplication mechanism of sending the parsed host port IP and receiving the action status bit of the target storage terminal packet avoids receiving a large number of duplicate packets.
[0095] Step S36: When the parsed host port IP is consistent with the current host port IP, create a sub-thread of the packet receiving thread to obtain the pre-created sub-thread.
[0096] In this embodiment, when the parsed host port IP matches the current host port IP, a sub-thread of the packet receiving thread is created to obtain the pre-created sub-thread. It can be understood that the parsed host port IP matching the current host port IP indicates that the current host port is the target port that the storage port in the target storage packet wants to connect to.
[0097] Step S37: Send the parsed message information to the pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread.
[0098] In this embodiment, after obtaining the pre-created sub-thread, the parsed message information is sent to the pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread. Specifically, when the action status bit indicates that the storage port is online, the automatic connection device queries the preset storage system to see if a connection has been established between the storage port and the host port. If no connection has been established between the storage port and the host port, the corresponding connection is automatically established; if a connection has been established between the storage port and the host port, it is maintained without any processing. When the action status bit indicates that the storage port is offline, the automatic connection device queries the preset storage system for the link controller corresponding to the storage port and the host port. If the link controller is found, the connection is disconnected; if not found, a prompt is given without any substantial processing. It can be understood that the action status bit indicating that the storage port is online means that the storage port is available; the action status bit indicating that the storage port is offline means that the storage port is unavailable. The storage port is the port corresponding to the parsed storage port IP, and the host port is the port corresponding to the parsed host port IP.
[0099] It should be noted that the preset storage system can be an NVME system, and the aforementioned automatic connection device performs corresponding actions through NVME system commands.
[0100] This solution addresses the issue of the inability to automatically establish a connection between the host and storage in NVMe over RDMA (RoCE v2) link topologies. When a port within the service domain fails, the automatic connection device can promptly and quickly disconnect the connection between the host port and the storage port and establish a new connection with the service port. The active connection device uses an IP-to-IP connection method (i.e., host port IP to storage port IP), which can maximize the IO (Input / Output) throughput between the host and storage and improve error redundancy.
[0101] It should be noted that the key to this method is to pre-determine the interaction protocol, use a packet sending thread to enable each service domain port on the host to communicate with the switch and maintain a heartbeat connection; use a packet receiving thread to parse the target storage terminal packets and reply with acknowledgment information to the switch; use the destination IP (i.e., the host port IP) and action status to deduplicate the target storage terminal packets; use the sub-threads of the packet receiving thread to concurrently and quickly establish or disconnect link connections; and use the probe thread to update the host-side port information, actively detect host-side faults and respond quickly.
[0102] For details regarding step S33, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0103] As can be seen, this embodiment of the application periodically queries the port information of the host in the probe thread; when the port information changes, the host-side message is updated using the latest port information to obtain the updated message, so that the host can send the updated message to the switch; receives the target storage message sent by the switch; parses the target storage message to obtain the parsed host port IP, the parsed storage port IP, and the action status bit corresponding to the parsed storage port IP; determines whether the parsed host port IP is consistent with the current host port IP; when the parsed host port IP is consistent with the current host port IP, creates a sub-thread of the packet receiving thread to obtain the pre-created sub-thread; and sends the parsed message information to the pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread, avoiding manual connection and improving bandwidth and error redundancy.
[0104] See Figure 5 As shown in the illustration, this application also discloses a port connection device applied to a host, comprising:
[0105] The first message construction module 11 is used to construct a host-side message based on a preset interaction protocol and send the host-side message to the switch;
[0106] The second message receiving module 12 is used to receive the target storage end message sent by the switch; wherein, the target storage end message is the message determined by the switch from all storage end messages sent from the storage end that is in the same service domain as the host end message;
[0107] Message parsing module 13 is used to parse the target storage terminal message to obtain parsed message information;
[0108] The information sending module 14 is used to send the parsed message information to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed in the sub-thread.
[0109] As can be seen, this application includes: constructing a host-side message based on a preset interaction protocol and sending the host-side message to a switch; receiving a target storage-side message sent by the switch; wherein the target storage-side message is a message determined by the switch from all storage-side messages sent from the storage end that is within the same service domain as the host-side message; parsing the target storage-side message to obtain parsed message information; and sending the parsed message information to a pre-created sub-thread so that corresponding port connection or disconnection operations can be performed in the sub-thread. Therefore, this application avoids manual connection and improves bandwidth and error redundancy by constructing a host-side message based on a preset interaction protocol and sending it to a switch to obtain a target storage-side message within the same service domain, and then sending the information contained in the target storage-side message to a sub-thread to perform corresponding port connection or disconnection operations based on the above information.
[0110] In some specific embodiments, the first message construction module 11 specifically includes:
[0111] The first time information sending unit is used to send first time information to the switch through the automatic connection device in the host; wherein, the switch simultaneously receives the stored and sent second time information; the second time information includes a second message notification time interval and a second message validity period;
[0112] An information determination unit is used to determine the communication protocol and port IP; the port IP includes the host port IP and the storage port IP.
[0113] An interaction protocol determination unit is used to determine the preset interaction protocol based on the first time information, the second time information, the communication protocol, and the port IP.
[0114] The port information acquisition unit is used to acquire all network card port information of the host in the packet sending thread;
[0115] The port to be connected unit is used to determine the port to be connected according to a preset filtering rule;
[0116] The IP acquisition unit is used to acquire the host port IP corresponding to the port to be connected.
[0117] A host-side message construction unit is used to construct the host-side message based on the first time information, the port to be connected, and the host port IP.
[0118] The host-side message sending unit is used to send the host-side message to the switch; the first time information includes the first message notification time interval and the first message validity period;
[0119] A port information periodic query unit is used to periodically query the port information of the host in the probe thread;
[0120] The host-side message update unit is used to update the host-side message with the latest port information when the port information changes, so as to obtain the updated message, and the host can send the updated message to the switch.
[0121] An anomaly detection unit is used to detect whether there are any anomalies in the host port;
[0122] The first link controller query unit is used to query, if it exists, all the link controllers corresponding to the host port in the preset storage system through the automatic connection device;
[0123] The first link controller disconnection unit is used to concurrently disconnect all the link controllers through the sub-thread. In some specific embodiments, the second message receiving module 12 specifically includes:
[0124] The target storage terminal message receiving unit is used to receive the target storage terminal message sent by the switch in the packet receiving thread;
[0125] The target storage terminal message judgment unit is used to judge whether the target storage terminal message is accurate based on a preset message verification rule;
[0126] The message accuracy information sending unit is used to send message accuracy information to the switch if the message at the target storage terminal is accurate.
[0127] In some specific embodiments, the message parsing module 13 specifically includes:
[0128] The target storage terminal message parsing unit is used to parse the target storage terminal message to obtain the parsed host port IP, the parsed storage port IP, and the action status bit corresponding to the parsed storage port IP.
[0129] The IP determination unit is used to determine whether the resolved host port IP is consistent with the current host port IP.
[0130] The target storage terminal message deletion unit is used to delete the target storage terminal message if there is a discrepancy.
[0131] In some specific embodiments, the information sending module 14 specifically includes:
[0132] A sub-thread creation unit is used to create a sub-thread of the packet receiving thread when the parsed host port IP is consistent with the current host port IP, so as to obtain the pre-created sub-thread;
[0133] The parsed message information sending unit is used to send the parsed message information to the pre-created sub-thread if the messages match.
[0134] A connection establishment judgment unit is used to query, through the automatic connection device, in a preset storage system whether a connection has been established between the storage port and the host port when the action status bit indicates that the storage port is online; the storage port is the port corresponding to the parsed storage port IP, and the host port is the port corresponding to the parsed host port IP.
[0135] A connection establishment unit is used to automatically establish a corresponding connection if no connection has been established between the storage port and the host port.
[0136] A connection holding unit is configured to hold the connection if a connection has been established between the storage port and the host port.
[0137] The second link controller query unit is used to query the link controller corresponding to the storage port and the host port in the preset storage system through the automatic connection device when the action status bit indicates that the storage port is offline.
[0138] The second link controller disconnection unit is used to disconnect if the link controller is found.
[0139] Furthermore, embodiments of this application also provide an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0140] Figure 6 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the port connection method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0141] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0142] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0143] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the port connection method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0144] Furthermore, this application also discloses a storage medium storing a computer program, which, when loaded and executed by a processor, implements the port connection method steps disclosed in any of the foregoing embodiments.
[0145] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0146] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0147] The present invention has provided a detailed description of a port connection method, apparatus, device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A port connection method, characterized in that, Applied to the host, including: In the packet sending thread, a host-side message is constructed based on a preset interaction protocol, and the host-side message is periodically sent to the switch according to the first message notification time interval to maintain a heartbeat connection with the switch; the host-side message includes the validity period of the first message; In the packet receiving thread, the target storage terminal message sent by the switch is received; wherein, the target storage terminal message is the message that is determined from all storage terminal messages sent by the switch from the storage terminal and is in the same service domain as the host terminal message; Parse the target storage terminal message to obtain parsed message information, including the parsed host port IP, the parsed storage port IP, and the action status bit corresponding to the parsed storage port IP; The system determines whether the parsed host port IP matches the current host port IP. If they match, the parsed message information is sent to a pre-created sub-thread. In the sub-thread, the corresponding port connection or disconnection operation is performed concurrently. When the action status bit indicates that the storage port is online, the connection between the storage port and the host port is automatically established using the host port IP to storage port IP method. When the action status bit indicates that the storage port is offline, the connection between the storage port and the host port is automatically disconnected.
2. The port connection method according to claim 1, characterized in that, Before constructing the host-side message based on the preset interaction protocol, the following steps are also included: The host computer sends first time information to the switch via an automatic connection device; the switch simultaneously receives second time information sent by the storage terminal; the second time information includes a second message notification time interval and a second message validity period. Determine the communication protocol and port IP; the port IP includes the host port IP and the storage port IP. The preset interaction protocol is determined based on the first time information, the second time information, the communication protocol, and the port IP.
3. The port connection method according to claim 2, characterized in that, In the packet sending thread, a host-side message is constructed based on a preset interaction protocol, and the host-side message is periodically sent to the switch according to the first message notification time interval, including: In the packet sending thread, all network card port information of the host is obtained, and the port to be connected is determined according to the preset filtering rules; Obtain the host port IP corresponding to the port to be connected; The host-side message is constructed based on the first time information, the port to be connected, and the host port IP, and the host-side message is sent to the switch; the first time information includes the first message notification time interval and the first message validity period.
4. The port connection method according to claim 2 or 3, characterized in that, The step of receiving the target storage terminal message sent by the switch in the packet receiving thread includes: The target storage terminal message sent by the switch is received in the receiving thread; The accuracy of the target storage terminal message is determined based on preset message verification rules. If the target storage terminal message is accurate, then send message accuracy information to the switch.
5. The port connection method according to claim 4, characterized in that, Also includes: If the parsed host port IP does not match the current host port IP, then the target storage packet is deleted.
6. The port connection method according to claim 5, characterized in that, The parsed message information is sent to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed concurrently in the sub-thread. When the action status bit indicates that the storage port is online, the connection between the storage port and the host port is automatically established by using the host port IP to storage port IP method. When the action status bit indicates that the storage port is offline, the connection between the storage port and the host port is automatically disconnected, including: When the parsed host port IP matches the current host port IP, a child thread of the packet receiving thread is created to obtain the pre-created child thread; The parsed message information is sent to the pre-created sub-thread; When the action status bit indicates that the storage port is online, the automatic connection device queries the preset storage system to see if a connection has been established between the storage port and the host port; the storage port is the port corresponding to the resolved storage port IP, and the host port is the port corresponding to the resolved host port IP; If no connection is established between the storage port and the host port, the corresponding connection will be established automatically; if a connection has already been established between the storage port and the host port, it will be maintained. When the action status bit indicates that the storage port is offline, the automatic connection device queries the preset storage system for the link controller corresponding to the storage port and the host port. If the link controller is found, the connection is broken.
7. The port connection method according to claim 6, characterized in that, Also includes: The probe thread periodically queries the port information of the host; When the port information changes, the host-side message is updated using the latest port information to obtain an updated message, so that the host can send the updated message to the switch. The system detects whether there is any abnormality in the host port. If so, it queries all the link controllers corresponding to the host port in the preset storage system through the automatic connection device, and disconnects all the link controllers concurrently through the sub-thread.
8. A port connection device, characterized in that, Applied to the host, including: The first message construction module is used to construct a host-side message based on a preset interaction protocol in the packet sending thread, and periodically send the host-side message to the switch according to the first message notification time interval to maintain a heartbeat connection with the switch; the host-side message includes the validity period of the first message; The second message receiving module is used to receive the target storage end message sent by the switch in the packet receiving thread; wherein, the target storage end message is the message determined by the switch from all storage end messages sent from the storage end that is in the same service domain as the host end message; The message parsing module is used to parse the target storage message to obtain the parsed message information; The message parsing module includes: a target storage terminal message parsing unit, used to parse the target storage terminal message to obtain the parsed host port IP, the parsed storage port IP, and the action status bit corresponding to the parsed storage port IP; and an IP judgment unit, used to judge whether the parsed host port IP is consistent with the current host port IP, and if they are consistent, proceed to the information sending module. The information sending module is used to send the parsed message information to a pre-created sub-thread so that the corresponding port connection or disconnection operation can be performed concurrently in the sub-thread. When the action status bit indicates that the storage port is online, the connection between the storage port and the host port is automatically established by using the host port IP to storage port IP. When the action status bit indicates that the storage port is offline, the connection between the storage port and the host port is automatically disconnected.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the port connection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program; wherein, when the computer program is executed by a processor, it implements the port connection method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method, equipment and system for transmitting messages in an NVMe over Fabric
CN107820693A
Network connection method and device, computer equipment and storage medium
CN113872955A