Hardware topology information processing method and device, equipment and medium
By processing hardware topology information during the development process, the repeated development and debugging problems caused by hardware adjustments by multiple development groups are solved, and the effect of improving development efficiency and code reusability is achieved.
Patent Information
- Application Number
- CN202411838121.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-21
AI Technical Summary
During the development process, due to hardware adjustments, multiple development groups repeatedly conduct development and debugging, which is inefficient and has low code reusability.
Provides a method of processing hardware topology information, by receiving query requests, determines whether the information type is topology information type, and obtains the hardware topology information of the target node from the database. The method also includes querying in the cache whether the corresponding target hardware topology information exists and adding it to the cache when the number of queries reaches a preset number of times.
This method allows developers to quickly obtain detailed hardware topology information of required nodes, reduces the repeated development and debugging due to hardware adjustments, and improves development efficiency and code reusability.
Smart Images

Figure CN119669296A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and medium for processing hardware topology information. Background Art
[0002] The existing hardware topology function is mainly aimed at operation and maintenance personnel, allowing administrators to quickly obtain basic configuration information of the target server from the hardware topology map, avoiding the adverse effects of low efficiency or incomplete information acquisition caused by a large number of command queries, and improving the convenience of server management and operation. However, the actual hardware topology collection work is also very important for development. When developing large-scale software services, multiple groups may analyze and operate the hardware at the same time. After the hardware is adjusted, multiple groups need to invest manpower for development and debugging. There is a lot of duplication of work, resulting in low development efficiency and low code reusability. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method, device, equipment and medium for processing hardware topology information to solve the problem that the existing hardware topology function is mainly for operation and maintenance personnel, and during the development process, hardware adjustments lead to repeated development and debugging by multiple groups, low efficiency and low code reusability.
[0004] In a first aspect, an embodiment of the present invention provides a method for processing hardware topology information, the method comprising:
[0005] Receive a query request, wherein the information query request carries an information type and a node identifier, the node identifier is a node identifier of any node in the hardware system, and the node is used to represent a hardware device in the hardware system;
[0006] In response to the query request, determining whether the information type is a topology information type;
[0007] If the information type is a topology information type, obtaining target hardware topology information of the target node corresponding to the node identifier from a database, wherein the database includes hardware topology information of different nodes, and the target hardware topology information is determined according to a topology configuration file of the target node;
[0008] Target topology information matching the topology information type is acquired based on the hardware topology information, and the target topology information is sent to a requester corresponding to the query request.
[0009] Furthermore, before obtaining the target hardware topology information of the target node corresponding to the node identifier from the database, the method further includes:
[0010] Using the node identifier, querying from the cache whether corresponding target hardware topology information exists;
[0011] If the corresponding target hardware topology information exists in the cache, the target topology information is sent to the requester corresponding to the query request; or, if the corresponding target hardware topology information does not exist in the cache, the step of querying the target hardware topology information of the target node corresponding to the node identifier from the database is executed.
[0012] Furthermore, when the corresponding target hardware topology information does not exist in the cache, the method further includes:
[0013] Detecting historical query records to obtain the query times corresponding to the node identifier;
[0014] If the query times reaches a preset number, the target hardware topology information is added to the cache.
[0015] Further, the sending the target topology information to the requesting party corresponding to the query request includes:
[0016] Check whether the query request contains analysis requirements;
[0017] If the query request carries an analysis requirement, the target topology information is analyzed according to the analysis requirement to obtain an analysis result;
[0018] Determine whether the target node has topology optimization content based on the analysis result;
[0019] If the target node has topology optimization content, the target topology information and the topology optimization content are sent to the requester corresponding to the query request.
[0020] Furthermore, the method further comprises:
[0021] Acquire general topology information of the hardware system based on the hardware command, and acquire topology configuration files of each node in the hardware system, wherein each node corresponds to a hardware device in the hardware system;
[0022] Comparing the general topology information with the topology configuration file to obtain hardware topology information corresponding to the node;
[0023] The node identification and hardware topology information of each node are associated and stored in the database.
[0024] Further, the comparing the general topology information and the topology configuration file to obtain the hardware topology information corresponding to the node includes:
[0025] Extracting configuration rules and topological conditions corresponding to the node from the topology configuration file;
[0026] generating a collection instruction using the topological condition;
[0027] Based on the collection instruction, collecting topological features of the node in the hardware system;
[0028] Matching the topological feature with the topological condition to obtain initial topological information of the node;
[0029] Analyzing the general topology information using the configuration rules to obtain associated topology information of the nodes;
[0030] The associated topology information is screened out as the same topology information as the initial topology information, and the same topology information as the associated topology information as the initial topology information is used as the hardware topology information corresponding to the node.
[0031] Furthermore, the method further comprises:
[0032] Monitoring whether the topology of the hardware system changes according to a preset period;
[0033] If it is detected that the topology structure of the hardware system has changed, obtaining the changed topology structure;
[0034] The general topology information of the hardware system is updated based on the changed topology structure, and the latest topology characteristics of each node are obtained based on the changed topology structure;
[0035] The hardware topology information corresponding to each node is updated using the latest topological features of the nodes.
[0036] In a second aspect, an embodiment of the present invention provides a device for processing hardware topology information, the device comprising:
[0037] A receiving module, configured to receive a query request, wherein the information query request carries an information type and a node identifier, the node identifier is a node identifier of any node in the hardware system, and the node is used to represent a hardware device in the hardware system;
[0038] A response module, used to respond to the query request and determine whether the information type is a topology information type;
[0039] A processing module, configured to obtain target hardware topology information of a target node corresponding to the node identifier from a database if the information type is a topology information type, wherein the database includes hardware topology information of different nodes, and the target hardware topology information is determined according to a topology configuration file of the target node;
[0040] A screening module is used to obtain target topology information matching the topology information type based on the hardware topology information, and send the target topology information to a requester corresponding to the query request.
[0041] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0042] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method of the first aspect or any corresponding embodiment thereof.
[0043] The present invention first receives a query request with the information type and node identifier, so that developers can accurately query the hardware topology information of a specific node, avoiding blind search and duplication of work. Secondly, after determining that the information type is a topology information type, the hardware topology information of the target node is obtained from the database. This database contains information of different nodes, and the target hardware topology information is determined according to the topology configuration file of the target node, ensuring the accuracy and pertinence of the information. In this way, during the development process, developers from different groups can quickly obtain detailed hardware topology information of the required nodes through this solution, reducing the situation of repeated development and debugging due to hardware adjustments, and improving development efficiency and code reusability. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0045] Figure 1 is a flowchart of a method for processing hardware topology information according to some embodiments of the present invention;
[0046] Figure 2 is a schematic diagram of a scalable hardware topology service according to some embodiments of the present invention;
[0047] Figure 3 is a schematic diagram of a hardware topology interface module according to some embodiments of the present invention;
[0048] Figure 4 is a flowchart of a method for processing hardware topology information according to some embodiments of the present invention;
[0049] Figure 5 is a structural block diagram of a device for processing hardware topology information according to an embodiment of the present invention;
[0050] Figure 6 It is a schematic diagram of the hardware structure of the electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0052] According to an embodiment of the present invention, a method, apparatus, device and medium for processing hardware topology information are provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0053] In this embodiment, a method for processing hardware topology information is provided. Figure 1 is a flowchart of a method for processing hardware topology information according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0054] Step S101, receiving a query request, wherein the information query request carries an information type and a node identifier, and the node identifier is a node identifier of any node in a hardware system, and the node is used to represent a hardware device in the hardware system.
[0055] In an embodiment of the present application, when a query request is made, the request will be sent from the external requester to the system. The query request contains two key information, namely the information type and the node identifier. The information type is used to clarify the category of the specific content that the requester wants to obtain. For example, the information type can be a topology information type, a hardware configuration information type, a performance indicator information type, etc. Different information types determine the subsequent processing flow of the system and the returned result content. The node identifier is used to uniquely identify a specific hardware device in the hardware system. In a complex hardware system, there may be multiple different hardware devices, and each device needs to have a unique identifier for distinction and management. This node identifier can be a digital number, a combination of letters, or other specific identifiers. Through the node identifier, the system can accurately locate the specific hardware device that the requester is concerned about, thereby providing it with corresponding information.
[0056] For example, in a server cluster in a data center, each server can be considered a node. If the requester wants to query the topology information of a specific server, a specific node identifier will be carried in the query request, which allows the system to know which server the requester is interested in. At the same time, the request will also specify the information type as the topology information type, so that the system will search for the target hardware topology information of the server based on this request and return it to the requester.
[0057] Step S102: In response to the query request, determine whether the information type is a topology information type.
[0058] In an embodiment of the present application, the received request is parsed to determine the specific type of the request. Possible request types include hardware device information acquisition request, disk topology request, RAID status request, SAS link status request and other requests. According to system design, determine which request types belong to topology information types. For example, disk topology request, RAID status request, SAS link status request, etc. can be clearly classified as topology information types.
[0059] Compare the parsed current request type with the established topology information type standard set. If the current request type is in the standard set, then it can be determined that the information type is a topology information type; if it is not in the set, then it is not a topology information type. For example, after receiving a request, the parsed request is found to be a disk topology request. Since the disk topology request is in the pre-determined topology information type standard set, it can be determined that the information type of this request is a topology information type.
[0060] In an embodiment of the present application, before obtaining the target hardware topology information of the target node corresponding to the node identifier from the database, the method also includes: using the node identifier to query whether the corresponding target hardware topology information exists from the cache; if the corresponding target hardware topology information exists in the cache, sending the target topology information to the requester corresponding to the query request; or, if the corresponding target hardware topology information does not exist in the cache, executing the step of querying the target hardware topology information of the target node corresponding to the node identifier from the database.
[0061] Specifically, when the system receives a query request, it extracts the node identifier from the request. This node identifier is key information that uniquely identifies a specific hardware device in the hardware system. Using the node identifier as a query condition, it is prepared to search in the cache. The cache can be a data structure in memory, such as a hash table, dictionary, etc., or a dedicated cache database.
[0062] Use the constructed query conditions to quickly search in the cache. If the cache is implemented as a hash table, the node identifier can be used as the key to quickly locate whether the corresponding value, that is, the target hardware topology information, exists. If the target hardware topology information corresponding to the node identifier is found in the cache, it means that the information is already in the cache and can be used directly. At this point, enter the step of sending the target topology information. Send the target topology information to the requester corresponding to the query request. The information can be transmitted to the requester's application or device through a network protocol (such as HTTP, TCP, etc.).
[0063] When the corresponding target hardware topology information does not exist in the cache, prepare to query from the database. Use the node ID as the query condition to determine the target node to be found in the database. Use a database query language (such as SQL) or a database access API to query the database based on the node ID. The database stores the target hardware topology information of each node, and the detailed topology information of the target node corresponding to the node ID can be found through the query.
[0064] For example, a query request containing the node identifier "Node123" is received. First, the cache is queried with "Node123" as the key. If the corresponding target hardware topology information exists in the cache, it is extracted and sent to the requester. If it is not found in the cache, the database is queried based on "Node123". After the corresponding target hardware topology information is found, it is sent to the requester. This can improve query efficiency while ensuring that the required information can be obtained from the database even when the cache misses.
[0065] Step S103, if the information type is a topology information type, then obtaining target hardware topology information of the target node corresponding to the node identifier from a database, wherein the database includes hardware topology information of different nodes, and the target hardware topology information is determined according to a topology configuration file of the target node.
[0066] In the embodiment of the present application, it is determined which of these request types belong to the topology information type. For example, disk topology requests, RAID status requests, SAS link status requests, etc. are classified as topology information types. If the current request belongs to one of these types, then the information type is determined to be the topology information type.
[0067] Extract the node ID from the request. The node ID is the key information that uniquely identifies a specific hardware device in the hardware system. Use the node ID to determine the target node. In the hardware system, each node has its own unique ID, and this ID can accurately find the corresponding target node. The database stores the hardware topology information of different nodes. According to the characteristics of the target node and the architecture of the system, determine the database that stores the hardware topology information of the target node.
[0068] The target hardware topology information is determined based on the topology configuration file of the target node. The topology configuration file contains detailed information about the hardware connection relationship, device configuration, etc. of the target node. In the database, query is performed based on the node ID. Use a database query language (such as SQL) or a database access API to find the hardware topology information corresponding to the target node. Once the target hardware topology information is found, it is extracted for subsequent processing.
[0069] For example, when the system receives a disk topology request, it parses the request to determine that the information type is a topology information type. The node identifier "NodeX" is extracted from the request, and then the target node is determined to be a specific server in the hardware system based on the node identifier. Next, the database storing the hardware topology information of the server is determined based on the system architecture. In the database, a query is performed based on "NodeX" to find the target hardware topology information such as the disk topology information of the server. This information is generated and stored in the database based on the topology configuration file of the server.
[0070] In an embodiment of the present application, when the corresponding target hardware topology information does not exist in the cache, the method further includes: detecting historical query records to obtain the number of queries corresponding to the node identifier; if the number of queries reaches a preset number, adding the target hardware topology information to the cache.
[0071] When the target hardware topology information corresponding to the current demand does not exist in the cache, the system will start the operation of detecting the historical query record. First, the system will search for the number of times the node identifier appears in the historical query record for a specific node identifier. This number represents the frequency of query requirements for the hardware topology information of a specific node. If the number of queries reaches the preset number, this indicates that the query requirements for the hardware topology information of the node are relatively frequent. In order to improve the efficiency of subsequent queries, reduce the consumption of system resources by repeated queries, and reduce the query response time, the system will add the target hardware topology information to the cache.
[0072] For example, in a data center management system, an administrator may frequently query the hardware topology information of certain specific server nodes, such as the topology structure of the server's CPU, memory, storage devices, and network connections. When the hardware topology information of a specific server node is queried for the first time, the information does not exist in the cache. The system will obtain the information from the database or other data source that stores the hardware topology information and return it to the administrator. At the same time, the system will record this query and record the query count of the node ID as 1. If the administrator subsequently queries the hardware topology information of the node multiple times, when the query count reaches a preset number (for example, 5 times), the system will add the hardware topology information of the server node to the cache. In this way, the next time the hardware topology information of the node is queried, the system can quickly obtain it directly from the cache without having to query it from the data source again, thereby improving the performance and response speed of the system.
[0073] Step S104: acquiring target topology information matching the topology information type based on the hardware topology information, and sending the target topology information to a requester corresponding to the query request.
[0074] In an embodiment of the present application, the specific required topology information features will be clarified based on the determined topology information type. For example, if the topology information type is disk topology, the system will look for information features related to the slot number, spatial location, type, etc. of the disk. Next, the system traverses the hardware topology information obtained from the database and compares the matching degree of each information item with the required topology information features one by one. In this process, the attributes, format, and degree of association with the target node of the information may be checked. Once the information that meets the requirements is found, it is marked as the target topology information.
[0075] In an embodiment of the present application, sending target topology information to a requester corresponding to a query request includes the following steps A1-A4:
[0076] Step A1, check whether the query request carries analysis requirements.
[0077] Specifically, when a query request is received, the system first parses the request. It can determine whether there is an identification of the analysis requirement by checking specific fields, parameters, or metadata of the request. For example, the query request may contain a flag or keyword in a specific format to indicate whether the requester needs to further analyze the target topology information. If there is no clear identification in the request, the system can infer whether there may be an analysis requirement based on the source of the request (such as a specific user role or application scenario).
[0078] Step A2: If the query request carries an analysis requirement, the target topology information is analyzed according to the analysis requirement to obtain an analysis result.
[0079] Specifically, if the query request carries an analysis requirement, the system will perform the corresponding analysis operation according to the specific analysis requirement type. The analysis requirement may include performance analysis, reliability analysis, cost optimization analysis, and other different aspects.
[0080] For performance analysis, the system can check the processing power, data transmission speed, load balancing, etc. of each node in the target topology. For example, for a computer network topology, analyze the CPU and memory utilization of each server and the network bandwidth usage to determine whether there is a performance bottleneck.
[0081] For reliability analysis, the system can evaluate the redundancy and fault recovery capabilities of each component in the target topology. For example, check whether there is a single point of failure, as well as the system's recovery strategy and time when some components fail.
[0082] For cost optimization analysis, the system can consider factors such as the purchase cost of hardware devices in the target topology, operating costs (such as energy consumption), and other factors to make recommendations for reducing costs. For example, it can analyze whether costs can be reduced by adjusting device configuration or adopting more energy-efficient hardware.
[0083] Step A3: determine whether there is any topology optimization content in the target node based on the analysis result.
[0084] Specifically, after obtaining the analysis results, the system evaluates the results to determine whether there is any topology optimization content in the target node. If the analysis results show that there are performance bottlenecks, reliability issues, or excessive costs in the target topology, the system will consider that there is topology optimization content.
[0085] First, various analysis results obtained from analyzing the target topology information are summarized. These results include performance indicator data (such as node processing speed, response time, data throughput, etc.), reliability indicators (such as failure frequency, recovery time, redundancy, etc.) and cost-related data (such as equipment procurement cost, energy consumption cost, maintenance cost, etc.).
[0086] Performance evaluation criteria: Determine the thresholds of key performance indicators. For example, for a server node, set CPU utilization exceeding 80% and network latency exceeding a certain number of milliseconds as signs that may need to be optimized. For data transmission nodes, set optimization when data throughput is lower than a certain value. Consider the performance characteristics and importance of different types of nodes and assign different weights. For example, the performance indicators of core server nodes may have a greater weight in the evaluation.
[0087] Reliability evaluation criteria: Define the minimum reliability requirements. For example, specify that the mean time between failures (MTBF) of the system should reach a certain length of time, or that the recovery time in the event of a failure should not exceed a certain time. Determine the necessity criteria for redundant equipment. For example, if a key node does not have a backup device, or the backup device switching time is too long, optimization may be required.
[0088] Cost evaluation criteria: Set cost budget limits. If the total cost of the current topology exceeds the budget range, you need to consider cost optimization. Analyze the cost-benefit ratio of each device. For example, for devices with high energy consumption but relatively low performance contribution, you may need to consider replacing them with more energy-efficient devices.
[0089] Performance: Check the performance indicator data of the target nodes one by one and compare them with the performance evaluation standards. If the performance indicator of a node exceeds the corresponding threshold, or the overall performance of multiple nodes is poor, it may indicate the need for topology optimization. Analyze performance bottleneck nodes. By monitoring data traffic and resource usage, determine which nodes become performance bottlenecks in system operation. For example, if the data traffic of a network switch is often saturated, it may be necessary to upgrade or add equipment to relieve the pressure.
[0090] Reliability: Check whether the actual reliability index of the system meets the set standards. If the mean time between failures is short, the fault recovery time is long, or the redundancy is insufficient, topology optimization may be required to improve the reliability of the system. Assess the risk of single point failure. Analyze each key node to determine whether there is a possibility of single point failure. If a node failure will cause the entire system to fail, you need to consider adding redundant equipment or improving the backup strategy.
[0091] Cost: Calculate the total cost of the current topology and compare it with the cost budget. If it exceeds the budget, you need to find ways to optimize the cost. Analyze the cost-effectiveness of each device. For devices with high costs but low performance contribution, consider whether the equipment can be upgraded, replaced, or adjusted to improve cost-effectiveness.
[0092] If problems are found in terms of performance, reliability or cost, it is determined that there is topology optimization content. For performance issues, you can consider increasing hardware resources (such as increasing memory, upgrading CPU, expanding network bandwidth, etc.), optimizing data transmission paths, adjusting load balancing strategies, etc. For reliability issues, you can add redundant equipment, improve backup strategies, and improve fault detection and recovery capabilities. For cost issues, you can integrate equipment, select more energy-efficient equipment, and optimize operation and maintenance strategies. Record and organize topology optimization content, including specific optimization measures, involved nodes, and expected effects, so that detailed optimization suggestions can be provided to the requester later.
[0093] Step A4: If the target node has topology optimization content, the target topology information and the topology optimization content are sent to the requester corresponding to the query request.
[0094] Specifically, if it is determined that there is topology optimization content in the target node, the system will send the target topology information and the topology optimization content together to the requester of the query request. The sending method can be the same as the previous method of sending the target topology information, and the appropriate transmission method is selected according to the location and system architecture of the requester. In the content sent, the target topology information can be displayed in a graphical or structured form, so that the requester can intuitively understand the current topology structure. The topology optimization content can be presented in the form of a suggestion report, detailing the existing problems and corresponding optimization suggestions, so that the requester can make decisions and take corresponding measures to improve the topology structure.
[0095] The embodiment of the present application first receives a query request with the information type and node identification. This feature enables developers to accurately specify the hardware device nodes and specific information types to be queried when facing hardware adjustments. Through clear node identification, different development teams can quickly focus on the target hardware related to themselves, avoiding blind searches in the entire hardware system and saving time. At the same time, by specifying the information type as a topology information type, developers can directly obtain key information related to the hardware topology, avoid being disturbed by other irrelevant information, and improve the pertinence and efficiency of the query.
[0096] Secondly, the target hardware topology information is obtained from the database. The database stores the hardware topology information of different nodes, providing a centralized information source for multiple development groups. When the hardware is adjusted, each group does not need to independently re-collect and analyze the hardware topology information, but can directly obtain the topology information of the target node from the database, reducing duplication of work and improving development efficiency. Moreover, the target hardware topology information in the database is determined based on the topology configuration file of the target node, ensuring the accuracy and reliability of the information. Developers can rest assured to carry out development work based on this information, reducing erroneous development and debugging caused by inaccurate information.
[0097] Finally, the target topology information matching the topology information type is obtained based on the hardware topology information and sent to the requester. This ensures that developers can get the specific topology information they really need, further improving development efficiency. Developers from different groups can obtain the topology information that best suits their development work according to their needs, avoiding additional processing and debugging due to information mismatch, and improving code reusability.
[0098] Figure 2 is a flowchart of a method for processing hardware topology information according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0099] Step S201 : acquiring general topology information of a hardware system based on a hardware command, and acquiring a topology configuration file of each node in the hardware system, wherein each node corresponds to a hardware device in the hardware system.
[0100] In the embodiments of the present application, different types of hardware systems may require different commands to obtain general topology information. For example, for a server system, a specific management tool command or operating system command may be used to query hardware connection and architecture information. For network devices, commands related to a network management protocol (such as SNMP) may be used to obtain network topology information.
[0101] These commands are executed on the hardware system through programming or scripting. The execution of commands can be performed on the local console or through a remote connection, depending on the access method and security settings of the hardware system.
[0102] After the hardware command is executed, it will return output results in a specific format, which need to be parsed to extract general topology information. For example, for a server system, you may get the connection relationship between the CPU, memory, storage devices and expansion cards, as well as the configuration information of the network interface.
[0103] Understand where the topology configuration files for each node in the hardware system are usually stored. This may be in the firmware of the hardware device, in a specific directory of the operating system, or in a storage location accessible through a network management tool. Use the appropriate file reading method to read the topology configuration files for each node. These files may be in text format, binary format, or a specific configuration file format, and need to be parsed accordingly according to their format. Extract key information related to the node topology from the topology configuration file, such as device connection relationships, port configurations, protocol settings, etc.
[0104] Step S202: Compare the general topology information and the topology configuration file to obtain hardware topology information corresponding to the node.
[0105] In an embodiment of the present application, the general topology information and the topology configuration file are compared to obtain the hardware topology information corresponding to the node, including: extracting the configuration rules and topology conditions corresponding to the node from the topology configuration file; generating acquisition instructions using the topology conditions; based on the acquisition instructions, acquiring the topological features of the node in the hardware system; matching the topological features with the topological conditions to obtain the initial topology information of the node; analyzing the general topology information using the configuration rules to obtain the associated topology information of the node; filtering out the topology information that is the same as the initial topology information in the associated topology information, and using the topology information that is the same as the initial topology information as the hardware topology information corresponding to the node.
[0106] Use the corresponding parsing tools or programming language libraries to parse the topology configuration file. For example, if it is in XML format, you can use an XML parser; if it is in JSON format, you can use a JSON parsing library. In the parsed configuration file, find the configuration rules and topology conditions related to the node. Configuration rules may include specific communication protocol settings, data processing methods, etc.; topology conditions may be requirements for node connections, performance indicators, etc.
[0107] Analyze the extracted topology conditions to determine what information needs to be collected. For example, if the topology conditions include the connection status and data transmission rate of the node, the collection instructions need to cover the operations to obtain this information. Based on the analysis results, construct collection instructions suitable for the hardware system. This may involve using specific hardware commands, calling system APIs, or sending requests through network protocols. For example, for server nodes, you can use command-line tools to send specific query commands to obtain network connection status and bandwidth usage.
[0108] The generated acquisition instructions are sent to the hardware system to trigger the acquisition operation of the node topology features. The execution of the instructions can be implemented programmatically, or the acquisition instructions can be executed in batches using automated tools.
[0109] Collect collection results: Wait for the hardware system to respond to the collection command and collect the returned topological feature data. This data includes the physical connection, logical relationship, performance indicators, etc. of the nodes. Sort and format the collected topological feature data for subsequent processing and analysis. For example, convert the data into a unified data structure or format for easy comparison and matching.
[0110] Compare the collected topological features with the previously extracted topological conditions. For example, check whether the connection status of the node meets the connection requirements specified in the topological conditions, whether the data transmission rate is within the specified range, etc. Based on the comparison results, determine the topological features that meet the topological conditions, and combine these features to form the initial topological information of the node. The initial topological information may include the connection relationship of the node, performance parameters, etc.
[0111] Use the configuration rules to analyze the previously acquired general topology information of the hardware system. For example, if the configuration rules specify a specific communication protocol, then search for connection relationships and node information that conform to the protocol in the general topology information. Based on the analysis results of the configuration rules, extract the associated topology information related to the node. The associated topology information may be information about other nodes that are directly or indirectly connected to the node, or topological structure features that conform to specific configuration rules.
[0112] Compare the node's associated topology information and initial topology information in detail to find the same topology information. You can use data comparison algorithms or tools to compare information items one by one. Filter out the same parts of the associated topology information and the initial topology information. These same topology information are considered to be accurate and reliable node hardware topology information. Arrange and summarize this information and output it as the final hardware topology information corresponding to the node.
[0113] Step S203: associate the node identification and hardware topology information of each node and store them in a database.
[0114] In the embodiment of the present application, a suitable database system is selected according to the system requirements and the data scale. It can be a relational database (such as MySQL, Oracle), a non-relational database (such as MongoDB, Redis) or a special storage system. Design a suitable data table or data storage structure in the database to store node identification and hardware topology information. For example, a data table containing fields such as node identification, hardware topology description, and creation time can be created.
[0115] The node ID of each node is associated with the corresponding hardware topology information and stored in the database. The database insert operation or batch import function can be used to ensure the accuracy and completeness of the data.
[0116] In order to improve query efficiency, appropriate indexes can be established in the database, such as indexing the node identification field, so as to quickly retrieve the hardware topology information of a specific node.
[0117] In an embodiment of the present application, the method also includes: monitoring whether the topological structure of the hardware system changes according to a preset period; if it is monitored that the topological structure of the hardware system changes, obtaining the changed topological structure; updating the general topological information of the hardware system based on the changed topological structure, and obtaining the latest topological features of each node based on the changed topological structure; and updating the hardware topological information corresponding to the node using the latest topological features of each node.
[0118] Specifically, a suitable monitoring period is determined based on factors such as the stability and importance of the hardware system and its sensitivity to topology changes. For example, it can be set to every hour, every day, or every week. A variety of methods can be used to monitor topology changes in hardware systems. A common method is to use network scanning tools or system management software to regularly scan and query hardware devices to detect whether the device's connection status, configuration parameters, etc. have changed. Another method is to monitor event notifications or log records of the hardware system and trigger the detection of topology changes when a device is added, removed, or the configuration is changed.
[0119] Start the monitoring program or task according to the preset cycle. If you use a network scanning tool, you can set a scheduled task to automatically perform the scanning operation; if you listen to event notifications or log records, you can use special monitoring software or scripts to continuously monitor related data sources. When the topology structure changes, first determine the scope and extent of the change. You can find the nodes and connections that have changed by comparing the current topology status with the status at the last monitoring.
[0120] According to the scope of the change, take appropriate measures to obtain the changed topology. If the network topology has changed, you can use the network scanning tool to rescan the network to obtain the connection information and configuration parameters of the device; if the hardware topology inside the server has changed, you can query the server's management interface or operating system commands to obtain the connection status and configuration changes of the hardware device.
[0121] Compare the changed topology with the previously stored general topology information of the hardware system to find the differences. Then, update the general topology information according to the changes. For example, if a new device is added to the network, add the information of the device to the general topology information; if the connection relationship of a device changes, update the corresponding connection information. Based on the changed topology, re-collect the topological features of each node. This can use the same method as previously obtaining topological features, such as sending collection instructions, executing hardware commands, or querying configuration files. Ensure that the obtained topological features reflect the latest status of the hardware system.
[0122] Compare the latest topological features of each node with the previously stored node hardware topology information. Find out the differences and determine what needs to be updated. Update the hardware topology information corresponding to the node based on the comparison results. If the connection status, performance parameters, etc. of the node have changed, update the relevant content in the hardware topology information accordingly. Ensure that the hardware topology information is always consistent with the actual status of the hardware system.
[0123] The embodiment of the present application first obtains the general topology information of the hardware system based on the hardware command to ensure that the most accurate and realistic hardware connection and layout conditions are obtained. At the same time, obtaining the topology configuration file of each node can be personalized for each hardware device. By comparing the general topology information and the topology configuration file, accurate hardware topology information that conforms to its actual situation can be generated for each node, avoiding inaccurate or incomplete information. The node identification and hardware topology information of each node are associated and stored in the database. On the one hand, it facilitates the overall management and query of the hardware system. Different users or programs can quickly and accurately obtain the topology information of a specific hardware device through the node identification, thereby improving the efficiency of information acquisition; on the other hand, centralized storage also facilitates the subsequent maintenance, upgrade and analysis of the hardware system, providing strong support for the stable operation and optimization of the system.
[0124] The scalable hardware topology service in the embodiment of the present application is composed of two major functional modules, such as Figure 3 As shown:
[0125] Hardware topology interface module: This module contains multiple interfaces, such as RAID status interface, disk topology interface, slot topology interface, SAS link topology interface and other interfaces. Each interface has a specific function and is responsible for returning the corresponding topology information and hardware device information to the requester in a specific format. For example, the RAID status interface provides RAID status information, including whether the RAID is operating normally, the presence of disks under the RAID, etc.; the disk topology interface returns the disk slot number, spatial location, type and other information; the slot topology interface may involve relevant information about the hardware device slot; the SAS link topology interface provides the link status, speed, phyerr and changecount information of the uplink and downlink of all hardware interfaces; other interfaces can return machine hardware information such as productname, machine type, bmc version, etc.
[0126] Hardware topology generation module: This module is responsible for reading the topological features of the hardware, such as collecting hardware topological features through hardware commands. These features may include but are not limited to the number of raids, raid types, number of expanders, bmc types, whether the front and rear backplanes are in place, etc. Combined with the configuration files, it generates topological information that conforms to itself. These configuration files contain rules and requirements for different hardware situations. The generated topological information can be obtained by other services through the hardware-software decoupling topology interface, providing accurate topological data support for the management and maintenance of the entire hardware system.
[0127] like Figure 4 As shown in the figure, the main process of the hardware topology interface module is as follows: After the system is started, unixsocketserver is established and enters the listening state, ready to receive topology requests from different requesters. Receive requests and parse request types: When a request arrives, first parse the request to determine the type of request. Request types may include hardware device information acquisition requests, disk topology requests, RAID status requests, SAS link status requests, and other requests.
[0128] According to the parsed request type, corresponding information is collected. For example, if it is a request to obtain hardware device information, hardware-related content such as CPU, memory, fan, temperature, etc. is collected from the BMC record; if it is a disk topology request, the disk slot number, spatial location, type and other information are collected; for RAID status requests, the RAID status and the presence or absence of the disk under the RAID are collected; SAS link status requests collect the link status, speed, phyerr and changecount information of the uplink and downlink of all hardware interfaces; other requests collect information such as machine type and BMC version.
[0129] The collected information is organized in a specific format so that the requesting party can clearly and accurately understand and use the information. Finally, the organized information is returned to the requesting party, completing the service process of the entire topology interface.
[0130] In this embodiment, a device for processing hardware topology information is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0131] This embodiment provides a device for processing hardware topology information, such as Figure 5 As shown, including:
[0132] The receiving module 501 is used to receive a query request, wherein the information query request carries an information type and a node identifier, and the node identifier is a node identifier of any node in the hardware system, and the node is used to represent a hardware device in the hardware system;
[0133] A response module 502 is used to respond to the query request and determine whether the information type is a topology information type;
[0134] The processing module 503 is used to obtain the target hardware topology information of the target node corresponding to the node identifier from the database if the information type is the topology information type, wherein the database includes the hardware topology information of different nodes, and the target hardware topology information is determined according to the topology configuration file of the target node;
[0135] The screening module 504 is used to obtain target topology information matching the topology information type based on the hardware topology information, and send the target topology information to the requester corresponding to the query request.
[0136] In an embodiment of the present application, the device also includes: a query module, which is used to use a node identifier to query whether there is corresponding target hardware topology information from the cache; if the corresponding target hardware topology information exists in the cache, the target topology information is sent to the requester corresponding to the query request; or, if the corresponding target hardware topology information does not exist in the cache, the step of querying the target hardware topology information of the target node corresponding to the node identifier from the database is executed.
[0137] In an embodiment of the present application, the query module is also used to detect historical query records to obtain the number of queries corresponding to the node identifier; if the number of queries reaches a preset number, the target hardware topology information is added to the cache.
[0138] In an embodiment of the present application, the screening module 504 is used to traverse whether the query request carries an analysis requirement; if the query request carries an analysis requirement, the target topology information is analyzed according to the analysis requirement to obtain an analysis result; based on the analysis result, it is determined whether the target node has topology optimization content; if the target node has topology optimization content, the target topology information and the topology optimization content are sent to the requester corresponding to the query request.
[0139] In an embodiment of the present application, the device also includes: a construction module, which is used to obtain general topology information of the hardware system based on hardware commands, and obtain a topology configuration file of each node in the hardware system, wherein each node corresponds to a hardware device in the hardware system; compare the general topology information and the topology configuration file to obtain the hardware topology information corresponding to the node; and associate the node identification and hardware topology information of each node and store them in a database.
[0140] In an embodiment of the present application, a construction module is used to extract configuration rules and topological conditions corresponding to a node from a topology configuration file; generate a collection instruction using the topological conditions; based on the collection instruction, collect the topological features of the node in the hardware system; match the topological features with the topological conditions to obtain initial topological information of the node; analyze the general topological information using the configuration rules to obtain associated topological information of the node; filter out the topological information that is the same as the initial topological information in the associated topological information, and use the topological information that is the same as the initial topological information as the hardware topological information corresponding to the node.
[0141] In an embodiment of the present application, an update module is used to monitor whether the topology structure of the hardware system changes according to a preset period; if the topology structure of the hardware system is monitored to change, the changed topology structure is obtained; based on the changed topology structure, the general topology information of the hardware system is updated, and based on the changed topology structure, the latest topological features of each node are obtained; and the hardware topology information corresponding to the node is updated using the latest topological features of each node.
[0142] See also Figure 6 , Figure 6 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).
[0143] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0144] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0145] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of an electronic device based on the presentation of a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0146] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0147] The electronic device further comprises a communication interface 30 for the electronic device to communicate with other devices or a communication network.
[0148] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0149] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for processing hardware topology information, characterized in that: The method comprises: Receive a query request, wherein the information query request carries an information type and a node identifier, the node identifier is a node identifier of any node in the hardware system, and the node is used to represent a hardware device in the hardware system; In response to the query request, determining whether the information type is a topology information type; If the information type is a topology information type, obtaining target hardware topology information of the target node corresponding to the node identifier from a database, wherein the database includes hardware topology information of different nodes, and the target hardware topology information is determined according to a topology configuration file of the target node; Target topology information matching the topology information type is acquired based on the hardware topology information, and the target topology information is sent to a requester corresponding to the query request.
2. The method according to claim 1, characterized in that Before obtaining the target hardware topology information of the target node corresponding to the node identifier from the database, the method further includes: Using the node identifier, querying from the cache whether corresponding target hardware topology information exists; If the corresponding target hardware topology information exists in the cache, the target topology information is sent to the requester corresponding to the query request; or, if the corresponding target hardware topology information does not exist in the cache, the step of querying the target hardware topology information of the target node corresponding to the node identifier from the database is executed.
3. The method according to claim 2, characterized in that In the case that the corresponding target hardware topology information does not exist in the cache, the method further includes: Detecting historical query records to obtain the query times corresponding to the node identifier; If the query times reaches a preset number, the target hardware topology information is added to the cache.
4. The method according to claim 1, characterized in that The sending the target topology information to the requesting party corresponding to the query request includes: Check whether the query request contains analysis requirements; If the query request carries an analysis requirement, the target topology information is analyzed according to the analysis requirement to obtain an analysis result; Determine whether the target node has topology optimization content based on the analysis result; If the target node has topology optimization content, the target topology information and the topology optimization content are sent to the requester corresponding to the query request.
5. The method according to claim 1, characterized in that The method further comprises: Acquire general topology information of the hardware system based on the hardware command, and acquire topology configuration files of each node in the hardware system, wherein each node corresponds to a hardware device in the hardware system; Comparing the general topology information with the topology configuration file to obtain hardware topology information corresponding to the node; The node identification and hardware topology information of each node are associated and stored in the database.
6. The method according to claim 5, characterized in that The comparing the general topology information and the topology configuration file to obtain the hardware topology information corresponding to the node includes: Extracting configuration rules and topological conditions corresponding to the node from the topology configuration file; generating a collection instruction using the topological condition; Based on the collection instruction, collecting topological features of the node in the hardware system; Matching the topological feature with the topological condition to obtain initial topological information of the node; Analyzing the general topology information using the configuration rules to obtain associated topology information of the nodes; The associated topology information is screened out as the same topology information as the initial topology information, and the same topology information as the associated topology information as the initial topology information is used as the hardware topology information corresponding to the node.
7. The method according to claim 5, characterized in that The method further comprises: Monitoring whether the topology of the hardware system changes according to a preset period; If it is detected that the topology structure of the hardware system has changed, obtaining the changed topology structure; The general topology information of the hardware system is updated based on the changed topology structure, and the latest topology characteristics of each node are obtained based on the changed topology structure; The hardware topology information corresponding to each node is updated using the latest topological features of the nodes.
8. A device for processing hardware topology information, characterized in that: The device comprises: A receiving module, configured to receive a query request, wherein the information query request carries an information type and a node identifier, the node identifier is a node identifier of any node in the hardware system, and the node is used to represent a hardware device in the hardware system; A response module, used to respond to the query request and determine whether the information type is a topology information type; A processing module, configured to obtain target hardware topology information of a target node corresponding to the node identifier from a database if the information type is a topology information type, wherein the database includes hardware topology information of different nodes, and the target hardware topology information is determined according to a topology configuration file of the target node; A screening module is used to obtain target topology information matching the topology information type based on the hardware topology information, and send the target topology information to a requester corresponding to the query request.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Cited By
Device position determination method and device, electronic device and storage medium
CN119883991A
Dynamic adjustment method and device for distributed communication nodes, equipment and medium
CN120263788A
Equipment information acquisition method and electronic equipment
CN121037232A