Testing Method for Storage Link, Electronic Device, Storage Medium and Program Product
By automating the verification of NPIV functionality through controller node initialization and switch zone configuration, the method addresses the inefficiencies of manual testing, improving reliability and efficiency in FC SAN networks.
Patent Information
- Application Number
- CN202510331518.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2045-03-20
AI Technical Summary
In a storage network with NPIV enabled, testers need to manually verify the path between the physical port and the virtual port and the mapped host, which makes the test process cumbersome and time-consuming and difficult to guarantee the reliability of the results.
By dynamically configuring switch partitions based on NPIV function of controller group, we automatically verify the service reliability between physical ports and virtual ports and mapped hosts, and realize the automation of multi-path testing and quickly adapt to different test scenarios.
Improves test coverage and efficiency in storage networks, enhances system reliability and flexibility, and reduces the risk of manual intervention and misconfiguration.
Smart Images

Figure CN119847846B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage network technologies, and in particular, to a method for testing a storage link, an electronic device, a storage medium, and a program product. Background Art
[0002] In today's digital age, important data of enterprises and individuals is stored on servers or storage devices. To improve the utilization rate and flexibility of storage resources, the FC SAN network (Fibre Channel Storage Area Network) introduces the NPIV technology (N_Port ID Virtualization). The NPIV technology allows a single physical port to be virtualized into multiple virtual ports, and assigns a unique wwpn (WorldWide Port Name) to each virtual port, so as to provide independent storage services for different hosts or virtual machines and support storage isolation in a multi-tenant environment.
[0003] However, when testing the service reliability after the NPIV function is enabled, testers still need to manually complete the path verification between physical ports and virtual ports and the mapped hosts, as well as the migration ability of virtual ports in the case of node failures. Testers need to perform each test operation in an extreme test state according to different versions and business requirements. This process is not only cumbersome and time-consuming, but also due to the existence of human factors, the reliability of test results is difficult to guarantee. Summary of the Invention
[0004] This application provides a method for testing a storage link, an electronic device, a storage medium, and a program product to at least solve the problem of systematic verification of service reliability when the NPIV function is enabled in related technologies.
[0005] In a first aspect, this application provides a method for testing a storage link. The method includes: in response to receiving a test instruction, initializing multiple controller nodes in a storage server to form one or more controller groups, creating a storage cluster, and networking the controller groups to the storage cluster; where the controller nodes are used to connect to a switch to connect to a host through the switch; configuring a switch partition that matches the current state of the port virtualization function of the controller group; where the port virtualization function is used to virtually form multiple virtual ports from the physical ports of the controller nodes, and the switch partition includes the physical ports and / or virtual ports of the host and the controller nodes; verifying the routing path between the host and the storage cluster according to the first mapping relationship, the current state, and the switch partition between the physical ports and the virtual ports; where the routing path includes a second mapping relationship between the host and the physical ports, and a third mapping relationship between the host and the virtual ports.
[0006] In a second aspect, the present application further provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of the test method for the storage link in the following embodiments when executing the computer program: in response to receiving a test instruction, initializing a plurality of controller nodes in a storage server to form one or more controller groups, creating a storage cluster, and networking the controller groups to the storage cluster; wherein the controller nodes are used to connect to a switch to connect to a host through the switch; configuring a switch partition that matches the current state of the port virtualization function of the controller group; wherein the port virtualization function is used to virtually form a plurality of virtual ports from the physical ports of the controller nodes, and the switch partition includes the physical ports and / or virtual ports of the host and the controller nodes; verifying the routing path between the host and the storage cluster according to the first mapping relationship, the current state, and the switch partition between the physical port and the virtual port; wherein the routing path includes a second mapping relationship between the host and the physical port, and a third mapping relationship between the host and the virtual port.
[0007] In a third aspect, the present application further provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the test method for the storage link in the following embodiments: in response to receiving a test instruction, initializing a plurality of controller nodes in a storage server to form one or more controller groups, creating a storage cluster, and networking the controller groups to the storage cluster; wherein the controller nodes are used to connect to a switch to connect to a host through the switch; configuring a switch partition that matches the current state of the port virtualization function of the controller group; wherein the port virtualization function is used to virtually form a plurality of virtual ports from the physical ports of the controller nodes, and the switch partition includes the physical ports and / or virtual ports of the host and the controller nodes; verifying the routing path between the host and the storage cluster according to the first mapping relationship, the current state, and the switch partition between the physical port and the virtual port; wherein the routing path includes a second mapping relationship between the host and the physical port, and a third mapping relationship between the host and the virtual port.
[0008] Fourthly, the present application also provides a computer program product, including a computer program, which when executed by a processor, implements the steps of the test method for the storage link in the following embodiments: in response to receiving a test instruction, initializing multiple controller nodes in a storage server to form one or more controller groups, creating a storage cluster, and networking the controller groups to the storage cluster; wherein the controller nodes are used to connect to a switch to connect to a host through the switch; configuring a switch partition that matches the current state of the port virtualization function of the controller group; wherein the port virtualization function is used to virtually form multiple virtual ports from the physical ports of the controller nodes, and the switch partition includes the physical ports and / or virtual ports of the host and the controller nodes; verifying the routing path between the host and the storage cluster according to the first mapping relationship, the current state, and the switch partition between the physical ports and the virtual ports; wherein the routing path includes the second mapping relationship between the host and the physical ports, and the third mapping relationship between the host and the virtual ports.
[0009] Through the present application, since the switch partition is dynamically configured based on the current state of the NPIV function of the controller group, the service reliability between the physical ports and the virtual ports and the mapped host is verified, and the full process automation of multipath verification can quickly adapt to the requirements of different test scenarios. Therefore, technical problems such as complex virtual port management and easy manual configuration errors in the storage network can be solved, and the technical effects of improving the test coverage and efficiency, and enhancing the system reliability and flexibility can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] To more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0011] Figure 1 It is a structural block diagram of a host and a storage cluster provided by an embodiment of the present application;
[0012] Figure 2 It is a schematic flowchart of a test method for a storage link provided by an embodiment of the present application;
[0013] Figure 3 It is a schematic flowchart of a step for creating a cluster provided by an embodiment of the present application;
[0014] Figure 4 It is a schematic flowchart of a step for configuring a switch partition in a disabled state provided by an embodiment of the present application;
[0015] Figure 5A flowchart showing the steps of configuring a switch partition in a transition state provided by an embodiment of the present application;
[0016] Figure 6 A flowchart showing the steps of verifying the path between a host and a storage cluster provided by an embodiment of the present application;
[0017] Figure 7 A structural block diagram of a test device for a storage link provided by an embodiment of the present application;
[0018] Figure 8 An internal structure diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0019] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.
[0020] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.
[0021] To enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0022] As Figure 1 shown, FC SAN (Fibre Channel Storage Area Network) is a high-speed dedicated network based on the Fibre Channel protocol, used to connect servers (hosts) and storage devices (such as disk arrays, tape libraries). The host connects to the switch through an HBA (Host Bus Adapter) card, and the switch connects to the controller node of the storage server through its ports.
[0023] Among them, the HBA card is a Fibre Channel interface card installed on the host. Each HBA card may have multiple physical ports, and each physical port has a physical wwpn (World Wide Port Name), which serves as the wwpn of the host. The wwpn is a 64-bit unique identifier used to identify ports in the Fibre Channel network to ensure that each wwpn is unique globally. In the Fibre Channel network, when two devices need to communicate, they first exchange wwpns to confirm each other's identities. This mechanism ensures that data can only be sent to the correct target port, thereby improving the security and reliability of the network.
[0024] The switch is used to connect the host and the storage cluster and is responsible for routing and traffic management. By configuring zones on the switch, the wwpn of the host can be bound to the wwpn of the storage cluster to form an access path, thereby logically dividing the devices connected in the SAN network into different zones. These zones prevent devices in different zones from directly accessing each other, thus achieving isolation between devices in the network.
[0025] NPIV is a network technology, especially in the field of storage networks. It allows a single physical N port (NodePort) to be logically divided into multiple virtual N ports (NPIV Ports), and a virtual wwpn is assigned to each virtual port, thereby providing multiple independent paths through the virtual wwpn. This technology can virtualize multiple virtual ports from the physical ports of the controller node, thus providing higher flexibility and scalability for the storage server because it allows a single physical connection to support multiple logical unit numbers (LUNs) or storage volumes without the need to assign a separate physical port to each LUN or storage volume.
[0026] The embodiments of the present application provide a method for testing a storage link. In combination with the execution process of the method for testing the storage link, the method is described in detail.
[0027] In one embodiment, as Figure 2 shown, a method for testing a storage link is provided. The method includes the following steps:
[0028] S1, in response to receiving a test instruction, initialize multiple controller nodes in the storage server to form one or more controller groups, create a storage cluster, and network the controller groups to the storage cluster; wherein, the controller nodes are used to connect to the switch to connect to the host through the switch.
[0029] Among them, a storage server can be dual - controller, quad - controller, etc. Multiple storage servers can be defined as a storage cluster, which work together to improve availability and scalability. In this embodiment, the dual - controller is taken as an example, that is, the dual - controller node. Each controller node can be an independent hardware device or a virtual machine, and the dual - controller nodes are master - standby to each other. When one node fails, the other node takes over its work to ensure that the service is not interrupted. The controller group, namely the IO group, is a logical grouping of controller nodes for managing high availability and load balancing. In the dual - controller scenario, usually two controller nodes are configured as an IO group, and they cooperate to process IO requests. Quad - controller or octo - controller devices can be divided into one or more IO groups. For example, a quad - controller can configure 4 controller nodes as an IO group containing 4 nodes, or can also be configured as two IO groups containing 2 nodes each, which is not specifically limited here.
[0030] In an alternative embodiment, creating a storage cluster and networking the controller group to the storage cluster includes: defining a site and configuring site information, where the site information includes one or more of device type, logical address, port, username, password, and port identifier. The device type includes storage cluster, host, switch, and controller node; obtaining the logical address of the storage cluster from the site information and determining whether there is an already - created storage cluster by accessing the logical address of the storage cluster; in response to the logical address of the storage cluster being accessible and there being an already - created cluster, tearing down the already - created storage cluster, initializing each controller node in the already - created storage cluster, and creating a new storage cluster; in response to the logical address of the storage cluster being inaccessible, creating a new storage cluster.
[0031] Specifically, the login information of the physical devices involved in the storage cluster is uniformly managed to jointly form the site information structure site, and the login information is distinguished by device type, including storage cluster cluster, node node, host host, switch switch, etc. Each login information within the site needs to include ip, port, user, passwd, physical wwpn code, etc.
[0032] Exemplarily, the configuration file of the site information can be: [{siteid:1,platform:Host 1,ip:*,passwd:*,wwpn:*},{siteid:2,platform:Switch},{siteid:3,platform:Node 1,wwpn:*}].
[0033] Further, when a normal set of initial devices performs a test for the first time, the storage cluster has not been created yet. At this time, by logging in to access the storage cluster IP address in the site information, check whether the storage cluster IP can be accessed. If it can be accessed, it means that there is an old storage cluster. The old storage cluster needs to be removed first, and each controller node needs to be logged in through SSH to clear the residual information of the old storage cluster to prevent configuration conflicts.
[0034] In an optional implementation, creating a new storage cluster includes: respectively determining whether multiple controller nodes are in the candidate state; in response to the existence of a controller node in a non-candidate state, repairing the non-candidate state controller node to the candidate state; in response to all multiple controller nodes being in the candidate state, determining a primary node from the multiple controller nodes and using the other controller nodes as standby nodes; creating a new storage cluster on the primary node, grouping the controller nodes to form a controller group, and controlling the controller group to include at least two controller nodes.
[0035] Specifically, taking a dual-controller as an example, if the storage cluster IP is not accessible, randomly select one node as the primary node and the other as the standby node. Log in to the primary node and monitor that all nodes of the storage server are in the candidate state (that is, not joined to any storage cluster and can be initialized). Create a new storage cluster on the primary node, and specify 2 nodes in 1 IOgroup. The storage cluster ip is the corresponding ip address of the cluster in the site information structure site, and the host can access the storage service through this ip.
[0036] It should be noted that an IO group is a grouping of storage controller nodes. A minimum of 2 nodes in an IO group are mutual primary and standby nodes. Devices with multiple nodes can also set multiple IO groups. In this embodiment, a dual-controller is taken as an example, so one IO group is set. If a quad-controller is used, usually the nodes are divided into 2 IO groups, and the two nodes in each IO group are mutual primary and standby nodes. It can also be that 1 IO group contains 4 nodes, then select one node as the primary node and the other 3 as standby nodes. No specific limitation is made here.
[0037] S2, configuring a switch partition that matches the current state of the port virtualization function of the controller group; wherein the port virtualization function is used to virtually form multiple virtual ports from the physical ports of the controller nodes, and the switch partition includes the physical ports and / or virtual ports of the host and the controller nodes.
[0038] In an optional embodiment, the current state includes a disabled state, a transition state, and an enabled state; in response to receiving a test instruction, a loop counter is started, and the current count value of the loop counter is incremented by 1, where the loop counter is used to record the number of tests; a switch partition matching the current state of the port virtualization function of the controller group is configured, including: determining whether the port virtualization function of one or more controller groups is in a disabled state; in response to the port virtualization function of a controller group not being in a disabled state, recording the current count value of the loop counter and exiting after collecting error logs; in response to the port virtualization function of one or more controller groups being in a disabled state, determining whether the current count value of the loop counter is greater than a preset value; in response to the current count value being greater than the preset value, loading a preset first configuration and applying it to the switch; in response to the current count value being less than or equal to the preset value, partitioning the first identifier of the host and the second identifier of the physical port into the same switch partition and saving it as the first configuration.
[0039] Among them, the default state of NPIV is the disabled state "disabled", the initial value of the loop counter "count" = 0, and when a test instruction is received, "count"++. The current count value is incremented by 1. To ensure that the switch partition "zone" is configured when the NPIV function is not enabled in the IO group, it is necessary to first check whether the default state of NPIV in each IO group is the disabled state "disabled". If not, it means that there are uncleared virtual ports, which may cause test interference, and errors need to be recorded and the test process terminated. If so, determine whether the current "count" is greater than 1. If it is greater than 1, it means that the loop has been executed multiple times. At this time, the configuration file has been set, and the first configuration of the switch "cfg1" can be directly set to take effect. If the condition that "count" is greater than 1 does not hold, it means that it is the first execution, and the switch partition needs to be configured. At this time, the storage can only be accessed through the physical port of the controller node. An instruction is sent to the switch "switch" to set the partition, and the first identifier of the host "wwpn" and the second identifier of the physical port "wwpn" are partitioned into a partition "zone" and saved as the first configuration "cfg1".
[0040] Based on the above steps, it is determined whether it is the first execution through the current count value of the loop counter. In the case of non-first execution, the existing configuration can be directly applied, reducing repeated operations, and ensuring that in the case where the NPIV function is not enabled in the current IO group (that is, the storage service cannot be accessed through the virtual port), the switch "zone" is directly configured based on the physical "wwpn", which is convenient for subsequent testing of the physical path from the host to the storage.
[0041] S3. Verify the routing path between the host and the storage cluster according to the first mapping relationship between the physical port and the virtual port, the current status, and the switch partition; wherein, the routing path includes the second mapping relationship between the host and the physical port, and the third mapping relationship between the host and the virtual port.
[0042] In an optional implementation manner, verifying the routing path between the host and the storage cluster includes: defining an output structure body, including a first structure body and a second structure body; according to the current status, querying the unreachable link records from the host to the storage cluster into the first structure body, and querying the unreachable link records from the storage cluster to the host into the second structure body; returning the output structure body, and determining whether the output structure body is empty.
[0043] Among them, in order to verify the two-way connectivity between the host and the storage, it is determined whether the links from the host to the storage and from the storage to the host are normal by the host scanning the storage and the storage checking the host, and in combination with the NPIV status, finally output the unreachable wwpn path and record it into the output structure body. For example, the first structure body corresponding to the host to the storage is host_to_cms{}, and the second structure body corresponding to the storage to the host is cms_to_host{}.
[0044] In an optional implementation manner, according to the current status, querying the unreachable link records from the host to the storage cluster into the first structure body, and querying the unreachable link records from the storage cluster to the host into the second structure body includes: obtaining the first identifier of each host from the site information and recording it into the third structure body; constructing a fourth structure body according to the first mapping relationship between the physical port and the virtual port, and the fourth structure body includes the second identifier of the physical port and / or the third identifier of the virtual port; scanning the storage cluster by logging in to the host corresponding to the third structure body, and adding the scanned second identifier and / or third identifier to the first list; matching the first list with the fourth structure body, and recording the unmatched results into the first structure body; logging in to the storage cluster to query the first identifier of the connectable host and adding it to the second list; matching the second list with the third structure body, and recording the unmatched results into the second structure body.
[0045] Specifically, according to the site information structure, construct the wwpn structure hostwpn of the host, that is, the third structure. At this time, query the status of NPIV. If it is in the disabled state, extract the second identifier wwpn of the physical port from the first mapping relationship npidwpn to generate sourcewpn, that is, the fourth structure; if it is in the transitional state or the enabled state, extract the second identifier wwpn of the physical port and the third identifier wwpn of the virtual port from npidwpn to generate the sourcewpn structure.
[0046] When scanning the storage through the host, traverse each hostwpn, log in to the host to execute the scan of the storage cluster, query the visible wwpns and add them to the first list. Compare with sourcewpn, and record the wwpn codes that exist in sourcewpn but are not scanned in the first list into the first structure host_to_cms{}.
[0047] It should be noted that when NPIV is in the disabled state, usually only the physical wwpns can be seen when logging in to the host, which is used to verify whether the host can access the storage through the physical path; when NPIV is in the transitional state, both physical wwpns and virtual wwpns can be seen, which is used to verify whether the host can access the storage through the virtual path; when NPIV is in the enabled state, only the virtual wwpns can be seen, which is used to inject node failures and verify path migration.
[0048] When checking the host through the storage, log in to the storage cluster, view the connectable host wwpns and add them to the second list. Compare with sourcewpn, and record the wwpn codes that exist in hostwpn but are not scanned in the second list into the second structure cms_to_host{}.
[0049] Based on the above steps, by scanning the storage through the host and checking the host through the storage, respectively record the storage wwpns not found by the host and the host wwpns not recognized by the storage, reduce manual intervention, and improve the test efficiency and consistency. At the same time, ensure that all expected paths are detected to avoid missing single-point failures.
[0050] In an optional implementation manner, in response to the current state being the disabled state and the switch loading the first configuration, the fourth structure includes the second identifier of the physical port; determine whether the returned output structure is empty; in response to the output structure not being empty, record the current count value of the loop counter and exit after collecting the error log; in response to the output structure being empty, log in to the storage cluster and set the port virtualization function of the controller group to the transitional state.
[0051] Specifically, when NPIV is in the disabled state and the first configuration is only mapped to physical ports, it is determined whether the returned output structure is empty, that is, whether len(cms_to_host) and len(host_to_cms) are equal to 0. If it is not empty, it indicates that there is a problem. Record the count number, collect the error log, and then exit. If it is empty, it means that the physical paths between all hosts and storage are normally connected. Change the NPIV of each IO group to the transitional state for subsequent verification of virtual paths.
[0052] Among them, the transitional state is the intermediate state of NPIV from the disabled state to the enabled state. It allows the generation of the wwpn of virtual ports, but multi-path is not fully enabled yet. At this time, when logging in to the host, the wwpn of the physical port and the wwpn of the virtual port can be viewed simultaneously.
[0053] In an optional implementation manner, configuring a switch partition that matches the current state of the port virtualization function of the controller group further includes: in response to the current state being the transitional state, obtaining a third identifier of the virtual port corresponding to the physical port, and updating the fourth structure based on the third identifier; determining whether the current count value of the loop counter is greater than a preset value; in response to the current count value being greater than the preset value, loading a preset second configuration and applying it to the switch; in response to the current count value being less than or equal to the preset value, dividing the first identifier of the host and the third identifier corresponding to the virtual port into the same switch partition and saving it as the second configuration.
[0054] Specifically, when the NPIV state of the controller node changes from the disabled state to the transitional state or the enabled state, the controller node assigns a virtual wwpn code (i.e., the third identifier) to the virtual port based on the physical wwpn code (i.e., the second identifier) of the physical port. Query the generated wwpn code of the virtual port and write it into npidwpn. Among them, npidwpn is the first mapping relationship structure between the physical wwpn code of the physical port and the wwpn code of the virtual port. Currently, at least 2 virtual ports can be virtualized from one physical port. For example, [{staticWpn1:*, virtualWpn[wpn1, wpn2]}…]. In this application, the number of virtual ports mapped is not limited.
[0055] In an optional implementation, the maximum number of logins for a single physical port of the controller node can be obtained through testing, specifically including: allocating 256 virtual ports for the physical port; using the least mean square algorithm to allocate a third identifier for each of the allocated virtual ports; using the cheek.Floyd( ) function based on the Floyd cycle detection algorithm to verify whether there are identical third identifiers among the allocated third identifiers; if so, deleting the duplicate third identifiers and reallocating a third identifier for each corresponding virtual port; if not, registering the currently allocated third identifiers of each virtual port to the switch to establish a login connection between the host and the storage cluster; respectively counting the number of first identifiers of the host ends connected to each physical port in the storage cluster, and the largest number is the maximum number of client logins for a single physical port of the controller node.
[0056] Specifically, the NPIV startup interface of the host end can be called to send 256 IOCB commands to the storage end, and after receiving the feedback from the storage end, the vports.Random( ) function based on the octree algorithm automatically allocates 256 virtual ports for each physical port of the storage end, so as to control each virtual port to establish a connection with the host, and then test the maximum number of logins for a single physical port, breaking the limit of the number of physical servers, reducing the test cost and human input, and helping to improve the test efficiency and save the test time.
[0057] Further, it is judged whether the current count is greater than 1. If it is greater than 1, it means that the loop has been executed multiple times, and at this time the configuration file has been set, and it is only necessary to set the second configuration cfg2 of the switch to take effect. If it is not established that count is greater than 1, it means that it is the first execution, and it is necessary to configure the switch partition, divide the wwpn of the host and the virtual wwpn of the storage cluster into a zone, and save it as the second configuration cfg2.
[0058] Based on the above steps, after determining that the physical path between the host and the storage is normally connected, the NPIV status is switched to the transition state, and the wwpn of the host is bound to the virtual wwpn of the storage in the switch partition to ensure that the host can access the storage through the virtual port, which is convenient for subsequent multipath verification.
[0059] In an alternative embodiment, configuring a switch partition that matches the current state of the controller group port virtualization function further includes: in response to the current state being a transition state and the switch loading a second configuration, the fourth structure includes a second identifier of a physical port and a third identifier of a virtual port; determining whether the returned output structure is empty; in response to the output structure not being empty, recording the current count value of the loop counter and exiting after collecting error logs; in response to the output structure being empty, logging in to the storage cluster to create a storage pool and logical volumes, and mapping the logical volumes to the host; determining whether the current count value of the loop counter is greater than a preset value; in response to the current count value being greater than the preset value, loading a preset third configuration and applying it to the switch; in response to the current count value being less than or equal to the preset value, selecting a target host and a target physical port from the second configuration, and configuring the mapping between the target host and the target physical port, and saving it as the third configuration.
[0060] Specifically, after applying the second configuration, it is necessary to verify whether the virtual path between the host and the storage is connected, and determine whether the output structure is empty, that is, whether len(cms_to_host) and len(host_to_cms) are 0. If not empty, it indicates that there are errors or abnormal situations. At this time, record the count times and exit after collecting error logs. If it is empty, log in to the storage cluster to create necessary storage pools and logical volumes and map them to each host to ensure that the host can access storage resources.
[0061] Determine again whether the current count is greater than 1. If it is greater than 1, it means that the loop has been executed multiple times. At this time, the configuration file has been set, and directly set the switch third configuration cfg3 to take effect. If the condition that the count is greater than 1 does not hold, it means that it is the first execution. Randomly select a target host named Pi from the second configuration cfg2, and configure pi to map only with the wwpn of the target physical port. After completion, save this configuration as the third configuration cfg3. In this way, by restricting pi to access the storage only through the physical wwpn, a single-path (host pi) failure scenario can be simulated to test whether the multi-path redundancy takes effect.
[0062] In an alternative embodiment, in response to the current state being a transition state and the switch loading the third configuration, issue input / output read / write commands to the mapped logical volumes through each host; in response to the target host issuing input / output read / write commands to the target physical port normally, log in to the storage cluster to change the port virtualization function of one or more controller groups to the enabled state.
[0063] Specifically, after applying the third configuration, log in to each host to perform IO read and write operations on the mapped logical volume, and check whether the target host issues IO to the target physical port normally at this time. If it is normal, it means that the target host accesses the storage through the target physical wwpn at this time. Log in to the storage cluster and change the NPIV of each IO group to the enabled state. At this time, the physical wwpn is inaccessible, which is used to simulate the single-path failure scenario of the target host subsequently.
[0064] In an optional implementation manner, configuring a switch partition that matches the current state of the controller group port virtualization function further includes: in response to the current state being the enabled state and the switch loading the third configuration, the fourth structure includes the second identifier of the physical port and the third identifier of the virtual port; determining whether the returned output structure is empty; in response to the output structure being empty, recording the current count value of the loop counter and exiting after collecting the error log; in response to the output structure not being empty, determining whether the first identifier of the target host and the second identifier of the target physical port exist in the output structure; if not, recording the current count value of the loop counter and exiting after collecting the error log; if so, loading the second configuration and applying it to the switch.
[0065] Specifically, since the NPIV function is in the enabled state and the physical path fails, the target host pi cannot access the storage through the old path. At this time, it can only access the virtual wwpn. However, the target host is configured to be mapped only to the target physical port and cannot access through the virtual wwpn. Therefore, if the output structure is empty, it means that there is an exception or error. Record the count number of times, collect the error log and then exit. If it is not empty, determine whether the wwpns of the target host pi and the target physical port are both in the output structure. If so, log in to the target host pi. If the logical volume cannot be seen and the IO is found to be interrupted, it means that the result meets the expectations and all necessary configurations have been set correctly. At this time, load the second configuration cfg2, that is, map the host wwpn to all virtual wwpns.
[0066] Based on the above steps, through status checking and verification of the structure content, it is ensured that configuration changes are only made under specific conditions, improving the accuracy and reliability of configuration management and reducing the risk of service interruption caused by incorrect configurations. At the same time, an automated process is used to load and apply configurations, reducing the need for manual intervention and improving the operation and maintenance efficiency and response speed.
[0067] In an optional embodiment, in response to the current state being enabled and the switch loading the second configuration, input and output read and write instructions are sent to the mapped logical volume through each host; in response to the target host normally sending input and output read and write instructions to the target virtual port, the target controller node where the target virtual port is located is queried; a fault is injected into the target controller node, and the target controller node is restarted; in response to the input and output read and write instructions not being interrupted, the target controller node is used as a backup node, and the returned output structure is obtained; in response to the third identifier of the target virtual port not existing in the output structure, the target controller node is re-added to the storage cluster after waiting for a preset time; the mapping relationship between the host and the logical volume is cleared, and the third identifier of the virtual port in the fourth structure is deleted.
[0068] Specifically, after reloading the second configuration cfg2, all hosts' IO are started again to read and write IO to the mapped logical volume, and the target host pi is logged in. If the target host sends IO to the target virtual port normally, the target controller node where the target virtual port is located is further queried. In order to test the fault tolerance of the system, a node failure is injected into the target control node through the fault controller, and the node is restarted to make it leave the storage cluster. If the storage cluster can be logged in normally, and the logical volumes remain online, and the business IO is not interrupted, it means that the system has good fault tolerance. At this time, the target controller node is used as a backup node, and the returned output structure is further checked to see if the wwpn code of the target virtual port exists. If not, the system will wait for a preset time (for example, 30-60s), and then rejoin the target controller node to the storage cluster. If you log in to the storage cluster to confirm that the restarted node rejoins the storage cluster, and the target controller node where the target virtual port is located is switched back to the original node, clear the mapping relationship between the host and the logical volume, ensure that there are no unprocessed data requests pointing to the logical volume, delete the virtual wwpn code in the npidwpn structure, and then continue with the next round of testing. After running for several days in a row without exiting midway and without error logs, kill the process to end the test.
[0069] Based on the above steps, by simulating node failure and restarting, the path migration in the failure scenario and the path switching back after failure recovery were verified. Once a failure is detected, the system can automatically failover and rejoin the node to the cluster. By actually issuing IO instructions and monitoring their execution during the restart of the controller node, it ensures that services can continue to be provided when the node fails, reducing the need for manual intervention and enhancing the high availability of the system.
[0070] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0071] An embodiment of the present application further provides a test device for a storage link, including an initialization module, a configuration module, and a verification module, where: The initialization module is used to initialize multiple controller nodes in a storage server to form one or more controller groups in response to receiving a test instruction, create a storage cluster, and network the controller groups to the storage cluster; wherein, the controller nodes are used to connect to a switch to connect to a host through the switch; The configuration module is used to configure a switch partition that matches the current state of the port virtualization function of the controller group; wherein the port virtualization function is used to virtually form multiple virtual ports from the physical ports of the controller nodes, and the switch partition includes the physical ports and / or virtual ports of the host and the controller nodes; The verification module is used to verify the routing path between the host and the storage cluster according to the first mapping relationship, the current state, and the switch partition between the physical port and the virtual port; wherein the routing path includes the second mapping relationship between the host and the physical port, and the third mapping relationship between the host and the virtual port.
[0072] In one embodiment, the initialization module is further used to define a site and configure site information, where the site information includes one or more of device type, logical address, port, username, password, and port identifier, and the device type includes storage cluster, host, switch, and controller node; obtain the logical address of the storage cluster from the site information, and determine whether a created storage cluster currently exists by accessing the logical address of the storage cluster; in response to the logical address of the storage cluster being accessible and a created cluster currently existing, demolish the created storage cluster, initialize each controller node in the created storage cluster, and create a new storage cluster; in response to the logical address of the storage cluster being inaccessible, create a new storage cluster.
[0073] In one embodiment, the initialization module is further used to separately determine whether multiple controller nodes are in a candidate state; in response to there being a controller node in a non-candidate state, repair the controller node in the non-candidate state to the candidate state; in response to multiple controller nodes all being in the candidate state, determine a primary node from the multiple controller nodes, and use the other controller nodes as standby nodes; create a new storage cluster on the primary node, group the controller nodes to form a controller group, and control the controller group to include at least two controller nodes.
[0074] In one embodiment, the configuration module is further configured to, in response to receiving a test instruction, start a loop counter, and increment the current count value of the loop counter by 1, where the loop counter is used to record the number of test times; determine whether the port virtualization function of one or more controller groups is in a disabled state; in response to there being a controller group whose port virtualization function is not in a disabled state, record the current count value of the loop counter, and exit after collecting error logs; in response to the port virtualization functions of one or more controller groups all being in a disabled state, determine whether the current count value of the loop counter is greater than a preset value; in response to the current count value being greater than the preset value, load a preset first configuration and apply it to the switch; in response to the current count value being less than or equal to the preset value, partition the first identifier of the host and the second identifier of the physical port into the same switch partition, and save it as the first configuration.
[0075] In one embodiment, the verification module is further configured to define an output structure, including a first structure and a second structure; according to the current state, query the inaccessible link records from the host to the storage cluster and record them in the first structure, and query the inaccessible link records from the storage cluster to the host and record them in the second structure; return the output structure, and determine whether the output structure is empty.
[0076] In one embodiment, the verification module is further configured to obtain the first identifier of each host from the site information and record it in a third structure; construct a fourth structure according to the first mapping relationship between the physical port and the virtual port, where the fourth structure includes the second identifier of the physical port and / or the third identifier of the virtual port; scan the storage cluster by logging in to the host corresponding to the third structure, and add the scanned second identifier and / or third identifier to a first list; match the first list with the fourth structure, and record the unmatched results in the first structure; log in to the storage cluster to query the first identifier of the connectable host, and add it to a second list; match the second list with the third structure, and record the unmatched results in the second structure.
[0077] In one embodiment, the verification module is further configured to, in response to the current state being a disabled state and the switch loading the first configuration, where the fourth structure includes the second identifier of the physical port; determine whether the returned output structure is empty; in response to the output structure not being empty, record the current count value of the loop counter, and exit after collecting error logs; in response to the output structure being empty, log in to the storage cluster and set the port virtualization function of the controller group to a transition state.
[0078] In one embodiment, the configuration module is further configured to, in response to the current state being a transition state, obtain a third identifier of a virtual port corresponding to a physical port, and update a fourth structure based on the third identifier; determine whether a current count value of a loop counter is greater than a preset value; in response to the current count value being greater than the preset value, load a preset second configuration and apply it to the switch; in response to the current count value being less than or equal to the preset value, divide a first identifier of a host and a third identifier of a virtual port corresponding to the virtual port into the same switch partition, and save it as a second configuration.
[0079] In one embodiment, the configuration module is further configured to, in response to the current state being a transition state and the switch loading a second configuration, the fourth structure includes a second identifier of a physical port and a third identifier of a virtual port; determine whether a returned output structure is empty; in response to the output structure not being empty, record the current count value of the loop counter, and exit after collecting error logs; in response to the output structure being empty, log in to a storage cluster to create a storage pool and a logical volume, and map the logical volume to a host; determine whether the current count value of the loop counter is greater than a preset value; in response to the current count value being greater than the preset value, load a preset third configuration and apply it to the switch; in response to the current count value being less than or equal to the preset value, select a target host and a target physical port from the second configuration, and configure the mapping between the target host and the target physical port, and save it as a third configuration.
[0080] In one embodiment, the configuration module is further configured to, in response to the current state being a transition state and the switch loading a third configuration, send input / output read / write instructions to the mapped logical volume through each host; in response to the target host sending input / output read / write instructions to the target physical port normally, log in to the storage cluster to change the port virtualization function of one or more controller groups to an enabled state.
[0081] In one embodiment, the configuration module is further configured to, in response to the current state being an enabled state and the switch loading a third configuration, the fourth structure includes a second identifier of a physical port and a third identifier of a virtual port; determine whether a returned output structure is empty; in response to the output structure being empty, record the current count value of the loop counter, and exit after collecting error logs; in response to the output structure not being empty, determine whether a first identifier of a target host and a second identifier of a target physical port exist in the output structure; if not, record the current count value of the loop counter, and exit after collecting error logs; if so, load the second configuration and apply it to the switch.
[0082] In one embodiment, it further includes a test module, which is configured to, in response to the current state being the enabled state and the switch loading the second configuration, send input / output read / write instructions to the mapped logical volumes through each host; in response to the target host normally sending input / output read / write instructions to the target virtual port, query the target controller node where the target virtual port is located; inject a fault into the target controller node and restart the target controller node; in response to the input / output read / write instructions not being interrupted, use the target controller node as a standby node and obtain the returned output structure; in response to the third identifier of the target virtual port not existing in the output structure, wait for a preset time and then rejoin the target controller node to the storage cluster; clear the mapping relationship between the host and the logical volume, and delete the third identifier of the virtual port in the fourth structure.
[0083] For the description of the features corresponding to the embodiments of the storage link test device, reference can be made to the relevant descriptions of the corresponding embodiments of the storage link test method, which will not be elaborated here one by one. Each module in the above storage link test device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above each module.
[0084] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the embodiments of the above storage link test method.
[0085] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the embodiments of the above storage link test method when running.
[0086] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk, or optical disc, etc., various media that can store computer programs.
[0087] An embodiment of the present application further provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the embodiments of the above storage link test method.
[0088] Embodiments of the present application further provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps in the embodiments of any of the above storage link test methods are implemented.
[0089] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0090] The above has introduced in detail a storage link test method, an electronic device, a storage medium, and a program product provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.
Claims
1. A test method for a storage link, characterized in that, The described test method includes: In response to receiving a test instruction, initialize multiple controller nodes in the storage server to form one or more controller groups, create a storage cluster, and network the controller group to the storage cluster; wherein, the controller nodes are used to connect to a switch to connect to a host through the switch; Obtain the current state of the port virtualization function of the controller group; wherein the port virtualization function is used to virtually form multiple virtual ports from the physical ports of the controller nodes, and the current state includes a disabled state, a transition state, and an enabled state; Configure a switch partition that matches the current state to partition the host and the physical ports and / or virtual ports of the controller nodes into the same switch partition; Verify the routing path between the host and the storage cluster according to the first mapping relationship between the physical port and the virtual port, the current state, and the switch partition; wherein, the routing path includes the second mapping relationship between the host and the physical port, and the third mapping relationship between the host and the virtual port.
2. The test method for a storage link according to claim 1, wherein The creating of the storage cluster and networking the controller group to the storage cluster includes: Define a site and configure site information, where the site information includes one or more of device type, logical address, port, username, password, and port identifier, and the device type includes storage cluster, host, switch, and controller node; Obtain the logical address of the storage cluster from the site information, and determine whether a created storage cluster currently exists by accessing the logical address of the storage cluster; In response to the logical address of the storage cluster being accessible and a created cluster existing, tear down the created storage cluster, initialize each controller node in the created storage cluster, and create a new storage cluster; In response to the logical address of the storage cluster being inaccessible, create a new storage cluster.
3. The test method for a storage link according to claim 2, wherein, The creating of the new storage cluster includes: Respectively determine whether the multiple controller nodes are in a candidate state; In response to there being a controller node in a non-candidate state, repair the non-candidate state controller node to a candidate state; In response to all the multiple controller nodes being in a candidate state, determine a primary node from the multiple controller nodes, and use the other controller nodes as standby nodes; Create a new storage cluster on the primary node, group the controller nodes to form the controller group, and control the controller group to include at least two of the controller nodes.
4. The test method for a storage link according to claim 2, wherein The method further includes: In response to receiving a test instruction, start a loop counter, and increment the current count value of the loop counter, where the loop counter is used to record the number of test times; The configuring of the switch partition that matches the current state includes: Determine whether the port virtualization function of the one or more controller groups is in a disabled state; In response to there being a controller group whose port virtualization function is not in a disabled state, record the current count value of the loop counter, and exit after collecting error logs; In response to the port virtualization functions of the one or more controller groups all being in the disabled state, determine whether the current count value of the loop counter is greater than a preset value; In response to the current count value being greater than the preset value, load a preset first configuration and apply it to the switch; In response to the current count value being less than or equal to the preset value, partition the first identifier of the host and the second identifier of the physical port into the same switch partition and save it as the first configuration.
5. The test method for a storage link according to claim 4, wherein, The verifying the routing path between the host and the storage cluster includes: Define an output structure, including a first structure and a second structure; According to the current state, query the unreachable link records from the host to the storage cluster into the first structure, and query the unreachable link records from the storage cluster to the host into the second structure; Return the output structure and determine whether the output structure is empty.
6. The test method for a storage link according to claim 5, wherein The querying the unreachable link records from the host to the storage cluster into the first structure and querying the unreachable link records from the storage cluster to the host into the second structure according to the current state includes: Obtain the first identifier of each host from the site information and record it in a third structure; Construct a fourth structure according to the first mapping relationship between the physical port and the virtual port, where the fourth structure includes the second identifier of the physical port and / or the third identifier of the virtual port; Scan the storage cluster by logging in to the host corresponding to the third structure, and add the scanned second identifier and / or third identifier to a first list; Match the first list with the fourth structure and record the unmatched results in the first structure; Log in to the storage cluster to query the first identifier of the connectable host and add it to a second list; Match the second list with the third structure and record the unmatched results in the second structure.
7. The test method for a storage link according to claim 6, wherein The method further includes: In response to the current state being the disabled state and the switch loading the first configuration, the fourth structure includes the second identifier of the physical port; Determine whether the returned output structure is empty; In response to the output structure not being empty, record the current count value of the loop counter and exit after collecting error logs; In response to the output structure being empty, log in to the storage cluster and set the port virtualization function of the controller group to the transition state.
8. The test method for a storage link according to claim 6 or 7, characterized in that, The configuring the switch partition matching the current state further includes: In response to the current state being the transition state, obtain the third identifier of the virtual port corresponding to the physical port and update the fourth structure based on the third identifier; Determine whether the current count value of the loop counter is greater than a preset value; In response to the current count value being greater than the preset value, load a preset second configuration and apply it to the switch; In response to the current count value being less than or equal to the preset value, partition the first identifier of the host and the third identifier corresponding to the virtual port into the same switch partition and save it as the second configuration.
9. The test method of the storage link according to claim 8, characterized in that, The switch partition configured to match the current state further includes: In response to the current state being a transition state and the switch loading the second configuration, the fourth structure includes a second identifier of the physical port and a third identifier of the virtual port; Determine whether the returned output structure is empty; In response to the output structure not being empty, record the current count value of the loop counter and exit after collecting error logs; In response to the output structure being empty, log in to the storage cluster to create a storage pool and a logical volume, and map the logical volume to the host; Determine whether the current count value of the loop counter is greater than a preset value; In response to the current count value being greater than the preset value, load a preset third configuration and apply it to the switch; In response to the current count value being less than or equal to the preset value, select a target host and a target physical port from the second configuration, and configure the mapping between the target host and the target physical port, and save it as the third configuration.
10. The test method for a storage link according to claim 9, characterized in that The method further includes: In response to the current state being a transition state and the switch loading the third configuration, issue input / output read / write instructions to the mapped logical volume through each host; In response to the target host normally issuing the input / output read / write instructions to the target physical port, log in to the storage cluster to change the port virtualization function of the one or more controller groups to the enabled state.
11. The test method for a storage link according to claim 10, wherein The switch partition configured to match the current state further includes: In response to the current state being an enabled state and the switch loading the third configuration, the fourth structure includes a second identifier of the physical port and a third identifier of the virtual port; Determine whether the returned output structure is empty; In response to the output structure being empty, record the current count value of the loop counter and exit after collecting error logs; In response to the output structure not being empty, determine whether a first identifier of the target host and a second identifier of the target physical port exist in the output structure; If not, record the current count value of the loop counter and exit after collecting error logs; If so, load the second configuration and apply it to the switch.
12. The test method for a storage link according to claim 10 or 11, characterized in that, The method further includes: In response to the current state being an enabled state and the switch loading the second configuration, issue input / output read / write instructions to the mapped logical volume through each host; In response to the target host normally issuing the input / output read / write instructions to the target virtual port, query the target controller node where the target virtual port is located; Inject a fault into the target controller node and restart the target controller node; In response to the input / output read / write instructions not being interrupted, use the target controller node as a standby node and obtain the returned output structure; In response to the third identifier of the target virtual port not existing in the output structure, wait for a preset time and then rejoin the target controller node to the storage cluster; Clear the mapping relationship between the host and the logical volume, and delete the third identifier of the virtual port in the fourth structure.
13. An electronic device, characterized in that, Includes: A memory for storing a computer program; A processor for implementing the steps of the test method of the storage link according to any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of the test method of the storage link according to any one of claims 1 to 12 when being executed by a processor.
15. A computer program product comprising a computer program, characterized in that, The computer program implements the steps of the test method of the storage link according to any one of claims 1 to 12 when being executed by a processor.
Citation Information
Patent Citations
Test method of port virtualization of multi-control storage system
CN107704354A
Data path virtualization
CN116368458A