Serial port switching method and electronic device
By parsing parameter configuration commands and automatically retrieving the status record sequence of child nodes, efficient and accurate serial port switching is achieved in the multi-baseboard management controller architecture server, solving the problem of cumbersome serial port access operations and improving operation and maintenance efficiency and intelligence level.
Patent Information
- Application Number
- CN202610770825.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-29
- Publication Date
- 2026-06-26
AI Technical Summary
In servers with a multi-baseboard management controller architecture, fault serial port access is cumbersome, affecting operation and maintenance efficiency, and existing technologies make it difficult to achieve efficient and accurate serial port switching.
The target identifier parameter is determined by parsing the parameter configuration command and stored in a global variable. The target serial port is determined by directly reading the global variable, or if the target identifier parameter is not specified, the child node status record sequence is automatically retrieved, the target serial port is determined based on the status record, and the serial port connection link is switched to achieve automated serial port access.
It improves the efficiency and accuracy of target serial port determination, simplifies the operation process, avoids tedious manual operations, and improves operation and maintenance efficiency and intelligence level.
Smart Images

Figure CN122285581A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of server management technology, and in particular to a serial port switching method and electronic device. Background Technology
[0002] Modern high-performance, AI (Artificial Intelligence), and multi-node server architectures are becoming increasingly complex, leading to a continuous increase in the number of devices requiring out-of-band monitoring via baseboard management controllers. To improve out-of-band management reliability, refine monitoring granularity, simplify architecture, and increase code reusability, these servers typically integrate multiple baseboard management controllers, each managing different subsystems such as compute nodes and graphics processing unit nodes. Their management architecture is often based on network address translation to achieve flattened management, allowing maintenance personnel to access each baseboard management controller via the compute node's IP address (Internet Protocol version) and port number.
[0003] In a multi-baseboard management controller architecture server, the prerequisite for the LAN serial console to access the node's serial port is that the node's baseboard management controller is functioning normally. Once it crashes, this function becomes unusable, requiring reliance on the physical serial port or the LAN serial console function of the compute node to locate the fault. The physical serial port requires maintenance personnel to go to the data center to connect the serial cable, which is extremely inconvenient. The compute node's function requires issuing multiple dedicated commands sequentially to establish connections between the faulty node's serial port and the compute node's serial port, and between the compute node's serial port and its own LAN serial console's serial port, before the access command can be issued. This cumbersome process severely impacts maintenance efficiency.
[0004] Therefore, the related technologies suffer from the technical problem of cumbersome serial port access operations during faults. Summary of the Invention
[0005] This application provides a serial port switching method and electronic device to at least solve the problem of low accuracy in data hierarchical decision-making in related technologies.
[0006] This application provides a serial port switching method applied to a server device with a multi-management controller architecture. The server device includes a master node and multiple child nodes, including: Receive external access commands. Access commands must conform to the standard management interface and include at least parameter configuration commands and console access commands. The received parameter configuration command is parsed to determine whether the parameter configuration command contains a target identifier parameter. The target identifier parameter is used to specify the serial port type to be accessed. The serial port type includes the serial port corresponding to the master node's own chip and the serial port corresponding to the child node. If the parsed parameter configuration command contains a target identifier parameter, set the target identifier parameter to a valid target identifier parameter and store it in the internal global variable; if the parsed parameter configuration command does not contain a target identifier parameter, maintain the current state of the internal global variable. Parse the received console access command, read the internal global variables, and determine whether a valid target identifier parameter is stored; If a valid target identifier parameter is read, the serial port corresponding to the valid target identifier parameter will be determined as the target serial port; If no valid target identifier parameter is read, retrieve the stored status record sequence of each child node. The status record sequence is arranged in the order of the preset number of the child nodes. Each child node corresponds to one status record. The status record indicates whether the child node is in a fault state or a normal working state. Based on the state record sequence, obtain the state record of each child node, and determine the target serial port based on the state record; Switch the serial port connection link so that external access can be made through the master node to the target serial port.
[0007] This application also provides a serial port switching device applied to a server device with a multi-management controller architecture. The server device includes a master node and multiple child nodes, including: The receiving module is used to receive external access commands. The access commands are commands that conform to the standard management interface and include at least parameter configuration commands and console access commands. The first determination module is used to parse the received parameter configuration command and determine whether the parameter configuration command contains a target identifier parameter. The target identifier parameter is used to specify the serial port type to be accessed. The serial port type includes the serial port corresponding to the master node's own chip and the serial port corresponding to the child node. The storage module is used to set the target identifier parameter as a valid target identifier parameter and store it in the internal global variable if the parameter configuration command is found to contain a target identifier parameter; if the parameter configuration command is found not to contain a target identifier parameter, the current state of the internal global variable is maintained. The judgment module is used to parse the received console access command, read internal global variables, and determine whether a valid target identifier parameter is stored. The second determining module is used to determine the serial port corresponding to the valid target identifier parameter as the target serial port if a valid target identifier parameter is read. The retrieval module is used to retrieve the stored status record sequence of each child node if no valid target identifier parameter is read. The status record sequence is arranged in the order of the preset number of the child nodes, and each child node corresponds to one status record. The status record indicates whether the child node is in a fault state or a normal working state. The third determination module is used to obtain the status records of each child node based on the status record sequence, and determine the target serial port based on the status records; The switching module is used to switch the serial port connection link, allowing external access to the target serial port through the master node.
[0008] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for implementing the steps of any of the serial port switching methods described above when executing the computer program.
[0009] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the above-described serial port switching methods.
[0010] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described serial port switching methods.
[0011] This application utilizes a method that determines whether a target identifier parameter is present by parsing the parameter configuration command. If the target identifier parameter is present, it is set as a valid parameter and stored in a global variable. This allows the target identifier parameter to specify either the main node's own chip serial port or the child node's serial port, meeting the needs of targeted debugging. Furthermore, storing the valid parameter in the global variable enables direct reading during subsequent console access command parsing, eliminating the need to repeatedly parse the parameter configuration command, reducing data processing redundancy, and improving the efficiency of target serial port determination. When parsing console access commands, the global variable is read; if no valid parameter is found, the child node status record sequence is retrieved, eliminating the need for manual investigation of child node status. Manually configuring the target serial port avoids the tediousness and errors of manual operation, improves the automation level of target serial port determination, and the status record sequence is arranged according to the preset number of the child node to ensure the orderliness of the child node status query and avoid the efficiency loss caused by chaotic search. Switching the serial port connection link allows the outside to access the target serial port through the master node. External access does not need to establish a physical or independent logical connection with the target serial port (especially the child node serial port). The link switching and access are realized through centralized management of the master node, which simplifies the serial port access path in multi-node scenarios, avoids the complex operation of accessing multiple nodes separately, and improves the convenience of external access to the target serial port and the efficiency of operation and maintenance. Attached Figure Description
[0012] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1This application provides a schematic diagram of a server management structure. Figure 2 This is a schematic diagram of a serial port switching topology for each node provided in an embodiment of this application; Figure 3 This is a flowchart illustrating a serial port switching method provided in an embodiment of this application. Detailed Implementation
[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0015] It should be noted that, in the description of this application, 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. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0016] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0017] The specific application environment architecture or specific hardware architecture on which the serial port switching method depends is described here.
[0018] Figure 1 This application provides a schematic diagram of a server management structure, as shown in the embodiments of this application. Figure 1As shown, the architecture adopts a "centralized management and control of the master node + distributed deployment of multiple nodes" design. The core architecture includes compute nodes (master nodes), various functional sub-nodes, switching chips, compute node CPLDs (link control terminals), and external operation and maintenance systems. Each compute node and sub-node is independently configured with a BMC (Baseboard Management Controller). All node BMCs are connected to the switching chips via dedicated links, and the compute node BMC is additionally associated with its own CPLD module to achieve serial port link switching control. Each compute node is configured with a dedicated management network port, serving as the sole entry point for the entire architecture to access the external data center network. It also has a built-in NAT (Network Address Translation) module to implement port mapping and address translation functions. When the operation and maintenance system initiates an out-of-band management request based on the standard management interface, it establishes a connection with the computing node management port through the data center network via the access method of "compute node IP + preset port number". With the help of the NAT forwarding function of the compute node BMC, it accurately routes to the target node BMC (including the compute node's own BMC and each child node BMC). It supports the full-process interaction of standard out-of-band management commands such as IPMI. For example, when the IPMISOLactivate command is issued, after the instruction is transmitted to the target BMC through the above path, the compute node CPLD responds with link switching control and establishes a communication link between the command and the target serial port (the serial port of the child node BMC or the default serial port of the compute node BIOS) as needed, ensuring the accurate execution of operation and maintenance commands and the stable return of response data.
[0019] Figure 2 This is a schematic diagram of a serial port switching topology for each node provided in an embodiment of this application, as shown below. Figure 2 As shown, each child node in the AI server, such as the switching node and GPU node, is configured with an independent BMC and a local CPLD. These nodes establish a heartbeat interaction mechanism via an I2C communication link. The child node BMC accesses its local CPLD via I2C at preset intervals. This link simultaneously handles heartbeat detection and data transmission. When the child node CPLD does not detect a BMC heartbeat signal within a preset time, it determines that the child node BMC is in a fault-bound state. Subsequently, the child node CPLD reports its own BMC status (normal / faulty) to the compute node CPLD via the preset SGPIO communication link shown in the image. The compute node BMC then accesses its own CPLD via the I2C link, thus obtaining the real-time status information of all child node BMCs, forming a complete monitoring link of "child node status - compute node management".
[0020] The compute node BMC has a built-in target serial port identifier parameter (index), whose initial value is preset to 0xFF (invalid state, corresponding to "initial invalid state" in the priorities). When a user needs to specify access to the internal chip serial port of the compute node, they can send the IPMIOEM command to the compute node BMC to specify the target serial port type: if accessing the compute node BIOS serial port is specified, configure index=0; if accessing the compute node's own BMC serial port is specified, configure index=1. After receiving the command, the compute node BMC writes the configuration instruction to its own CPLD register via the I2C link, triggering the compute node CPLD to complete the link switch and establish a dedicated connection between the specified chip serial port and the compute node BMC's SOLUART port. At this time, the IPMISOLactivate command is issued, and the external maintenance terminal can obtain the output information of the target serial port through this link. When the user issues the IPMISOLdeactivated command to terminate the SOL session, the compute node BMC automatically resets the index to 0xFF and restores the initial link configuration.
[0021] When a user issues the IPMISOLactivate command directly to the compute node BMC without specifying a target serial port, the compute node BMC prioritizes reading the index parameter. If the index is detected to be 0xFF (unspecified status), it immediately reads the child node BMC status record stored in its own CPLD via the I2C link (i.e., the status data reported by the child node CPLD via SGPIO). Subsequently, the compute node BMC writes control instructions to its own CPLD via I2C, triggering the compute node CPLD to perform a link switch, establishing a connection between the serial port of the child node BMC with the status of deactivated and the SOLUART port of the compute node BMC. At this time, the serial port information of the faulty child node BMC is displayed on the external maintenance terminal. If the compute node BMC detects that the number of child nodes with the status of deactivated is ≥2, it will start a loop traversal mechanism, generating a status record sequence according to the preset number order of the child nodes. Each time the IPMISOLactivate command is issued, it switches to the serial port of the next faulty child node BMC in the sequence, realizing the polling display of the serial port information of the faulty child nodes, ensuring that all faulty nodes can be accurately diagnosed.
[0022] The embodiments of this application provide a serial port switching method, and the method is described in detail in conjunction with the execution flow of the serial port switching method.
[0023] Reference Figure 3 The diagram shown illustrates the serial port switching method provided in this application, applied to a server device with a multi-management controller architecture. The server device includes a master node and multiple child nodes. The specific steps are as follows: S101. Receive external access commands, which are commands that conform to the standard management interface.
[0024] The access commands include at least parameter configuration commands and console access commands.
[0025] Specifically, the master node's command receiving module remains in a ready state, receiving access commands issued by the external operation and maintenance system through a preset network communication path (such as the network link corresponding to the master node's management network port). The external access commands include parameter configuration commands for specifying the parameters of the serial port to be accessed and console access commands for initiating serial port data interaction. After receiving the command, the interface format and protocol type of the command are first verified to confirm that both the parameter configuration command and the console access command conform to the preset standard management interface specifications (such as command field structure and protocol interaction process). If the verification is successful, the subsequent command parsing process is triggered; if the verification fails, an invalid command message is returned.
[0026] For example, the operation and maintenance system sends access commands conforming to the standard management interface (e.g., the "IPMIsolactivate command") to the management controller of the master node (also known as the compute node) through the network access path (the compute node's IP address + port number). This includes parameter configuration commands (such as the IPMIOEM command, used to specify the index parameter of the serial port to be accessed) and console access commands (such as the IPMISOLactivate command, used to start a serial port session). After receiving the command, the management controller of the master node verifies that it conforms to the intelligent platform management interface standard (e.g., the "IPMI (Intelligent Platform Management Interface) standard"), confirms that the command format is valid and the protocol matches, and then proceeds to the command parsing step.
[0027] In this embodiment, a standardized serial port access triggering mechanism covering both parameter configuration and console access scenarios is established by receiving management interface commands that conform to general standards, without relying on customized or non-standard commands. On the one hand, this ensures the universality and compatibility of parameter configuration commands (such as commands specifying the identifier parameters of the target serial port) and console access commands (such as commands to start a serial port session), avoiding device adaptation limitations caused by the use of proprietary formats for the two types of commands. On the other hand, it simplifies the operation and maintenance process. Maintenance personnel do not need to memorize the proprietary formats of the two types of commands; they can initiate parameter configuration or console access simply through industry-standard management commands, significantly reducing the operational threshold while ensuring that the access triggering logic of the two types of commands is unified, thus improving overall access efficiency.
[0028] S102. Parse the received parameter configuration command and determine whether the parameter configuration command contains the target identifier parameter.
[0029] The target identifier parameter is used to specify the type of serial port to be accessed. The serial port type includes the serial port corresponding to the master node's own chip and the serial port corresponding to the child node.
[0030] Specifically, the master node performs structured parsing on the received parameter configuration commands, extracts the parameter fields from the commands, and determines whether there is a target identifier parameter used to identify the serial port access object. The encoding rules of the target identifier parameter are predefined to clarify its mapping relationship with the serial port type. This parameter can correspond to the serial port of the master node's own chip (such as the basic input / output system or the master node management controller) or the serial port of each child node. If the parameter is parsed, S103 is executed. If it is not parsed, the global variable is kept in the initial invalid state, and the automatic matching logic of the child node status record sequence is triggered when the console accesses it later.
[0031] For example, the master node's management controller parses the received parameter configuration commands (e.g., "IPMIOEM command"), extracts the parameter fields in the command, and determines whether it contains a target identifier parameter (e.g., "index parameter"). The encoding rules for this target identifier parameter are preset as follows: 0 corresponds to the master node's own Basic Input / Output System (BIOS) serial port, 1 corresponds to the master node's management controller serial port, 2 corresponds to the child node's 0 serial port, 3 corresponds to the child node's 1 serial port, and so on, thus clarifying the correspondence between the parameters and various serial ports of the master node and child nodes.
[0032] In this embodiment, by focusing on the structured parsing of parameter configuration commands, target identifier parameters are extracted to clarify the user's serial port access intent, laying the foundation for subsequent console access commands (such as SOL activate) to quickly locate the target serial port. The responsibilities of parameter configuration and console access commands are separated. The parameter configuration command is specifically used to preset the target identifier, avoiding repeated parameter parsing during subsequent console access and improving serial port access efficiency. Through the preset mapping relationship between parameters and serial port types, it supports users actively specifying the master or child node serial port, meeting targeted debugging needs, and also provides a premise for triggering automatic matching logic of child node status when parameters are not parsed. This balances the accuracy of manual specification with the convenience of automated operation and maintenance, significantly improving the flexibility of serial port access in a multi-node architecture.
[0033] In one specific embodiment, before receiving an external access command that conforms to the standard management interface, each child node checks its own working status to determine whether it is in a fault state; based on the fault state, it generates a status record, and in response to the status record indicating a fault state, the child node reports the status record to the master node.
[0034] Specifically, each sub-node initiates its own operational status detection mechanism, performing a self-inspection process according to a preset cycle. The detection dimensions focus on the availability of the sub-node's core operating components (such as the sub-node management controller and core communication links). Based on the detection results, a standardized status record is generated, which only contains two types of identifiers: fault status and normal working status, ensuring that the data is concise and can be quickly parsed. Fault-triggered reporting rules are set, and the sub-node only sends the status record to the master node through a preset communication link (a standard link adapted to the master node) when the status record is a fault status. If it is a normal working status, it does not actively report, but only keeps the local status updated. The master node defaults to the normal status of sub-nodes that have not reported, thereby simplifying communication logic and reducing redundancy.
[0035] In this embodiment, in a server with a multi-management controller architecture, the working status of each sub-node is automatically detected and it is determined whether it is in a fault state. Without the need for maintenance personnel to conduct manual inspections or on-site troubleshooting in the data center, the operating status data of each sub-node can be obtained in real time and accurately. This provides reliable data support for subsequent automatic determination of the target serial port based on the fault status and the realization of adaptive serial port switching. It effectively avoids the cumbersome operation of traditional fault diagnosis relying on physical serial ports or multiple dedicated commands, significantly shortens the fault node identification time, improves the intelligence level and operation and maintenance efficiency of out-of-band management of multi-sub-node servers, and ensures the consistency and accuracy of fault status judgment, laying a solid foundation for fault location and problem diagnosis.
[0036] S103. If the parsed parameter configuration command contains a target identifier parameter, set the target identifier parameter as a valid target identifier parameter and store it in the internal global variable; if the parsed parameter configuration command does not contain a target identifier parameter, maintain the current state of the internal global variable.
[0037] Specifically, after parsing the parameter configuration command and extracting the target identifier parameter, the master node verifies whether the parameter is a valid serial port identifier by comparing it with preset parameter encoding rules (such as the mapping relationship between parameter values and serial port types, and the parameter value range). If the verification is successful, the parameter is marked as a valid target identifier parameter, and its corresponding serial port access object (master node's own chip serial port or child node serial port) is identified. The valid target identifier parameter is written into a preset global variable inside the master node. This global variable has cross-command type read permissions and is specifically used to provide parameter support for subsequent console access commands, ensuring that the parameter configuration result can be directly called, avoiding data redundancy and duplicate processing. If the target identifier parameter fails the verification, the target identifier parameter is not saved, the current state of the internal global variable is maintained, and an invalid parameter prompt message is returned to the external access terminal.
[0038] In this embodiment, by validating and globally storing the target identifier parameter extracted from the parameter configuration command, a parameter configuration-subsequent call association mechanism is established. The parameter validity verification ensures that the target identifier parameter conforms to the preset encoding rules, avoiding serial port access failures caused by invalid or erroneous parameters and improving access accuracy. Valid parameters are stored in internal global variables, enabling parameter reuse across steps. Subsequent console access commands do not need to repeatedly parse the parameter configuration command; they can directly read and lock the target serial port, significantly shortening the target serial port determination time. At the same time, it provides stable data support for specified serial port access and ensures the orderly switching of serial ports in a multi-node architecture.
[0039] S104. Parse the received console access command, read the internal global variables, and determine whether a valid target identifier parameter is stored.
[0040] Specifically, the master node's command receiving module receives console access commands from external sources. It performs secondary verification of the command's format and protocol type (ensuring it originates from the same source as the parameter configuration command and conforms to the standard). Upon successful verification, it initiates the parsing process, clarifying that the core requirement of the command is to initiate a serial port session. The master node calls the internal global variable reading interface to extract the stored parameter status (valid target identifier parameter or initial invalid state). Based on the reading result, it performs a secondary judgment: if the global variable stores a valid target identifier parameter conforming to the preset encoding rules, it triggers the subsequent process of matching the specified serial port; if the global variable is in an initial invalid state, it triggers the subsequent process of retrieving the child node's status record sequence, ensuring that the console access command can adapt to different access scenarios according to the parameter configuration.
[0041] In this embodiment, by parsing console access commands and reading global variables, the logical linkage between the two types of commands is realized. Following the parameter configuration results of S103, if a valid target identifier parameter exists, the target serial port can be directly locked, avoiding additional status queries and matching operations, and improving the response speed of serial port access. If no valid target identifier parameter is found, the automatic matching logic of the subsequent child node status record sequence can be triggered, realizing seamless switching between specified access and automatic matching access, taking into account both targeted debugging and automated operation and maintenance needs, and greatly improving the flexibility and adaptability of serial port access under multi-node architecture.
[0042] S105. If a valid target identifier parameter is read, the serial port corresponding to the valid target identifier parameter is determined as the target serial port.
[0043] Specifically, after a valid target identifier parameter is read from the internal global variable, the preset "parameter-serial port" mapping table is retrieved, and the corresponding serial port object is found according to the specific value of the parameter. The validity of the search result is verified to confirm that the serial port object is in an accessible state (such as normal hardware link). If the verification is successful, the serial port is identified as the target serial port, and the valid target identifier parameter is recorded for reset after the access is completed. If the verification fails, a serial port inaccessible prompt is returned.
[0044] For example, if the master node's management controller parses an access command containing a valid target identifier parameter (e.g., "index=0"), it retrieves the preset mapping table to confirm that the parameter corresponds to the master node's own basic input / output system serial port; after verifying that the hardware link of the serial port is connected normally, it determines it as the target serial port; if the target identifier parameter is parsed as "index=2", then the serial port corresponding to child node 0 is determined as the target serial port, and the link connection will be configured according to the target serial port in the future.
[0045] In this embodiment, based on the valid target identifier parameters specified by the user, the serial port to be accessed is directly located and locked, realizing precise control of serial port access and meeting the needs of maintenance personnel for targeted debugging. For example, when it is necessary to prioritize troubleshooting specific master node chips or specific child nodes, the target serial port can be directly specified through parameters without the need for automatic system traversal, shortening the access path and improving the accuracy and efficiency of debugging.
[0046] S106. If no valid target identifier parameter is read, retrieve the stored state record sequence of each child node.
[0047] The status record sequence is arranged in the order of the preset numbers of the sub-nodes. Each sub-node corresponds to a status record, and the status record indicates whether the sub-node is in a fault state or a normal working state.
[0048] Specifically, when no valid target identifier parameter is read from the internal global variables, a status data retrieval instruction is triggered. The status storage unit of the master node pre-stores a sequence of status records arranged in the order of preset numbers (such as 0, 1, 2...N-1) of the child nodes. Each record corresponds one-to-one with a child node and is clearly marked with a preset identifier (such as binary code or specific character) to indicate the working status (fault or normal) of the child node. After the master node retrieves the sequence, it organizes and presents it in the order of the numbers to provide ordered data for subsequent traversal and selection of target serial ports.
[0049] For example, if the master node's management controller parses the access command and finds that it does not contain the target identifier parameter (e.g., "index=0xFF"), it triggers a retrieval instruction to read the status record sequence stored in the master node's centralized processing unit. This sequence is arranged in the order of the child node's preset numbers 0, 1, 2... and each record uses binary to identify the status: 1 indicates that the child node is in a fault state (deactivated), and 0 indicates that the child node is in a normal working state (activated). After retrieval, it is used for subsequent target serial port selection.
[0050] In this embodiment, when no valid target identifier parameter is read from the internal global variables, the status data of the child node is automatically retrieved to provide data support for subsequent priority matching of the serial port of the faulty node. This enables the automatic identification and association of faulty nodes, eliminating the need for maintenance personnel to manually check the status of each child node. It is especially suitable for scenarios with multiple child nodes and multiple faults, significantly reducing manual intervention and improving the efficiency and intelligence level of accessing the serial port of the faulty node.
[0051] S107. Based on the state record sequence, obtain the state record of each child node, and determine the target serial port based on the state record.
[0052] In this embodiment, an automatic matching mechanism of "status-serial port" is established. The target serial port is accurately selected from the status record sequence according to the fault status of the sub-node. The fault node can be preferentially associated without manual specification, realizing the automatic location of the serial port of the fault node. This avoids the maintenance personnel from manually checking the status of each sub-node, greatly shortens the preparation time for serial port access, and adapts to multi-fault node scenarios. It takes into account both access efficiency and comprehensiveness, and improves the intelligence level of out-of-band management of multi-node servers.
[0053] Specifically, the above S107 can be further refined into the following steps 1071 to 1073: Step 1071: Starting from the current query position in the status record sequence, traverse the status records of each child node in turn. When a child node marked as faulty is encountered, determine the serial port corresponding to the child node as the target serial port and update the current query position to the next number position of the child node.
[0054] Specifically, the traversal starts from the current query position in the status record sequence, reads the status record of each child node one by one and determines whether it is a fault state; if the status of a child node is faulty, the serial port corresponding to the child node is directly locked as the target serial port; then the current query position is updated to the next position of the child node number to ensure that the next traversal starts from the subsequent node, avoids repeatedly processing the already visited nodes, and ensures traversal efficiency.
[0055] For example, if the current query position is 0 (e.g., "NodeIndex=0"), the master node starts traversing from the child node with the status record sequence number 0, reads its status record as a fault identifier (e.g., "state[0]=1"), and then determines the serial port corresponding to the child node with the number 0 as the target serial port; then the current query position is updated to 1 (e.g., "NodeIndex++"), so that when the next external access command is received, it starts traversing from the child node with the number 1, realizing the ordered polling access of the faulty node.
[0056] In this embodiment, a strategy of "sequential traversal + real-time update of query position" is adopted. The faulty nodes are matched from the current position backward first, which ensures the continuity and efficiency of access, avoids repeated traversal of normal nodes that have been checked, shortens the path length of a single query, improves the access response speed of the serial port of the faulty node, and at the same time, by updating the query position, it lays the foundation for traversing subsequent faulty nodes in the next access, and adapts to the polling access requirements of multiple faulty nodes.
[0057] Step 1072: If no child node marked as faulty is found when traversing from the current query position to the end of the status record sequence, continue traversing from the beginning of the status record sequence to the current query position. If a child node marked as faulty is found during the traversal, the serial port corresponding to the child node is determined as the target serial port, and the current query position is updated.
[0058] Specifically, the process iterates backward from the current query position to the end of the sequence. If no fault status child node is found, a loop traversal instruction is triggered, and the process continues to traverse backward from the beginning of the sequence to the current query position. During the second traversal, the status record of each child node is checked one by one. If a fault status child node is found, its corresponding serial port is determined as the target serial port, and the current query position is updated to the next position of that child node number. If the second traversal still does not find the target serial port, the default serial port matching process is entered.
[0059] For example, the current query position is 3 (e.g., “NodeIndex=3”), the status record sequence contains 5 child nodes numbered 0-4, and no fault status child node is found when traversing from number 3 to 4 (e.g., “state[3]=0, state[4]=0”); then the master node starts from the beginning position 0 of the sequence and traverses forward to number 2. When it traverses to number 1 child node, it finds that its status is a fault identifier (e.g., “state[1]=1”), then the serial port corresponding to number 1 child node is determined as the target serial port, and the current query position is updated to 2 (e.g., “NodeIndex=2”).
[0060] In this embodiment, the entire state record sequence is covered by a "loop traversal" mechanism to avoid missing fault nodes in the earlier part of the sequence due to the query position being in the later part of the sequence. This ensures that all fault nodes can be detected, satisfying the access requirements under multiple fault scenarios without omission, while maintaining the simplicity of the traversal logic. There is no need to add additional complex query algorithms, ensuring comprehensiveness without reducing access efficiency.
[0061] Step 1073: If no child node marked as faulty is found after traversing the entire state record sequence, the preset default serial port is determined as the target serial port; the default serial port is the serial port corresponding to the basic input and output functions of the master node itself.
[0062] Specifically, after completing the full sequence verification of "traversing backward from the current position + traversing forward from the starting position", if the status records of all child nodes are marked as normal, the preset default serial port configuration is retrieved. The default serial port is preset to the serial port corresponding to the basic input and output functions of the master node itself. This serial port does not depend on the status of the child nodes and is always in an accessible state. This default serial port is determined as the target serial port to ensure that external access commands can be executed normally.
[0063] For example, after the master node completes the state traversal of all child nodes numbered 0-4, it finds that the state records of all child nodes are normal (e.g., "state[0]-state[4] are all 0"). At this time, the master node calls the preset default serial port configuration and determines the serial port corresponding to the master node's own basic input and output functions as the target serial port, ensuring that external access commands can perform low-level debugging or status query of the master node through the default serial port.
[0064] In one specific embodiment, upon receiving an access termination command, the target identifier parameter is reset to its initial invalid state, and the current query position is reset to the starting position of the status record sequence.
[0065] Specifically, after the master node receives the access termination command from the outside, it triggers the parameter reset command. On the one hand, it restores the previously parsed target identifier parameter to the initial invalid state (the default state when no serial port is specified), and on the other hand, it resets the current query position to the starting position of the status record sequence. After the reset operation is completed, the master node waits for the next external access command to ensure that the traversal conditions when the new command is executed are consistent with the initial state.
[0066] For example, when the master node receives an access termination command (e.g., "IPMIsoldeactivated command"), it resets the target identifier parameter to the initial invalid state (e.g., "Index=0xFF"), and at the same time resets the current query position (NodeIndex) to the starting position 0 of the status record sequence; after the reset is completed, the master node returns to the initial waiting state to ensure that when it receives an external access command again, it can redetermine the target serial port according to the standard traversal logic.
[0067] In this embodiment, a fallback default serial port mechanism is set up to ensure the availability of serial port access when there are no faulty nodes, avoid access failure due to the lack of a target serial port, ensure the continuity and stability of serial port access, and even if all child nodes are working normally, the master node can still perform low-level debugging or status query through the default serial port, meet the management needs of operation and maintenance personnel for the master node, and improve the full-scenario adaptability of serial port access.
[0068] S108. Switch the serial port connection link so that external access can be made to the target serial port through the master node.
[0069] In this embodiment, an automated link switching mechanism of "identification-control-connection" is established, which can achieve precise connection between external access and target serial port without manual intervention. It adapts to multiple scenarios such as accessing faulty nodes and debugging specified serial ports, and gets rid of the cumbersome operation of traditional physical serial port wiring or multi-step dedicated command configuration. Automatic link switching can be triggered by standard management commands, which greatly shortens the preparation time for serial port access, ensures the smoothness of data transmission, and ensures the stability and reliability of the switching process. This significantly improves the operation and maintenance efficiency and intelligence level of out-of-band management of multi-node servers.
[0070] Specifically, the above S108 can be further refined into the following steps 1081 to 1089: Step 1081: Determine the link identification information corresponding to the target serial port.
[0071] The link identification information corresponds to the transmit and receive path of the target serial port and is associated with the communication parameters of the master node access port.
[0072] Specifically, the master node pre-stores a mapping table of "target serial port - link identifier". The link identifier information includes the transmit and receive path code of the target serial port (used to locate the physical transmission path) and the communication parameters of the master node access port (such as baud rate, data bits, parity bits, etc., used to ensure data transmission compatibility). After determining the target serial port, the master node retrieves the mapping table and extracts the corresponding link identifier information according to the type of the target serial port (master node's own chip serial port / child node serial port), ensuring that the identifier information corresponds one-to-one with the target serial port and that the communication parameters conform to the standard management interface specification.
[0073] For example, in the master node's preset mapping table, the serial port link identifier corresponding to the master node's basic input / output functions is "code 0 + communication parameters (9600 baud rate, 8 data bits)", the serial port link identifier corresponding to child node 0 is "code 2 + communication parameters (9600 baud rate, 8 data bits)", and the serial port link identifier corresponding to child node 1 is "code 3 + communication parameters (9600 baud rate, 8 data bits)". When the target serial port is determined to be the serial port corresponding to child node 0, the master node retrieves the mapping table and extracts its link identifier information: path code 2, and associates it with the communication parameters such as 9600 baud rate and 8 data bits of the master node's standard management interface access port to ensure data transmission adaptation after subsequent switching.
[0074] In this embodiment, a unique link identifier is assigned to the target serial port, clarifying its transmit and receive paths and the adaptation parameters with the master node's access port. This provides a positioning basis for subsequent switching control, avoids switching errors caused by link identifier confusion, and ensures that the switching control signal can accurately point to the target serial port. At the same time, by associating communication parameters, the compatibility and stability of data transmission after switching are guaranteed, laying the foundation for efficient link switching.
[0075] Step 1082: Generate a handover control signal based on the link identification information.
[0076] The switching control signal includes the target serial port path code, transceiver matching parameters, and switching execution timing instructions.
[0077] Specifically, the master node extracts the path code (used to locate the target serial port link) and transceiver matching parameters (used to establish the TX / RX correspondence between the target serial port and the master node's access port) from the link identification information; combined with preset switching execution timing rules (such as signal sending timing, waiting response duration, etc.), the three are integrated into a structured switching control signal; the format of the control signal conforms to the receiving specifications of the link control end, ensuring that the link control end can quickly parse and execute it.
[0078] For example, the master node generates a switching control signal based on the link identification information (encoding 2, 9600 baud rate, 8 data bits) of the serial port of the child node 0: the path encoding is "0x02", the transceiver matching parameters are "target serial port TX, master node access port RX, target serial port RX, master node access port TX", and the switching execution timing instruction is "send control signal and wait for 10ms confirmation response". The format of this control signal is adapted to the receiving specifications of the link control end, ensuring that the link control end can quickly parse the target link to be switched and the execution rules.
[0079] In this embodiment, the link identification information is converted into standardized handover control signals, clarifying the core instructions for link handover, ensuring that the link control end can identify and execute the handover operation, realizing the standardized generation of handover control signals, avoiding handover failure or erroneous handover due to ambiguous instructions, and at the same time, by including timing instructions, ensuring the orderly execution of handover operations, improving the accuracy and efficiency of link handover.
[0080] Step 1083: Send the switching control signal to the link control terminal according to the preset communication protocol to trigger the configuration adjustment of the serial port connection link, so that the receiving end of the target serial port establishes a connection with the transmitting end in the master node port, and at the same time establishes a connection between the transmitting end of the target serial port and the receiving end in the master node port, so that external access can access the target serial port through the master node.
[0081] Specifically, the master node sends the generated switching control signal to the link control terminal according to a preset communication protocol (such as I2C, SGPIO, etc., adapted to the communication method of the link control terminal). After receiving the signal, the link control terminal parses the path code, matches parameters and timing instructions, and adjusts the connection relationship of the internal links so that the receiving end of the target serial port establishes a corresponding connection with the sending end in the master node port, and the sending end of the target serial port establishes a corresponding connection with the receiving end in the master node port. After the link configuration adjustment is completed, external access requests can enter through the master node access port and be routed to the target serial port through the switched link, realizing the connection between external access and the target serial port.
[0082] For example, the master node sends a switching control signal to the link control terminal according to the preset I2C communication protocol. After parsing the path code "0x02", the transceiver matching rules and timing instructions, the link control terminal adjusts the internal link connection so that the TX terminal of the child node's 0 serial port is connected to the RX terminal of the master node's standard management interface access port, and the RX terminal of the child node's 0 serial port is connected to the TX terminal of the master node's access port. After the link configuration is completed, the access request initiated by the operation and maintenance system through the master node's IP + port number enters through the master node's access port and is directly routed to the child node's 0 serial port through the switched link, realizing the connection between external access and the target serial port.
[0083] In this embodiment, a standardized communication protocol is used to transmit switching control signals, triggering automatic link configuration and enabling bidirectional connection between the target serial port and the master node access port. Link connection can be completed without manual intervention, eliminating the limitations of traditional physical wiring or multi-step command configuration. This achieves automated and remote link switching, significantly improving operational convenience while ensuring connection accuracy. External access can be directly connected to the target serial port through the master node, shortening the access path and improving data transmission efficiency.
[0084] Step 1084: Send a connection verification signal to detect the link connectivity status between the target serial port and the master node access port.
[0085] Specifically, after the link configuration is adjusted, the master node's access port sends a preset connection verification signal (such as a binary data string in a specific format) to the target serial port. This signal is transmitted to the target serial port according to the switched link path. If the link is connected normally, the target serial port will receive and send back a response signal. The master node continuously checks whether it receives a feedback response signal within a preset time to determine the link connection status. If no feedback is received or the feedback signal is abnormal, the link connection is determined to have failed, triggering the subsequent re-switching process.
[0086] For example, after the master node completes the link configuration between the serial port and access port of the child node 0, it sends a connection verification signal through the access port of the master node: a string of preset binary data "01010101". This signal is transmitted to the serial port of the child node 0 through the switched link. If the link is connected normally, the serial port of the child node 0 will send back the same binary data "01010101" after receiving it. The master node starts a timer with a preset feedback waiting time of 50ms. During the timer, it continuously checks whether a feedback signal is received to determine whether the link is connected.
[0087] In this embodiment, by sending a verification signal, the connectivity of the switched link is checked to ensure that the target serial port and the master node access port can transmit data normally, avoid access failure due to abnormal link configuration, troubleshoot link connection problems in advance, reduce the risk of interruption in subsequent data transmission, ensure the stability and reliability of serial port access, and provide a trigger basis for readjustment when the link switching is abnormal, thereby improving the fault tolerance of the link switching.
[0088] Step 1085: If the verification signal interaction is normal, the link switch is considered successful.
[0089] Specifically, if the master node receives a verification response signal from the target serial port within a preset feedback time, and the format and content of the response signal are consistent with the sent verification signal (no loss, no error), then the verification signal interaction is determined to be normal. Based on this determination, it is confirmed that the link between the target serial port and the master node access port has been stably connected, and the link switch is successful. Subsequently, the master node enters the data transmission ready state, allowing data transmission requests initiated by external access to be transmitted to the target serial port through the link.
[0090] For example, within a preset feedback time of 50ms, the master node receives a response signal "01010101" returned by the serial port of the child node 0. This signal is completely consistent with the sent verification signal, with no loss or error, indicating that the verification signal interaction is normal. Based on this, it is confirmed that the link between the serial port of the child node 0 and the access port of the master node is stably connected, and the link switch is successful. The master node then enters the data transmission ready state, waiting for the operation and maintenance system to send transmission requests such as debugging data and status query data.
[0091] In this embodiment, based on the normal interaction result of the verification signal, it is confirmed that the link switching has achieved the expected effect, providing a clear ready signal for subsequent data transmission, quickly completing the validity confirmation of the link switching, avoiding the impact of long waiting time on operation and maintenance efficiency, and ensuring that subsequent data transmission can be carried out on a stable and connected link, reducing data loss, transmission delay and other problems, and ensuring the smoothness and reliability of serial port access.
[0092] Step 1086: If an interruption or abnormality is detected in the verification signal, regenerate the switching control signal and adjust the path coding until the link is connected.
[0093] Specifically, if the master node does not receive a response signal from the target serial port within the preset feedback time, or if the received response signal is inconsistent with the sent verification signal (due to loss or error), the verification signal is determined to be interrupted or abnormal, and the link switching fails. The master node retrieves the link identification information of the target serial port again, verifies the accuracy of the path encoding, adjusts the path encoding (such as reconfirming the encoding corresponding to the target serial port), and regenerates the switching control signal based on the adjusted encoding. The signal is then sent to the link control terminal again according to the preset communication protocol, triggering link reconfiguration. The connection verification process is repeated until the verification signal interaction is detected as normal, and the link connection is successful.
[0094] For example, after the master node sends a verification signal, if it does not receive feedback from the child node's serial port 0 within a preset time of 50ms, it determines that the verification signal is interrupted and the link switching fails. The master node retrieves the link identifier information of the child node's serial port 0 again, verifies the accuracy of the path code "0x02", and after confirming that the code is correct, adjusts the timing instructions of the switching control signal (adjusting the wait time for response to 100ms) and regenerates the switching control signal. It then sends the signal to the link control end again according to the I2C protocol, triggering link reconfiguration. The master node sends the verification signal "01010101" again. If it receives a feedback signal from the child node's serial port 0 within 100ms this time, and the content is consistent, it determines that the link connection is successful. If it is still abnormal, the above process is repeated until the link is connected.
[0095] In this embodiment, a fault-tolerant mechanism for link switching is established. When a link anomaly occurs during the first switching, the link is reconnected by readjusting the control signals. This avoids the termination of the entire access process due to a single switching failure, improves the reliability and fault tolerance of link switching, reduces the probability of access failure caused by factors such as link interference and abnormal signal transmission, and ensures that serial port access can continue without the need for manual intervention by maintenance personnel. This further ensures the efficiency and continuity of maintenance operations.
[0096] Step 1087: After receiving the data transmission request initiated by the external access, route the data transmission request to the target serial port according to the switched link path; route the response data generated by the target serial port to the master node according to the reverse link path; and output the response data to the external access terminal through the master node.
[0097] Specifically, after a successful link switchover, the server continuously listens for data transmission requests (such as debugging commands, status query commands, etc.) initiated by external access clients through the access port of the master node. Upon receiving a data transmission request, the server routes the data to the target serial port according to the switched link path (master node access port, target serial port). After receiving the data, the target serial port performs the corresponding operation and generates response data (such as fault logs, status information, etc.). The response data is routed to the master node according to the reverse link path (target serial port, master node access port). The master node outputs the response data to the external access client, completing one data interaction. This process is repeated until the external access is terminated.
[0098] For example, after a successful link switchover, the operations and maintenance system or an external access terminal initiates a data transmission request via the master node's IP address and port number to retrieve the fault logs of child node 0. This request data enters through the master node's standard management interface access port and is routed to the child node 0's serial port along the switched link path (master node access port, child node 0 serial port). Upon receiving the request, child node 0 extracts the fault logs and generates response data. This response data is routed to the master node along the reverse link path (child node 0 serial port, master node access port). The master node sends the response data to the operations and maintenance system via network packets, and the system displays the child node 0's fault logs, completing the data interaction. Subsequent debugging commands sent by operations and maintenance personnel are transmitted and fed back via this bidirectional link.
[0099] In this embodiment, bidirectional routing of external access data and target serial port response data is implemented to ensure smooth data transmission between the master node and the target serial port, meeting the operational and maintenance needs such as remote debugging and status query, ensuring the integrity and real-time performance of data transmission, and enabling maintenance personnel to remotely obtain feedback information from the target serial port through an external access terminal, and complete fault diagnosis, status monitoring and other tasks without on-site operation, further improving the convenience and efficiency of out-of-band management of multi-node servers.
[0100] Step 1088: When external access terminates or an access end command is received, a link reset signal is generated; the link reset signal is sent to the link control terminal to restore the serial port connection link to its initial default configuration and disconnect the dedicated connection between the target serial port and the master node access port.
[0101] Specifically, the server continuously monitors the status of external access through the master node. When it detects that the external access has been actively terminated (e.g., a data transmission request has stopped) or receives a clear access termination instruction (e.g., a termination command), it generates a link reset signal. The reset signal contains the encoding of the initial default configuration (e.g., the link identifier corresponding to the default serial port) and the instruction to disconnect the dedicated connection. The reset signal is sent to the link control terminal according to the preset communication protocol. After receiving the reset signal, the link control terminal parses the reset signal, adjusts the link configuration, restores the serial port connection link to the initial default configuration (e.g., the serial port corresponding to the basic input / output function of the master node), and disconnects the dedicated connection between the target serial port and the master node access port. After the reset is completed, the master node waits for the next external access command.
[0102] For example, after the operation and maintenance system completes the troubleshooting of child node 0, it issues an access termination command. After receiving the command, the master node generates a link reset signal, which includes the initial default configuration code "0x00" and the command to disconnect the dedicated connection. The reset signal is sent to the link control terminal according to the I2C communication protocol. After parsing, the link control terminal adjusts the link configuration, restores the serial port connection link to the initial default configuration (the serial port corresponding to the master node's basic input / output functions is connected to the master node's access port), and disconnects the dedicated connection between the child node 0's serial port and the master node's access port. After the reset is completed, the master node resets the target identifier parameter to the initial invalid state and waits for the next external access command.
[0103] In this embodiment, a link reset mechanism is established after access. After the external access is terminated, the link is restored to its initial state to avoid the impact of historical switching states on subsequent accesses. This ensures that each serial port access can be executed based on a unified initial configuration, guaranteeing the accuracy and consistency of subsequent accesses. It also prevents mismatch of the target serial port due to the link not being reset, and releases the dedicated connection between the target serial port and the master node access port to avoid resource occupation. This ensures that other serial port accesses can be initiated normally, improving the utilization rate of link resources.
[0104] Step 1089: End this serial port access or reset the status.
[0105] Specifically, upon receiving an access termination command actively issued by the user (such as the IPMISOLdeactivate command), or upon the system detecting a serial port access anomaly (such as link interruption or data transmission timeout), the master node resets the target serial port identifier parameter (index) to its initial invalid state and clears the target serial port configuration record for this access. A link reset signal is generated and sent to the compute node CPLD via the I2C communication link, triggering the CPLD to restore the serial port connection link to its initial default configuration. The dedicated connection between the target serial port and the master node's access port is disconnected, residual data in the transmit / receive buffer is cleared, and link control resources are released.
[0106] In the above solution, server devices adapted to multi-management controller architecture can not only specify the serial port to be accessed corresponding to the master node's own chip or the child node through the target identifier parameter in the external access command to meet the targeted debugging needs, but also automatically retrieve the child node status record sequence arranged by preset number when the command does not contain the target identifier parameter. This allows for quick association of the serial port corresponding to the faulty child node without manual troubleshooting. The entire process relies solely on commands that conform to the standard management interface, eliminating the need for maintenance personnel to connect physical serial port cables on-site or issue additional dedicated commands. This significantly simplifies the operation steps of serial port access in multi-node servers, shortens fault location time, and balances operational flexibility with maintenance efficiency, effectively adapting to the complex management needs of multi-child node and multi-fault scenarios.
[0107] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0108] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described serial port switching method embodiments.
[0109] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described serial port switching method embodiments when running.
[0110] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0111] The embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described serial port switching method embodiments.
[0112] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described serial port switching method embodiments.
[0113] Any of the components, modules, units, parts, methods, and operations described herein can be implemented using software, firmware, hardware (e.g., fixed logic circuitry), manual processing, or any combination thereof. Alternatively or additionally, any functionality described herein can be executed at least in part by one or more hardware logic components, such as, but not limited to, a central processing unit (CPU), a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), an application-specific standard product (ASSP), a system-on-a-chip (SoC), a complex programmable logic device (CPLD), a microprocessor (MCU), etc. The terms "system," "computing device," or "apparatus" as used herein encompass various means, devices, and machines for processing data, including, for example, one or more programmable processors, computers, SoCs, or combinations thereof. The apparatus may also include code that creates an execution environment for the computer program in question, such as code constituting processor firmware, a protocol stack, a database management system, an operating system, a cross-platform runtime environment, a virtual machine, or one or more combinations thereof. The aforementioned computer program (also known as a program, software, software application, app, script, or code) can be written in any form of programming language, including compiled or interpreted languages, declarative or procedural languages, and can be deployed in any form, including as a standalone program or as a module, component, subroutine, object, or other unit suitable for a computing environment.
[0114] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0115] The serial port switching method provided in this application has been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A serial port switching method, characterized in that, A server device used in a multi-management controller architecture, the server device including a master node and multiple child nodes, including: Receive external access commands, which are commands conforming to a standard management interface, and the access commands include at least parameter configuration commands and console access commands; The received parameter configuration command is parsed to determine whether the parameter configuration command contains a target identifier parameter. The target identifier parameter is used to specify the serial port type to be accessed. The serial port type includes the serial port corresponding to the master node's own chip and the serial port corresponding to the child node. If the parameter configuration command is found to contain the target identifier parameter, the target identifier parameter is set as a valid target identifier parameter and stored in an internal global variable; if the parameter configuration command is found not to contain the target identifier parameter, the current state of the internal global variable is maintained. Parse the received console access command, read the internal global variables, and determine whether a valid target identifier parameter is stored; If the valid target identifier parameter is read, the serial port corresponding to the valid target identifier parameter is determined as the target serial port; If the valid target identifier parameter is not read, retrieve the stored status record sequence of each child node. The status record sequence is arranged in the order of the preset number of the child nodes. Each child node corresponds to a status record. The status record indicates whether the child node is in a fault state or a normal working state. Based on the state record sequence, obtain the state record of each child node, and determine the target serial port based on the state record; Switch the serial port connection link so that external access can be made through the master node to the target serial port.
2. The switching method according to claim 1, characterized in that, The step of obtaining the status records of each child node based on the status record sequence and determining the target serial port includes: Starting from the current query position of the status record sequence, the status records of each child node are traversed sequentially. When a child node marked as faulty is encountered, the serial port corresponding to the child node is determined as the target serial port, and the current query position is updated to the next number position of the child node. If no child node marked as faulty is found when traversing from the current query position to the end of the status record sequence, continue traversing from the beginning of the status record sequence to the current query position. If a child node marked as faulty is found during the traversal, the serial port corresponding to the child node is determined as the target serial port, and the current query position is updated.
3. The switching method according to claim 2, characterized in that, The method further includes: If no child node marked as faulty is found after traversing the entire state record sequence, then the preset default serial port is determined as the target serial port; the default serial port is the serial port corresponding to the basic input / output functions of the master node itself.
4. The switching method according to claim 3, characterized in that, The method further includes: Upon receiving an access termination command, the target identifier parameter is reset to its initial invalid state, and the current query position is reset to the starting position of the status record sequence.
5. The switching method according to claim 1, characterized in that, The switching of the serial port connection link, enabling external access to the target serial port through the master node, includes: Determine the link identification information corresponding to the target serial port. The link identification information corresponds to the transmit and receive path of the target serial port and is associated with the communication parameters of the master node access port. A handover control signal is generated based on the link identification information. The handover control signal includes the path code of the target serial port, the transceiver matching parameters, and the handover execution timing instructions. According to the preset communication protocol, the switching control signal is sent to the link control terminal to trigger the configuration adjustment of the serial port connection link, so that the receiving end of the target serial port is connected to the transmitting end in the master node port, and at the same time, the transmitting end of the target serial port is connected to the receiving end in the master node port, so that external access can be accessed through the master node to access the target serial port.
6. The switching method according to claim 1, characterized in that, After switching the serial port connection link so that external access is through the master node to the target serial port, the method further includes: Send a connection verification signal to detect the link connectivity status between the target serial port and the master node access port; If the verification signal interaction is detected to be normal, the link switch is determined to be successful. If the verification signal is detected to be interrupted or abnormal, the switching control signal is regenerated and the path coding is adjusted until the link is connected.
7. The switching method according to claim 1, characterized in that, The method further includes: Upon receiving a data transmission request initiated by an external access, the data transmission request is routed to the target serial port according to the switched link path; The response data generated by the target serial port is routed to the master node according to the reverse link path; The master node outputs the response data to an external access terminal. When external access terminates or an access termination command is received, a link reset signal is generated; The link reset signal is sent to the link control terminal to restore the serial port connection link to its initial default configuration and disconnect the dedicated connection between the target serial port and the master node access port.
8. The switching method according to claim 1, characterized in that, Before receiving an external access command, wherein the access command is a command conforming to a standard management interface, the method further includes: Each child node checks its own working status to determine whether it is in a fault state. Based on the fault state, a status record is generated; In response to the status record being a fault state, the child node reports the status record to the master node.
9. The switching method according to claim 1, characterized in that, After parsing that the parameter configuration command contains the target identifier parameter, the method further includes: The target identifier parameter is validated. If the target identifier parameter fails the validation, the current state of the internal global variable is maintained, and an illegal parameter prompt message is returned to the external access terminal.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the serial port switching method as described in any one of claims 1 to 9 when executing the computer program.
