Storage device access control method and device, storage medium and electronic device
By keeping the control link closed until the configuration information is synchronized when the storage device is connected to the storage cluster, the problem of the storage device being inactive and unable to respond to server requests is solved, and business continuity is improved.
Patent Information
- Application Number
- CN202510775879.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-11
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2045-06-11
AI Technical Summary
When accessing the storage cluster, the storage device is in an unready state due to the incomplete configuration synchronization, and cannot respond to server requests in time, resulting in low business continuity.
Detect the storage device to be accessed in the storage cluster, and control the link between the service port of the target storage device and the server during the access process, and then open the link until the configuration information is synchronized to ensure that the target storage device responds to the server request in the ready state.
Avoid server waiting timeout and business interruption due to incomplete configuration synchronization, and improves the business continuity of the storage system.
Smart Images

Figure CN120281808B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a method and apparatus for controlling access to a storage device, a storage medium, and an electronic device. Background Art
[0002] Fibre Channel (FC) technology, with its high performance and low latency, is widely used in host service access, as well as complex storage architectures such as multi-controller clusters and active-active disaster recovery, becoming the core interconnection technology for storage systems.
[0003] In related technologies, when a storage device node rejoins a storage cluster after recovering from a failure, whether it is carrying the host business access function or serving the FC port of the multi-controller interconnection within the storage cluster, the link initialization operation will be performed immediately. However, in high-load, IO-intensive scenarios, when a storage device node recovers from a failure, the host may send a business data request before the storage device node has completed the cluster configuration recovery. At this time, the storage device node is in an unready state and cannot respond to the host request in time, which can easily cause a volume scan timeout, leading to the loss of the host-side volume path. Especially in complex situations such as multiple storage node failures or system upgrades, it is more likely to cause abnormal interruptions in reading and writing, seriously affecting the reliability and business continuity of the storage system.
[0004] Regarding related technologies, when a storage device is connected to a storage cluster, it is in an unready state due to incomplete configuration synchronization, and is unable to respond to server requests in a timely manner, resulting in low business continuity and other technical problems. No effective solution has yet been proposed. Summary of the Invention
[0005] The embodiments of the present application provide a method and apparatus for access control of a storage device, a storage medium, and an electronic device, to at least resolve technical issues in related technologies, such as a storage device being in an unready state when accessing a storage cluster due to incomplete configuration synchronization, and being unable to respond to server requests in a timely manner, resulting in low business continuity.
[0006] According to one embodiment of the present application, a method for controlling access to a storage device is provided, comprising:
[0007] Detect whether there is a storage device to be connected to the storage cluster, wherein each storage device in the storage cluster is used to provide business data required for running the business to the server through the business port;
[0008] When it is detected that the target storage device is to be connected to the storage cluster, the link between the target service port of the target storage device and the server is controlled to remain closed, and during the process of performing the access operation on the target storage device, the synchronization status of the target storage device with the configuration information of the storage cluster is detected, wherein the configuration information is used to indicate the method in which the storage devices in the storage cluster provide service data to the server;
[0009] Control the link between the target service port and the server to open according to the synchronization status.
[0010] According to another embodiment of the present application, there is further provided an access control apparatus for a storage device, comprising:
[0011] A first detection module is used to detect whether there is a storage device to be connected to the storage cluster, wherein each storage device in the storage cluster is used to provide business data required for running the business to the server through the business port;
[0012] a first control module, configured to, upon detecting that a target storage device is to be connected to the storage cluster, control a link between a target service port of the target storage device and the server to remain closed, and, during a process of performing an access operation on the target storage device, detect a synchronization status of the target storage device with respect to configuration information of the storage cluster, wherein the configuration information is used to indicate a manner in which the storage devices in the storage cluster provide service data to the server;
[0013] The second control module is used to control the opening of the link between the target service port and the server according to the synchronization state.
[0014] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned methods for controlling access to a storage device when executing the computer program.
[0015] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned methods for controlling access to storage devices are implemented.
[0016] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned storage device access control methods when executed by a processor.
[0017] Through the present application, when a target storage device to be connected to a storage cluster is detected, the link between the target service port of the target storage device and the server is controlled to remain closed, and in the process of executing the access operation, the synchronization status of the target storage device for synchronizing the configuration information of the storage cluster is detected, and the link between the target service port and the server is controlled to be opened according to the synchronization status, that is, the opening of the link between the target service port and the server is controlled according to the synchronization status of the configuration information, ensuring that the target storage device completes the synchronization of the configuration information before opening the link. At this time, the target storage device can respond to the server's request normally, avoiding the situation in the related technology that the server sends a request when the target storage device has not completed the synchronization of the configuration information of the storage cluster, and the target storage device cannot respond in time, thereby causing the server to time out or even business interruption. Therefore, the technical problem in the related technology that the storage device is in an unready state when connected to the storage cluster due to incomplete configuration synchronization and cannot respond to the server request in time, resulting in low business continuity, can be solved, and the technical effect of ensuring that the target storage device processes server requests in a ready state, responds to server requests in time, and improves business continuity is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0019] Figure 1 This is a hardware structure block diagram of a computer device for a storage device access control method according to an embodiment of the present application;
[0020] Figure 2 is a flow chart of a method for controlling access to a storage device according to an embodiment of the present application;
[0021] Figure 3 is a structural diagram of a storage cluster according to an embodiment of the present application;
[0022] Figure 4 is a flow chart of port link initialization according to an embodiment of the present application;
[0023] Figure 5 is a flowchart of configuring cluster ports according to an embodiment of the present application;
[0024] Figure 6 is a flow chart of clearing cluster ports according to an embodiment of the present application;
[0025] Figure 7 is a flowchart of importing target port information according to an embodiment of the present application;
[0026] Figure 8 This is a flow chart of executing initialization port link enablement on a port of a target storage device according to an embodiment of the present application;
[0027] Figure 9 is a structural diagram of an access control system for a storage device according to an embodiment of the present application;
[0028] Figure 10 This is a structural block diagram of an access control device for a storage device according to an embodiment of the present application;
[0029] Figure 11 is a schematic diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0030] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0031] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0032] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0033] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 1 This is a hardware structure block diagram of a computer device for a storage device access control method according to an embodiment of the present application. Figure 1 As shown, the server device may include one or more ( Figure 1Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. The server device may also include a transmission device 106 and an input / output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0034] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the access control method for storage devices in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories may be connected to a server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0035] Transmission device 106 is used to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by a communication provider of the server device. In one embodiment, transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0036] The terms involved in the embodiments of this application are explained as follows:
[0037] Volume (also commonly known as Logical Unit Number (LUN)): A logical storage unit that abstracts physical storage resources (such as disks and solid-state drives) into manageable logical units for access by servers, hosts, or other storage devices.
[0038] In this embodiment, a method for controlling access to a storage device is provided. Figure 2is a flow chart of a method for controlling access to a storage device according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:
[0039] Step S12: Detect whether there is a storage device to be connected to the storage cluster, wherein each storage device in the storage cluster is used to provide service data required for running services to the server through a service port;
[0040] Step S14: When it is detected that the target storage device is to be connected to the storage cluster, the link between the target service port of the target storage device and the server is controlled to remain closed, and during the process of performing the access operation on the target storage device, the synchronization status of the target storage device with the configuration information of the storage cluster is detected, wherein the configuration information is used to indicate the manner in which the storage devices in the storage cluster provide service data to the server;
[0041] Step S16: Control the link between the target service port and the server to be opened according to the synchronization status.
[0042] Optionally, in this embodiment, Figure 3 is a structural diagram of a storage cluster according to an embodiment of the present application, such as Figure 3 As shown, a storage cluster can be, but is not limited to, a storage system that uses FC ports to establish multi-controller clusters, active-active disaster recovery, and other applications. Examples include a multi-controller interconnected storage device cluster and a storage architecture composed of inter-chassis FC links. A storage device can be, but is not limited to, any of the multiple storage nodes (storage nodes 1 through N) in the storage cluster that support the FC protocol. Each storage device has FC ports including an FC service port (port A) and an FC cluster port (port B). The FC service port is used for communication between the storage device and the server, providing service data required for server operations. The FC cluster port is used for communication between the storage device and other storage devices to perform master / slave controller election and synchronize configuration information (such as volume mappings, active-active disaster recovery policies, and LUN lists). Servers can be, but are not limited to, host devices that access the storage cluster via the FC protocol, such as FC hosts and application servers connected to the storage system.
[0043] Optionally, in this embodiment, the target storage device to be added to the storage cluster may include, but is not limited to: a storage device that has been re-added to the storage cluster due to a hardware failure, software anomaly, or active reboot; a storage device that has been added to an existing storage cluster for the first time; or a storage device that has been added to the storage cluster after completing a software upgrade. The target service port may be a FC service port that connects the target storage device to the server.
[0044] Optionally, in this embodiment, the step of detecting whether there is a storage device to be connected to the storage cluster may be, but is not limited to: identifying whether there is a storage node that is not connected to the storage cluster through the self-test process during power-on initialization of the storage controller; monitoring the heartbeat status through the storage cluster management module to detect whether there is a storage device back online and requesting to join the storage cluster.
[0045] Optionally, in this embodiment, when it is detected that the target storage device is to be connected to the storage cluster, the link between the target service port of the target storage device and the server is controlled to remain closed, and the server is not allowed to establish a connection with the target storage device.
[0046] Optionally, in this embodiment, the access operation may be, but is not limited to, operations that need to be performed when a storage device joins a storage cluster, such as port initialization and configuration information synchronization, to ensure that the storage device can securely and stably establish a business connection with the server.
[0047] Optionally, in this embodiment, the steps for detecting the synchronization status of the target storage device for synchronizing the configuration information of the storage cluster may be, but are not limited to: real-time monitoring of the volume online status through the protocol module, verifying whether the mapping relationship of all volumes in the target storage device is consistent with the global configuration of the cluster, which can directly reflect whether the target storage device is ready; in a complex cluster architecture (such as active-active disaster recovery), querying the data synchronization progress between the target storage device and the opposite storage device through the internal communication protocol to ensure that the target storage device will not cause business anomalies due to data lag after access; using the heartbeat monitoring mechanism of the storage cluster management module to count the communication status of the target storage device and other storage devices, verifying whether the internal communication of the storage cluster is stable, and indirectly verifying whether the collaborative working status between the storage devices is normal.
[0048] That is, the opening of the link is controlled according to the synchronization status of the configuration information, ensuring that the link is opened only after the target storage device completes the synchronization of the configuration information. At this time, the target storage device can normally respond to the server's request to obtain business data, avoiding the situation in related technologies where the server sends a request when the target storage device has not yet completed the synchronization of the storage cluster's configuration information, and the target storage device cannot respond in time, which in turn causes the server to time out or even business interruption. This achieves the technical effect of ensuring that the target storage device processes server requests in a ready state, responds to server requests in a timely manner, and improves business continuity, thereby solving the technical problem in related technologies that the storage device is in an unready state when connected to the storage cluster due to incomplete configuration synchronization, and cannot respond to server requests in time, resulting in low business continuity.
[0049] As an optional solution, you can control the link between the target service port of the target storage device and the server to remain closed. This includes:
[0050] S21, obtaining target port information of the target storage device from the target storage space corresponding to the target storage device, wherein the target port information records the port identifier of the target cluster port in the target storage device, and the target storage device is used to establish a link with each storage device in the storage cluster through the target cluster port;
[0051] S22, determining a port among the multiple ports of the target storage device that does not belong to the target cluster port indicated by the target port information as a target service port;
[0052] S23, setting the link enable flag of the target service port to the first state value, wherein the link enable flag is used to indicate whether the enable operation is allowed to be performed on the link of the corresponding port. The link enable flag in the first state value is used to indicate that the enable operation is prohibited on the link of the corresponding port. The enable operation is to start the corresponding link.
[0053] Optionally, in this embodiment, each storage device in the storage cluster has a corresponding storage space (node VPD). Each storage space stores port information for the corresponding storage device, and the port information records the port identifier used for the cluster port on the corresponding storage device. The step of obtaining target port information may include, but is not limited to, reading port attribute information from the target storage space corresponding to the target storage device via a driver module, parsing and extracting the port identifier of the target cluster port used for the cluster port on the target storage device.
[0054] Optionally, in this embodiment, after extracting the port identifier of the target cluster port used for the cluster port in the target storage device, the target service port used for the service port can be obtained by traversing all FC ports of the target storage device and automatically classifying the FC ports not included in the target port information as target service ports, that is, FC ports used for communication between the target storage device and the server.
[0055] Optionally, in this embodiment, a link enable flag is added to the data structure of the FC port. For the target service port, its link enable flag is configured as a first state value "FALSE", indicating that the link corresponding to the target service port is prohibited from being enabled.
[0056] Optionally, in this embodiment, Figure 4 This is a flow chart of port link initialization according to an embodiment of the present application, such as Figure 4 As shown in the figure, the steps of port link initialization include:
[0057] Step S401: The driver module periodically (e.g., every 60 seconds) polls the port status and then executes step S402.
[0058] Step S402, detecting whether the port is active, if the port is detected to be active, executing step S409; if the port is detected to be inactive, executing step S403;
[0059] Step S403: Read the static data SFP PAGE A0 of the optical module of the port to verify whether the optical module rate matches the Fibre Channel (FC card) rate. If the optical module rate does not match the FC card rate, execute step S409; if the optical module rate matches the FC card rate, execute step S404.
[0060] Step S404, determining the link enable flag of the port. If the link enable flag is configured as "TRUE", executing step S405; if the link enable flag is configured as "FALSE", executing step S408;
[0061] Step S405: If the module validity is successfully determined, the port link initialization action is executed, the optical module is triggered to emit light, and it is determined whether the cable is connected. If the cable is connected, step S406 is executed; if the cable is not connected, step S407 is executed.
[0062] In step S406, the FC card firmware FW reports a "Link Up message" (connection successful), the port becomes active, and the port link is successfully opened, and step S409 is executed;
[0063] Step S407: If the port is in an inactive state, execute step S403;
[0064] Step S408: If the module validity is determined to be a failure, the port link initialization action is terminated, the link is maintained in a closed state, and step S409 is executed;
[0065] Step S409, end the process.
[0066] As an optional solution, before obtaining the target port information of the target storage device from the target storage space corresponding to the target storage device, the method further includes:
[0067] S31, receiving a port configuration instruction carrying a reference port identifier and cluster port parameters, wherein the port configuration instruction is used to instruct to configure the port with the reference port identifier as a cluster port indicated by the cluster port parameters;
[0068] S32, responding to the port configuration instruction, checking whether the multiple ports of the target storage device include a port with a port identifier;
[0069] S33, when it is verified that the reference port in the target storage device is a port having a reference port identifier, adding the correspondence between the port position parameter of the reference port and the reference port identifier to the initial port information of the target storage device to obtain target port information, and storing the target port information in a target storage space corresponding to the target storage device;
[0070] S34: Synchronize the target port information in the target storage space to the target cluster space corresponding to the storage cluster, wherein the target cluster space is used to record the port identifier of the cluster port in each storage device included in the storage cluster.
[0071] Optionally, in this embodiment, before obtaining the target port information of the target storage device from the target storage space corresponding to the target storage device, the target port information is also generated and stored, including: configuring the cluster port that is preferentially used for cluster interconnection through the port configuration instruction (chnodeportfc), and configuring a maximum of four cluster ports for a single storage device (to avoid over-configuration of cluster ports). After the cluster port is successfully configured, the slot number and port number of the cluster port are assembled according to the port information storage format (such as a specific structure) to obtain the target port information. The target port information is then recorded in the target storage space and the target cluster space (backplane VPD) to ensure that the port configuration can be quickly restored in the event of a system restart (relying on node VPD to restore configuration) or a backplane replacement (relying on backplane VPD synchronization configuration), thereby shortening system recovery time, improving system fault recovery capabilities and availability, and reducing the impact on business continuity.
[0072] Optionally, in this embodiment, Figure 5 This is a flow chart of configuring cluster ports according to an embodiment of the present application. Figure 5 As shown in the figure, the steps to configure cluster ports (that is, to set port priority) include:
[0073] Step S501, receiving a port configuration instruction (chnodeportfc). The port configuration instruction carries a reference port identifier (port_id) and a cluster port parameter (cluster_priority=yes), and then executes step S502. The reference port identifier (port_id) represents the unique identifier of the FC port; the cluster port parameter (cluster_priority=yes) indicates that the FC port is used as a cluster port. The port configuration instruction is used to instruct the port with port_id to be configured as a cluster port indicated by cluster_priority=yes. For example, inputting the instruction "port_id=3, cluster_priority=yes" means "set port number 3 as a cluster port";
[0074] Step S502: Determine whether the parameters are valid. Check whether the port_id is valid (for example, whether there is a port with the port identifier "3"), whether the cluster_priority field is configured, and whether the total number of configured ports exceeds 4. If the port_id is valid, the cluster_priority field is configured, and the total number of configured ports does not exceed 4, proceed to step S503; otherwise, terminate the process.
[0075] Step S503: Determine whether the reference port identifier port_id exists in the target storage space. Traverse the port information of multiple cluster ports in the target storage space corresponding to the target storage device. If a port matching the reference port identifier is found, execute step S504; if no port matching the reference port identifier is found, execute step S505.
[0076] Step S504 , saving the port location parameter (slot number) and port number of the reference port corresponding to the reference port identifier to the memory location corresponding to the target storage space location, and executing step S506 ;
[0077] Step S505, saving the slot number and port number of the reference port corresponding to the reference port identifier to an idle memory location, and executing step S506;
[0078] Step S506: Assemble the slot number and port number in the memory location according to the port information storage format to obtain the target port information, write it into the location corresponding to the reference port identifier in the target storage space, and execute step S507;
[0079] Step S507: synchronously write the target port information into the corresponding position of the target cluster space, and end the process.
[0080] Optionally, in this embodiment, Figure 6 This is a flow chart of clearing cluster ports according to an embodiment of the present application. Figure 6 As shown in the figure, the steps to clear a cluster port (that is, clear the port priority) include:
[0081] Step S601: Receive a port clear instruction (chnodeportfc). The port clear instruction carries a candidate port identifier (port_id) and a non-cluster port parameter (cluster_priority=no), and then executes step S602. The candidate port identifier (port_id) represents the unique identifier of the FC port; the non-cluster port parameter (cluster_priority=no) represents the FC port as a non-cluster port. The port clear instruction is used to instruct the port with port_id to be configured as a non-cluster port indicated by cluster_priority=no. For example, inputting the instruction "port_id=3, cluster_priority=no" means "set port number 3 as a non-cluster port."
[0082] Step S602: Determine whether the parameters are valid. Check whether the port_id is valid (for example, whether there is a port with the port identifier "3") and whether the cluster_priority field has been configured. If the port_id is valid and the cluster_priority field has been configured, execute step S603; otherwise, terminate the process.
[0083] Step S603: Search the target storage space for the port corresponding to the candidate port identifier port_id. Traverse the port information of multiple cluster ports in the target storage space (node VPD) corresponding to the target storage device, find the port that matches the candidate port identifier, and execute step S604.
[0084] Step S604, clearing the candidate port identifier, slot number, and port number in the memory location corresponding to the candidate port identifier in the target storage space, and executing step S605;
[0085] Step S605, clear the candidate port identifier, slot number and port number in the corresponding position in the target storage space, and execute step S606;
[0086] Step S606: Clear the candidate port identifiers, slot numbers, and port numbers in the corresponding positions in the target cluster space, and end the process.
[0087] Optionally, in this embodiment, 4 fields are allocated to each storage device in the target cluster space for storing cluster ports that are preferentially used for cluster interconnection, and the fields record the slot number and port number of the cluster port. During system initialization, the target cluster space will be read to detect whether there is valid port information that is preferentially used for cluster ports that has been saved in the target cluster space. If there is valid port information in the target cluster space, the valid port information needs to be saved in the target storage space. Among them, if the port information that is preferentially used for cluster ports that is saved in the target cluster space includes the FC port of the target storage device, then the port information is considered valid. The method for detecting whether there is valid port information in the target cluster space may include, but is not limited to: querying all FC ports of the target storage device through the query instruction lsnodeportfc. If the slot number and port number of a certain FC port of the target storage device are recorded in the target cluster space, then the port information is considered valid, and the port is the port that is preferentially used for cluster ports.
[0088] Optionally, in this embodiment, before obtaining the target port information of the target storage device from the target storage space corresponding to the target storage device, the method further includes importing the target port information. Figure 7 This is a flow chart of importing target port information according to an embodiment of the present application, such as Figure 7 As shown in the figure, the steps to import target port information include:
[0089] Step S701, determining whether the backplane is normal. If the backplane is normal, executing step S702; if the backplane is abnormal, executing step S704;
[0090] Step S702 , read the port data in the backplane VPD (target cluster space), parse it according to the port information storage format, match a valid port identifier from the FC port of the target storage device, and execute step S703 ;
[0091] Step S703, temporarily save the port data such as the slot number, port number, and port identifier into the memory, and execute step S706;
[0092] Step S704: read the port data in the node VPD (the target storage space corresponding to the target storage device), parse it according to the port information storage format, match a valid port identifier from the FC port of the target storage device, and execute step S705;
[0093] Step S705: temporarily save the port data such as the slot number, port number, and port identifier into the memory, and the process ends.
[0094] Step S706: Check whether the backplane has been replaced by checking whether the backplane data mtm (Manufacturing Test Mode) is 0. If mtm is 0, indicating that the current backplane is newly replaced and does not have the original factory configuration data, then execute step S707. If mtm is not 0, indicating that the current backplane is the original backplane when the device was shipped from the factory and the data is the original configuration, then execute step S709.
[0095] Step S707: Read the port data in the target storage space, such as the target cluster port of the old backplane, parse it according to the port information storage format, match a valid port identifier from the FC port of the target storage device, temporarily save the port data such as the slot number, port number, and port identifier to the memory, and execute step S708;
[0096] Step S708: write the port data such as the slot number, port number, and port identifier back to the target cluster space, and the process ends.
[0097] Step S709: write the port data temporarily stored in the memory into the target storage space to ensure that the information of the two is consistent, and the process ends.
[0098] As an optional solution, after obtaining the target port information of the target storage device from the target storage space corresponding to the target storage device, the method further includes:
[0099] S41, determining a target cluster port from multiple ports of a target storage device according to target port information;
[0100] S42: Set the link enable flag of the target cluster port to a second state value, wherein the link enable flag in the second state value is used to indicate that an enable operation is allowed to be performed on the link of the corresponding port, and the enable operation is an operation of opening the corresponding link.
[0101] Optionally, in this embodiment, after obtaining the target port information of the target storage device from the target storage space, a port identifier for the cluster port is obtained. Based on the port identifier, a target cluster port is determined from the multiple ports of the target storage device, and then the link enable flag of the target cluster port is configured to a second state value of "TRUE", indicating that the link corresponding to the target cluster port is allowed to be enabled.
[0102] Optionally, in this embodiment, Figure 8 FIG. 1 is a flow chart of executing initialization port link enabling of a port of a target storage device according to an embodiment of the present application, such as FIG. Figure 8As shown, the target storage device's ports can perform initial port link enablement in the following manner, but is not limited to: After obtaining the target storage device's target port information from the target storage space, the driver module obtains the port identifier for the cluster port (configuring its port link enable to "TRUE") and the port identifier for the service port (configuring its port link enable to "FALSE"). It then traverses all FC ports on the target storage device and performs link initialization and port enablement for the FC ports used for cluster ports. For the FC ports used as service ports, port enablement is delayed until the protocol module confirms that the target storage device configuration information has been synchronized and enables these ports, or until the waiting time expires and the ports are automatically enabled.
[0103] Optionally, in this embodiment, the protocol module enables these ports after confirming that the target storage device configuration information is synchronized or automatically enables them after a timeout, including the following: after confirming that the target storage device configuration information is synchronized, the protocol module calls the port enable interface, traverses all FC ports, and if the port link enable flag is "FALSE", it means that the FC port is used as a service port. At this time, the target storage device configuration information is synchronized, allowing the link corresponding to the service port to be enabled, triggering link enablement, checking the validity of the optical module corresponding to the service port, triggering the optical module to illuminate and activate the link corresponding to the service port, and modifying the port link enable flag to TRUE. If the protocol module has not called the port enable interface to enable the link, the driver module will actively enable the link after the link automatic enable times out (for example, exceeding the threshold of 5 minutes).
[0104] As an optional solution, detecting the synchronization status of the target storage device with the configuration information of the storage cluster further includes:
[0105] S51, detecting the synchronization progress of the target storage device with respect to the volume mapping information, volume attribute information, volume port information, and volume backup information of the storage cluster, wherein the volume mapping information is used to indicate the access mapping relationship between the storage volumes in the storage cluster and the servers, the volume attribute information is used to indicate the attribute parameters of the storage volumes in the storage cluster, the volume port information is used to indicate the ports allowed to be used when the storage volumes in the storage cluster provide business data to the servers, and the volume backup information is used to indicate the manner in which the corresponding backup storage volume takes over when a storage volume in the storage cluster fails. The configuration information includes the volume mapping information, volume attribute information, volume port information, and volume backup information;
[0106] S52, when the synchronization progress is equal to or greater than the target progress threshold, determining the synchronization state as a synchronization completed state, wherein when the synchronization progress is equal to or greater than the target progress threshold, the target storage device allows providing the server with the service data required for running the service;
[0107] S53: When the synchronization progress is less than the target progress threshold, the synchronization state is determined as being in the synchronization state.
[0108] Optionally, in this embodiment, the configuration information of the target storage device synchronization storage cluster may include, but is not limited to: volume mapping information, which is used to indicate the corresponding storage volumes and server information that can access the storage volumes, such as the mapping relationship between storage volume LUN 0 and server A (FC ID = 0x1234) and server B (FC ID = 0x5678), to ensure that the server can address and access the specified volume through the FC protocol; volume attribute information, which is used to indicate the capacity limit and access rights of the storage volume, such as the maximum available space of the volume (such as 10TB), read and write permissions (read-only or read and write), and encryption status; volume port information, which is used to indicate the FC port for the storage volume to perform host services, such as the specified volume LUN 0 provides external services only through FC port 3 (port_id=3) of the storage device, isolating services from cluster interconnection ports (such as ports 1 and 2). Volume backup information, namely the active-active relationship of volumes, indicates how the backup volume takes over services when the primary storage volume fails. For example, the replication link status (synchronous or asynchronous) between the primary and backup volumes, the failover policy (automatic or manual), and the consistency group configuration are provided.
[0109] Optionally, in this embodiment, the methods for detecting the synchronization progress of the target storage device with respect to the storage cluster's volume mapping information, volume attribute information, volume port information, and volume backup information may include, but are not limited to, the following: viewing the synchronization progress through the storage cluster management interface, for example, accessing the storage device node management or cluster status page to view the synchronization progress bar, synchronization status label, and synchronization status of specific configuration items of the newly added storage device; querying the synchronization status through a command line tool, such as using the gluster volume info command of the Gluster CLI to obtain storage device configuration and volume synchronization information; analyzing the synchronization process through log files, for example, viewing the logs of the storage device management and searching for keywords to locate the configuration information transmission status. This allows for detecting the synchronization progress through multiple methods, allowing for real-time monitoring of the target storage device's synchronization status with respect to volume mapping, attribute, port, backup, and other information, ensuring data and configuration integrity and consistency when connected to the production environment, and avoiding business anomalies caused by information asynchrony.
[0110] Optionally, in this embodiment, the synchronization progress can be displayed in, but is not limited to, numerical percentages and status labels. The numerical percentage can accurately indicate the percentage of configuration items that have completed synchronization, such as 85% completion of volume mapping information synchronization and 92% completion of volume attribute information synchronization. The status label can be automatically marked as "Not Synchronized" (0%), "Synchronizing" (0%-99%), or "Synchronized" (100%) based on the degree of synchronization completion. When the synchronization progress exceeds a preset target progress threshold, the synchronization status is determined to be complete. At this point, the target storage device is allowed to officially connect to the production environment and provide complete business data to the server. When the synchronization progress is less than or equal to the threshold, the synchronization status is determined to be synchronizing. At this point, the storage device can only perform internal synchronization operations and cannot respond to server business requests. For example, if the target progress threshold is set to 99%, when the synchronization progress reaches 100%, the storage device immediately switches to the "Synchronized" state and can officially provide services. When the synchronization progress reaches 80%, the storage device remains in the "Synchronizing" state and must wait for the synchronization to complete before it can be connected to the production environment. By displaying the synchronization progress with numerical percentages and status labels, and setting target progress thresholds to determine the synchronization status, when the threshold is not reached, the storage device only performs internal synchronization and does not respond to business requests. This prevents business interruptions and data read and write anomalies caused by unready response requests, thereby improving the stability of the storage system and business.
[0111] Optionally, in this embodiment, the target progress threshold can be adjusted according to business needs and can be set to 100% in scenarios with extremely high data consistency requirements.
[0112] As an optional solution, the link between the target service port and the server is controlled based on the synchronization status, including:
[0113] S61, when the synchronization state is the synchronizing state, continue to control the link between the target service port of the target storage device and the server to remain closed, wherein the synchronizing state is used to indicate that the target storage device has not completed synchronization of the configuration information of the storage cluster;
[0114] S62, when the synchronization state is the synchronization completion state, controlling the link between the target service port and the server to switch from closed to open, wherein the synchronization completion state is used to indicate that the target storage device has completed synchronization of the configuration information of the storage cluster.
[0115] Optionally, in this embodiment, the link between the target service port and the server can be controlled to be open according to the synchronization status in the following manner, but is not limited to: when the synchronization status is the synchronizing status, the link between the target service port of the target storage device and the server continues to be controlled to remain closed, that is, the current target storage device has not completed the synchronization of the configuration information of the storage cluster and can only perform internal synchronization operations, cannot respond to the service request of the server, and is not allowed to open the link between the target service port and the server. When the synchronization status is the synchronization completed status, the link between the target service port and the server is controlled to switch from closed to open, that is, the current target storage device has completed the synchronization of the configuration information of the storage cluster and can provide complete service data to the server, and is allowed to open the link between the target service port and the server.
[0116] Optionally, in this embodiment, the method for controlling the link between the target service port and the server to switch from closed to open can be: after confirming that the target storage device has completed the synchronization of the configuration information of the storage cluster, the protocol module notifies the driver module to start the target service port, and when the driver module detects that the optical module rate of the target service port is successfully matched and the cable is connected, it triggers the optical module to emit light to enable the corresponding link of the target service port, and starts the link between the target storage device and the server.
[0117] As an optional solution, after controlling the link between the target service port and the server to be switched from closed to open, the method further includes:
[0118] S71, detecting the current instruction execution state of the target storage device, wherein the instruction execution state is used to indicate whether the target storage device currently allows execution of the read and write instructions sent by the server;
[0119] S72, if the instruction execution status indicates that the target storage device currently does not allow execution of the read / write instruction sent by the server, and a volume scan instruction is received, adding the volume scan instruction to a waiting queue and starting a timer, wherein the volume scan instruction is an instruction sent by the server to request a scan of the storage volumes of the target storage device;
[0120] S73, when the timing time reaches the preset time, detecting the current instruction execution status of the target storage device again;
[0121] S74, if the instruction execution status still indicates that the target storage device currently does not allow execution of the read or write instruction sent by the server, sending a retry instruction to the server, wherein the server is configured to resend the scan volume instruction to the target storage device upon receiving the retry instruction;
[0122] S75 , when the instruction execution status indicates that the target storage device currently allows the execution of the read and write instructions sent by the server, execute the volume scan instructions in the waiting queue.
[0123] Optionally, in this embodiment, if the target storage device's storage volumes and server configuration information have not yet been fully restored, but the server has received a REPORT LUN command (opcode 0x40) sent via the SCSI protocol to the target storage device to query the list of available storage volumes (i.e., a disk scan), the command is not immediately processed. Instead, the volume scan command is added to the waiting queue (Startup_queue). Simultaneously, a timer is started in the fiber queue to monitor the processing status of the volume scan commands in the waiting queue. A volume scan command is a command sent by the server requesting a scan of the target storage device's storage volumes. A timer timeout threshold (preset duration) is set: 10 seconds. If the volume scan command remains unprocessed in the waiting queue for more than 10 seconds, the system returns a retry command (KCQ: 062900) to the server, indicating a "device power-on reset." Upon receiving the retry command, the server automatically retries to send the volume scan command. Each time the server retries to send the volume scan command, the timer is reset, thereby extending the overall disk scan process. For example, the default server timeout is 30 seconds. By retrying three times, the scan time can be extended to 90 seconds, giving the target storage device more time to recover its configuration. Once the target storage device completes configuration synchronization (for example, when a storage volume is online), the protocol module responds to the scan command normally and returns the correct storage volume list. The server completes the scan and establishes a connection with the target storage device, successfully restoring the path.
[0124] Optionally, in this embodiment, upon completion of the restoration of the storage volumes and server configuration information on the target storage device, a check is first performed to determine whether all restored storage volumes are online (i.e., in an "online" state and available for service). If all restored storage volumes are found to be online, all commands temporarily stored in the Startup_queue (including volume scan commands) are immediately processed, and the timer is exited, discontinuing any further commands in the Startup_queue. Specifically, once the storage volumes and server configurations on the target storage device are complete and the storage volumes are ready, the temporarily stored commands are quickly released, and normal service is restored.
[0125] Optionally, in this embodiment, when the storage volumes and server configuration information on the target storage device are restored, if any offline storage volumes are detected, a timer is started on the current fiber queue to monitor whether all offline storage volumes have been brought online (triggered by polling or status callbacks) and whether the timer has reached a timeout threshold of 60 seconds. The timer ends when all offline storage volumes have been brought online and / or the timer has reached a timeout threshold of 60 seconds. If the timer ends due to the online availability of all storage volumes, the instructions in the Startup_queue are processed and the service link corresponding to the target service port is opened. If the timer ends due to a timeout (some storage volumes are still offline), the instructions in the waiting queue are forcibly processed and the service link corresponding to the target service port is opened (this may pose a data risk, but avoids indefinite blocking). In other words, setting a reasonable timeout threshold achieves a balance between consistency (waiting for storage volumes to come online) and availability (avoiding excessive blocking).
[0126] Optionally, in this embodiment, while controlling the link between the target service port of the target storage device and the server to remain closed, the server cannot send a volume scan instruction to the target storage device, there is no instruction in the waiting queue Startup_queue, and the timer will not start.
[0127] Optionally, in this embodiment, Figure 9 is a structural diagram of an access control system for a storage device according to an embodiment of the present application, such as Figure 9 As shown, the access control system of the storage device includes a chassis management module (pl_control), a driver module, a protocol module, a target storage space, and a target cluster space.
[0128] The chassis management module is used to configure and store FC port attributes and synchronize port information in the target storage space (node VPD) and the target cluster space (backplane VPD). The backplane VPD is used to store the slot number and port number of the port used for the cluster port (up to 4 per node to avoid over-allocation), and the node VPD is used to store the local storage port configuration of the target storage device for reading by the FC driver module.
[0129] The driver module, namely the FC driver module, is used to manage the initialization of all FC port links of the target storage device and distinguish between cluster ports and service ports. When the storage system is initialized and started, the FC driver reads the port information in the target storage space and the target cluster space to confirm whether the FC port of the current target storage device is used as a cluster port. If the port is configured for a cluster port, the link will be enabled immediately if the optical module is normal, that is, the corresponding link will be turned on. If the port is not configured for a cluster port, it will wait for the protocol module to send a link enable command or wait for the maximum threshold (for example, 5 minutes) before enabling the link if the optical module is normal, thereby achieving the effect of delaying port startup and preventing premature connection with the server, which may cause volume scan timeouts, volume path abnormalities, and IO read and write abnormalities.
[0130] The protocol module is used to coordinate the recovery of the storage cluster configuration and process server retry requests. It can send a link enable instruction to the driver module to control link opening based on the link enable flag of the port and the synchronization status of the storage device in synchronizing the configuration information. Specifically, before the storage device completes synchronization of the configuration information, the link enable command is issued to notify the driver module to open the link corresponding to the port with the link enable flag set to "TRUE". After the storage device completes synchronization of the configuration information, the link enable command is issued to notify the driver module to open the link corresponding to the port with the link enable flag set to "FALSE".
[0131] Optionally, in this embodiment, by configuring the FC port attributes, the service port and the cluster port are distinguished, wherein the cluster port is started immediately when the storage node is connected to the storage cluster, and the service port is started with a delay; a protocol module retry mechanism is introduced, and when the protocol module detects that all volume lists of the storage device that is performing the access operation have not been completed and are online, a retry instruction is fed back to the server's volume scan request to extend the volume scan process, ensuring that the service link corresponding to the service port is enabled after the storage volume is online or after the processing time threshold is reached. This avoids the problem that when the storage node is connected to the storage cluster, the server sends a volume scan request too early, and the storage device cannot respond within the specified time due to not being ready, resulting in the volume scan instruction waiting timeout, causing the volume path to be lost, and IO reading and writing to be abnormally interrupted. That is, it is ensured that the link corresponding to the service port is opened after the storage device is fully ready to process the volume scan instruction, and the retry mechanism is used to avoid the server giving up the request due to waiting timeout, thereby improving the reliability and business continuity of the storage system.
[0132] 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 the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0133] Based on this understanding, the technical solution of this application or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, disk, CD-ROM), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of this application.
[0134] This embodiment also provides a storage device access control device, which is used to implement the above-mentioned embodiments and preferred implementations. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0135] Figure 10 is a structural block diagram of an access control device for a storage device according to an embodiment of the present application; Figure 10 As shown, including:
[0136] A first detection module 1002 is configured to detect whether there is a storage device to be connected to the storage cluster, wherein each storage device in the storage cluster is configured to provide service data required for running services to the server through a service port;
[0137] The first control module 1004 is configured to, upon detecting that the target storage device is to be connected to the storage cluster, control the link between the target service port of the target storage device and the server to remain closed, and, during the process of performing the access operation on the target storage device, detect the synchronization status of the target storage device with the configuration information of the storage cluster, wherein the configuration information is used to indicate how the storage devices in the storage cluster provide service data to the server;
[0138] The second control module 1008 is configured to control the opening of a link between the target service port and the server according to the synchronization status.
[0139] In an exemplary embodiment, the first control module includes:
[0140] an acquiring unit, configured to acquire target port information of a target storage device from a target storage space corresponding to the target storage device, wherein the target port information records a port identifier of a target cluster port in the target storage device, and the target storage device is configured to establish a link with each storage device in the storage cluster through the target cluster port;
[0141] A first determining unit is configured to determine, among the multiple ports of the target storage device, a port that does not belong to the target cluster port indicated by the target port information as a target service port;
[0142] A setting unit is used to set the link enable flag of the target service port to a first state value, wherein the link enable flag is used to indicate whether an enable operation is allowed on the link of the corresponding port, and the link enable flag in the first state value is used to indicate that the enable operation on the link of the corresponding port is prohibited, and the enable operation is an operation to turn on the corresponding link.
[0143] In an exemplary embodiment, the apparatus further comprises:
[0144] a receiving module configured to receive a port configuration instruction carrying a reference port identifier and cluster port parameters before obtaining target port information of the target storage device from the target storage space corresponding to the target storage device, wherein the port configuration instruction is used to instruct the port with the reference port identifier to be configured as the cluster port indicated by the cluster port parameters;
[0145] A response module, configured to respond to the port configuration instruction and verify whether the multiple ports of the target storage device include a port with a port identifier;
[0146] an adding module for, upon verifying that the reference port in the target storage device is a port with a reference port identifier, adding a correspondence between the port position parameter of the reference port and the reference port identifier to the initial port information of the target storage device to obtain target port information, and storing the target port information in a target storage space corresponding to the target storage device;
[0147] The synchronization module is used to synchronize the target port information in the target storage space to the target cluster space corresponding to the storage cluster, wherein the target cluster space is used to record the port identifier of the cluster port in each storage device included in the storage cluster.
[0148] In an exemplary embodiment, the apparatus further comprises:
[0149] a determination module, configured to, after acquiring target port information of a target storage device from a target storage space corresponding to the target storage device, determine a target cluster port from a plurality of ports of the target storage device according to the target port information;
[0150] The setting module is used to set the link enable flag of the target cluster port to a second state value, wherein the link enable flag in the second state value is used to indicate that an enable operation is allowed for the link of the corresponding port, and the enable operation is an operation of opening the corresponding link.
[0151] In an exemplary embodiment, the first control module includes:
[0152] a detection unit, configured to detect the synchronization progress of the target storage device with respect to the volume mapping information, volume attribute information, volume port information, and volume backup information of the storage cluster, wherein the volume mapping information is used to indicate the access mapping relationship between the storage volumes in the storage cluster and the servers, the volume attribute information is used to indicate the attribute parameters of the storage volumes in the storage cluster, the volume port information is used to indicate the ports allowed to be used when the storage volumes in the storage cluster provide business data to the servers, and the volume backup information is used to indicate the manner in which the corresponding backup storage volume takes over when a storage volume in the storage cluster fails. The configuration information includes the volume mapping information, volume attribute information, volume port information, and volume backup information;
[0153] a second determining unit, configured to determine the synchronization state as a synchronization completion state when the synchronization progress is equal to or greater than a target progress threshold, wherein when the synchronization progress is equal to or greater than the target progress threshold, the target storage device is allowed to provide the server with service data required for running the service;
[0154] The third determining unit is configured to determine the synchronization state as a synchronizing state when the synchronization progress is less than a target progress threshold.
[0155] In an exemplary embodiment, the second control module includes:
[0156] A first control unit is configured to, when the synchronization state is a synchronizing state, continue to control the link between the target service port of the target storage device and the server to remain closed, wherein the synchronizing state is used to indicate that the target storage device has not completed synchronization of configuration information of the storage cluster;
[0157] The second control unit is used to control the link between the target service port and the server to switch from closed to open when the synchronization state is the synchronization completion state, wherein the synchronization completion state is used to indicate that the target storage device has completed the synchronization of the configuration information of the storage cluster.
[0158] In an exemplary embodiment, the apparatus further comprises:
[0159] A second detection module is configured to detect a current instruction execution state of the target storage device after controlling the link between the target service port and the server to be switched from closed to open, wherein the instruction execution state is used to indicate whether the target storage device currently allows execution of a read or write instruction sent by the server;
[0160] An adding module is configured to add a volume scan instruction to a waiting queue and start a timer when the instruction execution state indicates that the target storage device is not currently allowed to execute the read and write instructions sent by the server and a volume scan instruction is received, wherein the volume scan instruction is an instruction sent by the server to request a storage volume of the target storage device to be scanned;
[0161] A third detection module is used to detect the current instruction execution status of the target storage device again when the timing time reaches a preset time;
[0162] a sending module, configured to send a retry instruction to the server if the instruction execution state still indicates that the target storage device currently does not allow the execution of the read and write instructions sent by the server, wherein the server is configured to resend the scan volume instruction to the target storage device if the retry instruction is received;
[0163] The execution module is used to execute the volume scan instruction in the waiting queue when the instruction execution state is used to indicate that the target storage device currently allows the execution of the read and write instructions sent by the server.
[0164] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0165] For descriptions of features in the embodiments corresponding to the access control apparatus for storage devices, reference may be made to the descriptions of the embodiments corresponding to the access control method for storage devices, which will not be detailed here.
[0166] An embodiment of the present application further provides an electronic device, Figure 11 is a schematic diagram of an electronic device according to an embodiment of the present application, such as Figure 11 As shown, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned storage device access control method embodiments.
[0167] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0168] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0169] 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 of any of the above-mentioned storage device access control method embodiments when running.
[0170] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0171] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0172] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in each embodiment of the present application; the computer program product also includes a non-volatile computer-readable storage medium, which stores the computer program, which, when executed by a processor, implements the steps of the access control method for the storage device described in each embodiment of the present application.
[0173] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0174] The above is a detailed introduction to a storage device access control method provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core ideas of the present application. It should be noted that, for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A method for controlling access to a storage device, characterized in that: include: Detecting whether there is a storage device to be connected to the storage cluster, wherein each storage device in the storage cluster is used to provide business data required for running the business to the server through the business port; When it is detected that a target storage device is about to be connected to the storage cluster, controlling the link between the target service port of the target storage device and the server to remain closed, and during the process of performing an access operation on the target storage device, detecting a synchronization status of the target storage device synchronizing configuration information of the storage cluster, wherein the configuration information is used to indicate a manner in which the storage devices in the storage cluster provide service data to the server; Controlling the link between the target service port and the server to be opened according to the synchronization state; Wherein, the control of keeping the link between the target service port of the target storage device and the server closed includes: obtaining the target port information of the target storage device from the target storage space corresponding to the target storage device, wherein the target port information records the port identifier of the target cluster port in the target storage device, and the target storage device is used to establish a link with each of the storage devices in the storage cluster through the target cluster port; determining the port that does not belong to the target cluster port indicated by the target port information among the multiple ports of the target storage device as the target service port; setting the link enable identifier of the target service port to a first state value, wherein the link enable identifier is used to indicate whether the enable operation is allowed to be performed on the link of the corresponding port, and the link enable identifier in the first state value is used to indicate that the enable operation is prohibited on the link of the corresponding port, and the enable operation is an operation to turn on the corresponding link.
2. The method according to claim 1, characterized in that Before acquiring the target port information of the target storage device from the target storage space corresponding to the target storage device, the method further includes: receiving a port configuration instruction carrying a reference port identifier and cluster port parameters, wherein the port configuration instruction is used to instruct to configure a port having the reference port identifier as a cluster port indicated by the cluster port parameters; In response to the port configuration instruction, verifying whether the multiple ports of the target storage device include a port having the port identifier; When it is verified that the reference port in the target storage device is a port having the reference port identifier, adding the correspondence between the port position parameter of the reference port and the reference port identifier to the initial port information of the target storage device to obtain the target port information, and storing the target port information in the target storage space corresponding to the target storage device; The target port information in the target storage space is synchronized to a target cluster space corresponding to the storage cluster, wherein the target cluster space is used to record the port identifier of the cluster port in each of the storage devices included in the storage cluster.
3. The method according to claim 1, characterized in that After acquiring the target port information of the target storage device from the target storage space corresponding to the target storage device, the method further includes: Determine the target cluster port from multiple ports of the target storage device according to the target port information; The link enable flag of the target cluster port is set to a second state value, wherein the link enable flag in the second state value is used to indicate that the enabling operation is allowed to be performed on the link of the corresponding port, and the enabling operation is an operation of opening the corresponding link.
4. The method according to claim 1, wherein The detecting a synchronization status of the target storage device synchronizing the configuration information of the storage cluster includes: Detecting the synchronization progress of the target storage device on the volume mapping information, volume attribute information, volume port information and volume backup information of the storage cluster, wherein the volume mapping information is used to indicate the access mapping relationship between the storage volumes in the storage cluster and the server, the volume attribute information is used to indicate the attribute parameters of the storage volumes in the storage cluster, the volume port information is used to indicate the ports allowed to be used when the storage volumes in the storage cluster provide the business data to the server, and the volume backup information is used to indicate the manner in which the corresponding backup storage volume takes over when a storage volume in the storage cluster fails. The configuration information includes the volume mapping information, the volume attribute information, the volume port information and the volume backup information; When the synchronization progress is equal to or greater than a target progress threshold, determining the synchronization state as a synchronization completion state, wherein when the synchronization progress is equal to or greater than the target progress threshold, the target storage device allows providing the server with service data required for running a service; When the synchronization progress is less than the target progress threshold, the synchronization state is determined to be a synchronizing state.
5. The method according to claim 1, wherein The controlling the opening of a link between the target service port and the server according to the synchronization state includes: When the synchronization state is a synchronizing state, continue to control the link between the target service port of the target storage device and the server to remain closed, wherein the synchronizing state is used to indicate that the target storage device has not completed synchronization of the configuration information of the storage cluster; When the synchronization state is a synchronization completion state, the link between the target service port and the server is controlled to switch from closed to open, wherein the synchronization completion state is used to indicate that the target storage device has completed synchronization of the configuration information of the storage cluster.
6. The method according to claim 5, characterized in that After controlling the link between the target service port and the server to be switched from closed to open, the method further includes: Detecting a current instruction execution state of the target storage device, wherein the instruction execution state is used to indicate whether the target storage device currently allows execution of the read / write instruction sent by the server; If the instruction execution status indicates that the target storage device currently does not allow the read / write instruction sent by the server to be executed, and a volume scan instruction is received, adding the volume scan instruction to a waiting queue and starting a timer, wherein the volume scan instruction is an instruction sent by the server to request a scan of the storage volume of the target storage device; When the timing time reaches a preset time, detecting the current instruction execution state of the target storage device again; If the instruction execution status is still used to indicate that the target storage device currently does not allow the read / write instruction sent by the server to be executed, sending a retry instruction to the server, wherein the server is configured to resend the scan volume instruction to the target storage device upon receiving the retry instruction; In a case where the instruction execution status indicates that the target storage device currently allows the execution of the read and write instructions sent by the server, the volume scan instructions in the waiting queue are executed.
7. A storage device access control device, characterized in that: include: A first detection module is used to detect whether there is a storage device to be connected to the storage cluster, wherein each storage device in the storage cluster is used to provide business data required for running the business to the server through the business port; a first control module, configured to, upon detecting that a target storage device is to be connected to the storage cluster, control a link between a target service port of the target storage device and the server to remain closed, and, during a process of performing an access operation on the target storage device, detect a synchronization status of the target storage device with respect to configuration information of the storage cluster, wherein the configuration information is used to indicate a manner in which the storage devices in the storage cluster provide service data to the server; A second control module is used to control the opening of a link between the target service port and the server according to the synchronization state; Wherein, the first control module includes: an acquiring unit, configured to acquire target port information of the target storage device from a target storage space corresponding to the target storage device, wherein the target port information records a port identifier of a target cluster port in the target storage device, and the target storage device is configured to establish a link with each of the storage devices in the storage cluster through the target cluster port; A first determining unit is configured to determine, among the multiple ports of the target storage device, a port that does not belong to the target cluster port indicated by the target port information as the target service port; A setting unit is used to set the link enable flag of the target service port to a first state value, wherein the link enable flag is used to indicate whether an enable operation is allowed to be performed on the link of the corresponding port, and the link enable flag in the first state value is used to indicate that the enable operation is prohibited on the link of the corresponding port, and the enable operation is an operation to turn on the corresponding link.
8. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the storage device access control method according to any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the access control method for a storage device according to any one of claims 1 to 6 are implemented.