Method and system for automatically registering HBA card for bare metal server
The ironic inspector and python agent of OpenStack automatically collect HBA card information, and use self-developed tools to call the ironic interface to complete registration, solving the complex and error-prone problem of HBA card information registration on bare metal servers, and achieving efficient automated management.
Patent Information
- Application Number
- CN202510414680.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-18
AI Technical Summary
When a bare metal server is mounted on a FC-SAN cloud hard drive, the HBA card information registration process is complicated and prone to errors, and the existing technology is difficult to efficiently manage.
Use the ironic inspector and ironic python agent in OpenStack to collect HBA card information, call the ironic interface through the self-developed bare metal server registration tool to complete the automatic registration of the HBA card, and use the custom self-test rules of the ironic inspector to save the HBA card information.
The bare metal server HBA card registration is automated, which improves efficiency and reduces the probability of errors.
Smart Images

Figure CN120336412A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of bare metal servers, and specifically to a method and system for automatically registering HBA cards for bare metal servers. Background Art
[0002] A bare metal server is an exclusive physical host that uses high-specification hardware and I / O devices. It can provide a high-performance, virtualization-free, and securely isolated physical server cluster to meet the requirements of core application scenarios for high performance and stability. It can also be flexibly combined with other cloud products. Customers only need to determine the hardware configuration and quantity according to business characteristics, and the time to obtain a physical server can be shortened to several hours.
[0003] The cloud computing management platform (OpenStack) is a highly influential cloud computing resource management tool today, which is composed of a series of open-source projects. In addition to providing virtual machine resource forms, it also provides computing resources in the form of bare metal. Here, the bare metal refers to a physical server without an operating system installed. Virtual machines occupy some resources of the host, while bare metal provides exclusive computing resources and is provided to users in the form of an entire physical server, with the characteristics of no virtualization loss, high performance, and good reliability, and is suitable for scenarios such as high-performance computing and critical databases.
[0004] The related services in OpenStack are as follows:
[0005] 1. Bare metal service (ironic): Responsible for the life cycle management of bare metal, covering the entire state process management from registration management to system installation and deployment. Ironic interacts with the computing service (nova), network service (neutron), and image service (glance) in OpenStack, and can deploy the system image selected by the user to the physical disk of the bare metal server. Among them, nova is the presentation module of ironic to tenants. The nova service schedules and selects the bare metal and hands it over to ironic for deployment of the bare metal.
[0006] 2. Network service (neutron): Used to provide network resources for bare metal, including the dynamic host configuration protocol (DHCP) when the bare metal deployment node is in PXE (preboot execute environment) and iPXE (open-source boot firmware), and the tenant network selected by the user.
[0007] 3. Image service (Glance): Provides image services for bare metal. Ironic pulls the user-selected user image from Glance.
[0008] 4. Block storage service (Cinder): A component in OpenStack that provides block storage services. Its main function is to provide cloud disk management services.
[0009] SAN (Storage Area Network) is a storage architecture that connects storage devices and application servers via a network. This network is dedicated to accessing between hosts and storage devices. When there is a need for data access and storage, data can be transmitted at high speed between the server and the backend storage device through the storage area network. To achieve the gigabit serial network access capability of storage devices, the Fibre Channel protocol has been developed and is currently applied to the vast majority of high-capacity and high-end direct-attached storage devices.
[0010] HBA card, full name Host Bus Adapter, is a hardware interface card used to connect servers and storage devices, enabling the server to directly access the storage device without going through the network. There are mainly two types of HBA cards: FC-HBA cards (commonly known as fiber optic network cards) and iSCSI-HBA cards (RJ45 interfaces), which are generated due to different transmission protocols. FC-HBA cards support connections and data transmission between devices in a Fibre Channel-based Storage Area Network (SAN).
[0011] When a bare metal server needs to mount an fcsan cloud disk, it is necessary to register the information of the HBA card in Ironic. However, to obtain the information of the HBA card, it usually requires the operation and maintenance personnel to query through the server BIOS or enter the operating system on the server, and this operation process is relatively complex. Moreover, the WWPN and WWNN numbers of the HBA are 16-bit hexadecimal numbers, which are extremely prone to errors during the process of memorization and maintenance. Summary of the Invention
[0012] The present invention provides a method and system for automatically registering an HBA card for a bare metal server to solve the technical problems existing in the registration of HBA card information when a bare metal server mounts an fcsan cloud disk, so as to improve the efficiency of registering the HBA card for the bare metal server and reduce the probability of errors.
[0013] In the first aspect, the present invention provides a method for automatically registering an HBA card for a bare metal server. The technical solution adopted to solve the above technical problems is as follows:
[0014] A method for automatically registering an HBA card for a bare metal server, which includes the following steps:
[0015] S1. Collect HBA card information: Use ironic inspector and ironic pythonagent in OpenStack to collect HBA card information;
[0016] S2. Save HBA card information: Use the custom self - check rules of ironic inspector to save the collected HBA card information;
[0017] S3. Register the HBA card: Develop a bare - metal server registration tool. This tool queries the information of the HBA card on the node and calls the interface provided by ironic to complete the registration of the HBA card.
[0018] Optionally, step S1 specifically includes:
[0019] S1.1. After ironic sends a self - check request for the node to ironic inspector, ironic inspector starts the automatic discovery function, triggering the entire information collection process;
[0020] S1.2. ironic python agent runs on the node and prompts to start obtaining relevant information of the HBA card: ironic python agent first checks whether the / sys / class / fc_host / directory exists in the server and whether the directory is empty:
[0021] i) If the directory does not exist or is empty, it prompts that there is no HBA adapter, and the collection process ends.
[0022] ii) If the directory exists and is not empty, obtain the names of all sub - directories under the / sys / class / fc_host / directory;
[0023] S1.3. ironic python agent prepares two lists, one for storing the WWNN information of the HBA card and the other for storing the WWPN information of the HBA card;
[0024] S1.4. For each sub - directory under the / sys / class / fc_host / directory, ironic python agent sequentially constructs the paths of the node_name and port_name files under the sub - directory, then opens the corresponding files, reads the content in hexadecimal format starting with 0x, removes the 0x flag, and adds the processed information to the corresponding lists respectively;
[0025] S1.5. After completing the above operations, the ironic python agent concatenates all elements in the list storing the WWPN information into a string to obtain the complete WWPN information. At the same time, it concatenates all elements in the list storing the WWNN information into a string to obtain the complete WWNN information, and prompts that these information have been obtained;
[0026] S1.6. The ironic python agent combines the processed complete WWPN and WWNN information into an HBA card information object for subsequent information processing and use.
[0027] Optionally, step S2 specifically includes:
[0028] Pre-set a custom JSON format self-checking rule through the dedicated API of ironic inspector. This self-checking rule clearly stipulates that after the hardware self-check is completed, the collected HBA card information will be saved and processed;
[0029] After receiving the data including the HBA card information fed back by the ironic python agent, ironic inspector processes the data and sets the WWPN and WWNN number information of the HBA card to the specified attributes of the corresponding node for saving according to the custom JSON format self-checking rule.
[0030] Optionally, after executing step S3 and starting the bare metal server registration tool, first query the saved HBA card information, that is, the WWPN and WWNN numbers, from the corresponding node;
[0031] After the bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information to ironic;
[0032] Ironic receives and records the registration information of the HBA card, thereby managing the HBA card and realizing the effective control of the HBA card of the bare metal server storage connection component.
[0033] Optionally, after the bare metal server registration tool obtains the relevant information of the HBA card, the process of transmitting and registering the obtained information to ironic specifically includes:
[0034] Obtain the relevant information of the HBA card, define relevant functions and receive the parameters required in the registration process, and initialize the operation log at the same time;
[0035] Obtain the corresponding node information according to the received parameters. If the acquisition fails, the registration process will terminate directly. If the acquisition is successful, further obtain the additional information of the node. If the additional information is empty, the registration process will terminate. If the additional information is not empty, check whether it contains the WWPN and WWNN information related to the HBA card;
[0036] If there is WWPN and WWNN information related to the HBA card, obtain its specific values, split them into a list, count the number of HBA cards, and call the interface provided by ironic to obtain the list of WWPNs and WWNNs related to the registered HBA cards. Subsequently, traverse the WWNN list and the WWPN list respectively, compare each WWNN and WWPN with the registered list, and for the WWPN or WWNN that does not appear in the registered list, attempt to perform the registration operation through the corresponding method provided by ironic, and record the registration results in detail;
[0037] If there is no WWPN and WWNN information related to the HBA card, do nothing and end the current registration process.
[0038] In a second aspect, the present invention provides a system for automatically registering HBA cards for bare metal servers. The technical solution adopted to solve the above technical problems is as follows:
[0039] A system for automatically registering HBA cards for bare metal servers, which includes:
[0040] An information collection module for collecting HBA card information by means of ironic inspector and ironic pythonagent in OpenStack;
[0041] An information storage module for storing the collected HBA card information by means of the custom self-checking rules of ironic inspector;
[0042] A registration module for using a self-developed bare metal server registration tool to complete the registration of HBA cards by querying the information of HBA cards on the node and calling the interface provided by ironic.
[0043] Optionally, the information collection module specifically performs the following operations to collect HBA card information by means of ironic inspector and ironicpython agent in OpenStack:
[0044] After ironic sends a self-check request for the node to ironic inspector, ironic inspector starts the automatic discovery function, triggering the entire information collection process;
[0045] The ironic python agent runs on the node and prompts to start obtaining relevant information about the HBA card: ironic python agent first checks whether the / sys / class / fc_host / directory exists on the server and checks whether the directory is empty:
[0046] i) If the directory does not exist or is empty, it will prompt that there is no HBA adapter and the collection process ends.
[0047] ii) If the directory exists and is not empty, get the names of all subdirectories under the / sys / class / fc_host / directory;
[0048] Ironic Python agent prepares two lists, one for storing the WWNN information of the HBA card, and the other for storing the WWPN information of the HBA card;
[0049] For each subdirectory under the / sys / class / fc_host / directory, the ironic python agent builds the path of the node_name and port_name files in the subdirectory in turn, then opens the corresponding file, reads the hexadecimal format and the content starting with 0x, removes the 0x sign, and adds the processed information to the corresponding list respectively;
[0050] After completing the above operations, Ironic Python Agent connects all the elements in the list storing WWPN information with commas into a string to obtain the complete WWPN information. At the same time, it connects all the elements in the list storing WWNN information with commas into a string to obtain the complete WWNN information, and prompts that the information has been obtained.
[0051] The ironic python agent combines the processed complete WWPN and WWNN information into an HBA card information object for subsequent information processing and use.
[0052] Optionally, the information saving module uses the custom self-check rules of Ironic Inspector to perform the following operations to save the collected HBA card information:
[0053] Pre-set custom JSON format self-check rules through the ironic inspector's dedicated API. The self-check rules clearly stipulate that after the hardware self-check is completed, the collected HBA card information will be saved and processed;
[0054] After the ironic inspector receives the data including HBA card information fed back by the ironic python agent, it processes the data and sets the WWPN and WWNN number information of the HBA card to the specified attributes of the corresponding node for storage according to the self-check rules in the custom JSON format.
[0055] Optionally, the involved registration module uses a self-developed bare metal server registration tool to complete the registration of the HBA card by querying the information of the HBA card on the node and calling the interface provided by ironic. This process specifically includes:
[0056] Start the bare metal server registration tool, first query the saved HBA card information (i.e., WWPN and WWNN numbers) from the corresponding node;
[0057] After the bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information into ironic;
[0058] Ironic receives and records the registration information of the HBA card, thereby managing the HBA card and realizing the effective control of the HBA card of the bare metal server storage connection component.
[0059] Optionally, after the involved bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information into ironic. This process specifically includes:
[0060] Obtain the relevant information of the HBA card, define relevant functions and receive the parameters required in the registration process, and initialize the operation log at the same time;
[0061] Obtain the corresponding node information according to the received parameters. If the acquisition fails, the registration process is directly terminated. If the acquisition is successful, further obtain the additional information of the node. If the additional information is empty, the registration process is terminated. If the additional information is not empty, check whether it contains the WWPN and WWNN information related to the HBA card;
[0062] If there is WWPN and WWNN information related to the HBA card, obtain its specific values, split them into a list, count the number of HBA cards, and call the interface provided by ironic to obtain the WWPN list and WWNN list related to the registered HBA cards. Then traverse the WWNN list and WWPN list respectively, compare each WWNN and WWPN with the registered list, and for the WWPN or WWNN that does not appear in the registered list, try to perform the registration operation through the corresponding method provided by ironic, and record the registration result in detail;
[0063] If there is no WWPN and WWNN information related to the HBA card, no operation is performed and this registration process ends.
[0064] A method and system for automatically registering an HBA card for a bare metal server according to the present invention have the following beneficial effects compared with the prior art:
[0065] The present invention automates the process of registering an HBA card for a physical machine, which can improve the efficiency of registering an HBA card for a bare metal server and reduce the probability of errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Att Figure 1 is a flowchart of the method according to Embodiment 1 of the present invention;
[0067] Att Figure 2 is a block diagram of module connections according to Embodiment 2 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0068] To make the technical solutions, technical problems to be solved, and technical effects of the present invention clearer and more understandable, the following describes the technical solutions of the present invention clearly and completely in conjunction with specific embodiments.
[0069] The following English explanations are involved in the following embodiments:
[0070] node: A node of the bare metal service (ironic), which corresponds to a physical machine one by one in a real environment and stores hardware information such as the IPMI address, CPU, memory, and disk of the physical machine.
[0071] Ironic inspector is an auxiliary service in OpenStack Bare Metal. It is mainly used to discover the hardware attributes of nodes managed by Ironic and is also known as the hardware introspection service. It can obtain the hardware parameters required for scheduling, such as CPU model, memory size, hard disk capacity, etc., when the power management credentials of the known bare metal node (such as IPMI address, username, and password) are available.
[0072] Ironic python agent (abbreviated as IPA) is a key component in the OpenStack Ironic project. Ironic is a service in OpenStack for managing bare metal servers, and IPA is mainly used to perform various operations on bare metal nodes to help Ironic achieve functions such as discovery, configuration, and deployment of bare metal hardware.
[0073] Embodiment 1:
[0074] Combined with Att Figure 1, this embodiment proposes a method for automatically registering an HBA card for a bare metal server, which includes the following steps:
[0075] S1. Collect HBA card information: Use ironic inspector and ironic pythonagent in OpenStack to collect HBA card information. Specifically, it includes:
[0076] S1.1. After ironic sends a self-check request for the node to ironic inspector, ironic inspector starts the automatic discovery function, triggering the entire information collection process;
[0077] S1.2. ironic python agent runs on the node and prompts to start obtaining relevant information about the HBA card: ironic python agent first checks whether the / sys / class / fc_host / directory exists in the server and checks whether the directory is empty:
[0078] i) If the directory does not exist or is empty, it prompts that there is no HBA adapter, and the collection process ends.
[0079] ii) If the directory exists and is not empty, obtain the names of all subdirectories under the / sys / class / fc_host / directory;
[0080] S1.3. ironic python agent prepares two lists, one for storing the WWNN information of the HBA card and the other for storing the WWPN information of the HBA card;
[0081] S1.4. For each subdirectory under the / sys / class / fc_host / directory, ironic python agent sequentially constructs the paths of the node_name and port_name files under the subdirectory, then opens the corresponding files, reads the content in hexadecimal format starting with 0x, and after removing the 0x flag, adds the processed information to the corresponding lists respectively;
[0082] S1.5. After completing the above operations, ironic python agent concatenates all elements in the list storing the WWPN information into a string to obtain the complete WWPN information. At the same time, concatenates all elements in the list storing the WWNN information into a string to obtain the complete WWNN information, and prompts that these information have been obtained;
[0083] S1.6. The ironic python agent combines the processed complete WWPN and WWNN information into an HBA card information object for subsequent information processing and use.
[0084] S2. Save the HBA card information: Use the custom self - inspection rules of ironic inspector to save the collected HBA card information, specifically including:
[0085] Pre - set the custom JSON - format self - inspection rules through the dedicated API of ironic inspector. This self - inspection rule clearly stipulates that after the hardware self - inspection is completed, the collected HBA card information will be saved.
[0086] After ironic inspector receives the data including HBA card information fed back by the ironic python agent, it processes the data. According to the custom JSON - format self - inspection rules, it sets the WWPN and WWNN number information of the HBA card to the specified attributes of the corresponding node for saving.
[0087] S3. Register the HBA card: Develop a bare - metal server registration tool. This tool queries the information of the HBA card on the node and calls the interface provided by ironic to complete the registration of the HBA card.
[0088] After executing step S3 and starting the bare - metal server registration tool, first query the saved HBA card information, that is, the WWPN and WWNN numbers, from the corresponding node.
[0089] After the bare - metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information to ironic. This process specifically includes: obtaining the relevant information of the HBA card, defining relevant functions and receiving the parameters required in the registration process, and initializing the operation log; obtaining the corresponding node information according to the received parameters. If the acquisition fails, the registration process terminates directly. If the acquisition is successful, further obtain the additional information of the node. If the additional information is empty, the registration process terminates. If the additional information is not empty, check whether it contains the WWPN and WWNN information related to the HBA card.
[0090] i) If there is WWPN and WWNN information related to the HBA card, obtain their specific values, split them into a list, count the number of HBA cards, and call the interface provided by ironic to obtain the list of WWPNs and WWNNs related to the registered HBA cards. Subsequently, traverse the WWNN list and WWPN list respectively, compare each WWNN and WWPN with the registered list, and for any WWPN or WWNN that does not appear in the registered list, attempt to perform a registration operation through the corresponding method provided by ironic, and record the registration results in detail;
[0091] ii) If there is no WWPN and WWNN information related to the HBA card, then do nothing and end this registration process;
[0092] Ironic receives and records the registration information of the HBA card, thereby managing the HBA card and achieving effective control of the HBA card, which is a storage connection component of the bare metal server.
[0093] Based on the method of this embodiment, which is applied in the scenario of Ironic in OpenStack for managing bare metal servers. When mounting an FCSAN cloud disk, the HBA card information stored on the specified attributes of the node is called, and then these information are used to interact with the fiber optic switch to complete the disk configuration.
[0094] Embodiment 2:
[0095] Combined with the attached Figure 2 , this embodiment proposes a system for automatically registering HBA cards for a bare metal server, which includes:
[0096] An information collection module, which is used to collect HBA card information by means of ironic inspector and ironic pythonagent in OpenStack;
[0097] An information storage module, which is used to store the collected HBA card information by means of the custom self-check rules of ironic inspector;
[0098] A registration module, which is used to use a self-developed registration tool for bare metal servers, query the information of the HBA card on the node, and call the interface provided by ironic to complete the registration of the HBA card.
[0099] In this embodiment, the information collection module involved uses ironic inspector and ironic python agent in OpenStack, and specifically performs the following operations to collect HBA card information:
[0100] When Ironic sends a self-inspection request to Ironic Inspector for a node, Ironic Inspector starts the automatic discovery function, triggering the entire information collection process;
[0101] The ironic python agent runs on the node and prompts to start obtaining relevant information about the HBA card: ironic python agent first checks whether the / sys / class / fc_host / directory exists on the server and checks whether the directory is empty:
[0102] i) If the directory does not exist or is empty, it will prompt that there is no HBA adapter and the collection process ends.
[0103] ii) If the directory exists and is not empty, get the names of all subdirectories under the / sys / class / fc_host / directory;
[0104] Ironic Python agent prepares two lists, one for storing the WWNN information of the HBA card, and the other for storing the WWPN information of the HBA card;
[0105] For each subdirectory under the / sys / class / fc_host / directory, the ironic python agent builds the path of the node_name and port_name files in the subdirectory in turn, then opens the corresponding file, reads the hexadecimal format and the content starting with 0x, removes the 0x sign, and adds the processed information to the corresponding list respectively;
[0106] After completing the above operations, Ironic Python Agent connects all the elements in the list storing WWPN information with commas into a string to obtain the complete WWPN information. At the same time, it connects all the elements in the list storing WWNN information with commas into a string to obtain the complete WWNN information, and prompts that the information has been obtained.
[0107] The ironic python agent combines the processed complete WWPN and WWNN information into an HBA card information object for subsequent information processing and use.
[0108] In this embodiment, the information storage module uses the custom self-check rules of Ironic Inspector to perform the following operations to save the collected HBA card information:
[0109] Pre-set custom JSON format self-check rules through the dedicated API of ironic inspector. This self-check rule clearly stipulates that after the hardware self-check is completed, the collected HBA card information will be saved and processed;
[0110] After ironic inspector receives the data including HBA card information fed back by ironic python agent, it processes the data. According to the custom JSON format self-check rules, the WWPN and WWNN number information of the HBA card is set to the specified attributes of the corresponding node for saving.
[0111] In this embodiment, the involved registration module uses a self-developed bare metal server registration tool. By querying the information of the HBA card on the node, it calls the interface provided by ironic to complete the registration of the HBA card. This process specifically includes:
[0112] Start the bare metal server registration tool. First, query the saved HBA card information, that is, the WWPN and WWNN numbers, from the corresponding node;
[0113] After the bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information to ironic. This process specifically includes:
[0114] Obtain the relevant information of the HBA card, define relevant functions and receive the parameters required in the registration process, and at the same time initialize the operation log; obtain the corresponding node information according to the received parameters. If the acquisition fails, the registration process will terminate directly. If the acquisition is successful, further obtain the additional information of the node. If the additional information is empty, the registration process will terminate. If the additional information is not empty, check whether it contains the WWPN and WWNN information related to the HBA card;
[0115] i) If there is WWPN and WWNN information related to the HBA card, obtain its specific values, split them into a list, count the number of HBA cards, and call the interface provided by ironic to obtain the list of WWPNs and the list of WWNNs related to the registered HBA cards. Subsequently, traverse the list of WWNNs and the list of WWPNs respectively, compare each WWNN and WWPN with the registered list, and for the WWPN or WWNN that does not appear in the registered list, try to perform the registration operation through the corresponding method provided by ironic, and record the registration result in detail;
[0116] ii) If there is no WWPN and WWNN information related to the HBA card, do not perform any operation and end this registration process;
[0117] The ironic receives and records the registration information of the HBA card, thereby managing the HBA card and realizing the effective control of the HBA card of the bare metal server storage connection component.
[0118] In summary, by using the method and system for automatically registering the HBA card of the bare metal server of the present invention, the process of registering the HBA card of the physical machine is automated, which can improve the efficiency of registering the HBA card of the bare metal server and reduce the probability of errors.
[0119] The above applications use specific examples to elaborate in detail the principle and implementation manner of the present invention. These embodiments are only used to help understand the core technical content of the present invention. Based on the above specific embodiments of the present invention, those skilled in the art of the present technology, without departing from the principle of the present invention, any improvements and modifications made to the present invention shall fall within the scope of the patent protection of the present invention.
Claims
1. A method for automatically registering an HBA card for a bare metal server, characterized in that, It includes the following steps: S1. Collect HBA card information: Implement the collection of HBA card information with the help of ironic inspector and ironic python agent in OpenStack; S2. Save HBA card information: Save the collected HBA card information with the help of the custom self-check rules of ironic inspector; S3. Register the HBA card: Develop a bare metal server registration tool by ourselves. This tool completes the registration of the HBA card by querying the information of the HBA card on the node and calling the interface provided by ironic.
2. The method for automatically registering an HBA card for a bare metal server according to claim 1, wherein The specific steps of step S1 include: S1.
1. After ironic sends a self-check request for the node to ironic inspector, ironic inspector starts the automatic discovery function, triggering the entire information collection process; S1.
2. ironic python agent runs on the node and prompts to start obtaining relevant information of the HBA card: ironicpython agent first checks whether the / sys / class / fc_host / directory exists in the server and checks whether the directory is empty: i) If the directory does not exist or is empty, it prompts that there is no HBA adapter, and the collection process ends. ii) If the directory exists and is not empty, obtain the names of all subdirectories under the / sys / class / fc_host / directory; S1.
3. ironic python agent prepares two lists, one for storing the WWNN information of the HBA card and the other for storing the WWPN information of the HBA card; S1.
4. For each subdirectory under the / sys / class / fc_host / directory, ironic python agent sequentially constructs the paths of the node_name and port_name files under the subdirectory, then opens the corresponding files, reads the content in hexadecimal format starting with 0x, and after removing the 0x flag, adds the processed information to the corresponding lists respectively; S1.
5. After completing the above operations, ironic python agent concatenates all the elements in the list storing the WWPN information into a string to obtain the complete WWPN information. At the same time, concatenates all the elements in the list storing the WWNN information into a string to obtain the complete WWNN information, and prompts that these information have been obtained; S1.
6. ironic python agent combines the processed complete WWPN and WWNN information into an HBA card information object for subsequent information processing and use.
3. The method for automatically registering an HBA card for a bare metal server according to claim 2, wherein The specific steps of step S2 include: Set the custom JSON format self-check rules in advance through the dedicated API of ironic inspector. This self-check rule clearly stipulates that after the hardware self-check is completed, the collected HBA card information will be saved and processed; After the ironic inspector receives the data including HBA card information fed back by the ironic python agent, it processes the data and sets the WWPN and WWNN number information of the HBA card to the specified attributes of the corresponding node for storage according to the self-check rules in the custom JSON format.
4. The method for automatically registering an HBA card for a bare metal server according to claim 3, wherein, Execute step S3. After starting the bare metal server registration tool, first query the saved HBA card information, that is, the WWPN and WWNN numbers, from the corresponding node. After the bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information to ironic. Ironic receives and records the registration information of the HBA card, thereby managing the HBA card and realizing the effective control of the HBA card of the bare metal server storage connection component.
5. The method for automatically registering an HBA card for a bare metal server according to claim 4, wherein, After the bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information to ironic. This process specifically includes: Obtain the relevant information of the HBA card, define relevant functions and receive the parameters required in the registration process, and initialize the operation log at the same time. Obtain the corresponding node information according to the received parameters. If the acquisition fails, the registration process will be terminated directly. If the acquisition is successful, further obtain the additional information of the node. If the additional information is empty, the registration process will be terminated. If the additional information is not empty, check whether it contains the WWPN and WWNN information related to the HBA card. If there is WWPN and WWNN information related to the HBA card, obtain its specific values, split them into a list, count the number of HBA cards, and call the interface provided by ironic to obtain the list of WWPNs and the list of WWNNs related to the registered HBA cards. Then traverse the WWNN list and the WWPN list respectively, compare each WWNN and WWPN with the registered list, and for the WWPN or WWNN that does not appear in the registered list, try to perform the registration operation through the corresponding method provided by ironic and record the registration result in detail. If there is no WWPN and WWNN information related to the HBA card, do nothing and end this registration process.
6. A system for automatically registering an HBA card for a bare metal server, characterized in that, It includes: An information collection module for collecting HBA card information by means of ironic inspector and ironic python agent in OpenStack. An information storage module for storing the collected HBA card information by means of the self-check rules of ironic inspector. A registration module for using the self-developed bare metal server registration tool to complete the registration of the HBA card by querying the information of the HBA card on the node and calling the interface provided by ironic.
7. The system for automatically registering an HBA card for a bare metal server according to claim 6, wherein The information collection module specifically performs the following operations by means of ironic inspector and ironic python agent in OpenStack to collect HBA card information: When Ironic sends a self-inspection request to Ironic Inspector for a node, Ironic Inspector starts the automatic discovery function, triggering the entire information collection process; The ironic python agent runs on the node and prompts to start obtaining relevant information about the HBA card: ironic python agent first checks whether the / sys / class / fc_host / directory exists on the server and checks whether the directory is empty: i) If the directory does not exist or is empty, it will prompt that there is no HBA adapter and the collection process ends. ii) If the directory exists and is not empty, get the names of all subdirectories under the / sys / class / fc_host / directory; Ironic Python agent prepares two lists, one for storing the WWNN information of the HBA card, and the other for storing the WWPN information of the HBA card; For each subdirectory under the / sys / class / fc_host / directory, the ironic python agent builds the path of the node_name and port_name files in the subdirectory in turn, then opens the corresponding file, reads the hexadecimal format and the content starting with 0x, removes the 0x sign, and adds the processed information to the corresponding list respectively; After completing the above operations, Ironic Python Agent connects all the elements in the list storing WWPN information with commas into a string to obtain the complete WWPN information. At the same time, it connects all the elements in the list storing WWNN information with commas into a string to obtain the complete WWNN information, and prompts that the information has been obtained. The ironic python agent combines the processed complete WWPN and WWNN information into an HBA card information object for subsequent information processing and use.
8. A system for automatically registering an HBA card for a bare metal server according to claim 7, wherein The information saving module uses the custom self-checking rules of Ironic Inspector to perform the following operations to save the collected HBA card information: Pre-set custom JSON format self-check rules through the ironic inspector's dedicated API. The self-check rules clearly stipulate that after the hardware self-check is completed, the collected HBA card information will be saved and processed; After receiving the data including HBA card information from Ironic Python Agent, Ironic Inspector processes the data and sets the WWPN and WWNN number information of the HBA card to the specified attributes of the corresponding node for storage according to the customized JSON format self-inspection rules.
9. The system for automatically registering an HBA card for a bare metal server according to claim 8, wherein The registration module uses the self-developed bare metal server registration tool to query the information of the HBA card on the node and call the interface provided by Ironic to complete the registration of the HBA card. This process specifically includes: Start the bare metal server registration tool. First, query the saved HBA card information, i.e., the WWPN and WWNN numbers, from the corresponding node. After the bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information to ironic. Ironic receives and records the registration information of the HBA card, thereby managing the HBA card and achieving effective control of the HBA card, which is a storage connection component of the bare metal server.
10. The system for automatically registering an HBA card for a bare metal server according to claim 9, wherein After the bare metal server registration tool obtains the relevant information of the HBA card, it transmits and registers the obtained information to ironic. This process specifically includes: Obtain the relevant information of the HBA card, define relevant functions and receive the parameters required during the registration process, and initialize the operation log at the same time. Obtain the corresponding node information according to the received parameters. If the acquisition fails, the registration process is directly terminated. If the acquisition is successful, further obtain the additional information of the node. If the additional information is empty, the registration process is terminated. If the additional information is not empty, check whether it contains the WWPN and WWNN information related to the HBA card. If there is WWPN and WWNN information related to the HBA card, obtain their specific values, split them into a list, count the number of HBA cards, and call the interface provided by ironic to obtain the WWPN list and WWNN list related to the registered HBA cards. Subsequently, traverse the WWNN list and WWPN list respectively, compare each WWNN and WWPN with the registered list, and for the WWPN or WWNN that does not appear in the registered list, try to perform the registration operation through the corresponding method provided by ironic, and record the registration result in detail. If there is no WWPN and WWNN information related to the HBA card, do nothing and end this registration process.