Access control method and device of block storage device and storage medium

By managing multipath and distributed coordination service modules in the block storage device, detecting the connection status of access paths and switching to available paths, the problem of data error during automatic failover of block storage devices is solved, and a highly reliable storage service is achieved.

CN116546010BActive Publication Date: 2025-11-28BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210095760.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-26
Publication Date
2025-11-28
Estimated Expiration
2042-01-26

AI Technical Summary

Technical Problem

In existing technologies, block storage devices are prone to data read/write errors during automatic failover, especially when the TGT program fails, in which case client read/write operations will be interrupted and there is a risk of data corruption.

Method used

By managing multiple logical unit numbers in the access path group of the block storage device, and utilizing the multi-path management module and the distributed coordination service module, the connection status of the access path is detected, and the access path is switched to an available access path in case of failure. This ensures that the TGT gateway is connected to the distributed coordination service module and achieves high availability of the access path.

Benefits of technology

It improves the read reliability of block storage devices, ensuring that no incorrect data is read when the access path fails, thus achieving high availability of storage services and avoiding data read/write errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116546010B_ABST
    Figure CN116546010B_ABST
Patent Text Reader

Abstract

The application relates to a block storage device access control method and device and a storage medium, wherein the block storage device access control method comprises the following steps: searching for a first access path configured as an available path in a preset access path group, wherein the client is currently accessing the block storage device, and detecting the connection state of the first access path; when the connection state indicates that the first access path is faulty, judging whether a first TGT gateway corresponding to the first access path is connected with a preset distributed coordination service module; and when it is judged that the first TGT gateway is disconnected with the preset distributed coordination service module, selecting a second access path configured as an available path from the access path group, and switching the second access path to the first access path for the client to currently access the block storage device, so that the problem that read-write data is prone to errors when the block storage device is accessed by using automatic fault switching is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data storage, and particularly relates to a block storage device access control method and device and a storage medium. BACKGROUND

[0002] Internet Small Computer System Interface (iSCSI) is a standard for data block transmission over Transmission Control Protocol (TCP) / Internet Protocol (IP), and iSCSI can enable Small Computer System Interface (SCSI) protocol to run on an IP network, so that it can perform fast data access backup operations on high-speed Gigabit Ethernet. Based on the iSCSI protocol, an Internet-based remote service mode can be provided for a block storage device.

[0003] TGT, which stands for iSCSI Target FrameWork, is a gateway based on the iSCSI protocol in related technologies, which is used to provide distributed block services. Therefore, after a block device is created in the TGT, a client can log in to the corresponding block device through IP and perform corresponding data read and write. Meanwhile, in the related technologies, when the TGT program in the distributed block service system fails, the read and write of the client will be interrupted, and the client cannot perform data read and write. Meanwhile, a scheme for automatically switching the fault to approach the read and write interruption problem will bring the risk of read and write data error after the fault switching.

[0004] There is no effective solution to the problem that the block storage device is accessed by automatic fault switching in the related technologies, which easily causes read and write data errors. SUMMARY

[0005] The present application provides a block storage device access control method and device and a storage medium to at least solve the problem that the block storage device is accessed by automatic fault switching in the related technologies, which easily causes read and write data errors.

[0006] In a first aspect, the present application provides a block storage device access control method, comprising:

[0007] find a first access path in a preset access path group, the first access path being currently accessed by a client to a block storage device and being configured as an available path, and detect a connection state of the first access path, wherein each of the clients is connected to a plurality of logical unit numbers created by a TGT gateway and managed by a multi-path management module, each of the logical unit numbers corresponds to an access path in the access path group, and each of the logical unit numbers is further connected to one of the block storage devices in a preset block storage system;

[0008] when the connection state indicates that the first access path is faulty, determine whether a first TGT gateway corresponding to the first access path is connected to a preset distributed coordination service module;

[0009] in a case where it is determined that the first TGT gateway is disconnected from the preset distributed coordination service module, select a second access path configured as an available path from the access path group, and switch the second access path to the first access path currently accessed by the client to the block storage device, wherein a second TGT gateway corresponding to the second access path is connected to the distributed coordination server module.

[0010] In a second aspect, the present application provides an access control device of a block storage device, comprising:

[0011] a query module configured to find a first access path in a preset access path group, the first access path being currently accessed by a client to a block storage device and being configured as an available path, and detect a connection state of the first access path, wherein each of the clients is connected to a plurality of logical unit numbers created by a TGT gateway and managed by a multi-path management module, each of the logical unit numbers corresponds to an access path in the access path group, and each of the logical unit numbers is further connected to one of the block storage devices in a preset block storage system;

[0012] a determination module configured to, when the connection state indicates that the first access path is faulty, determine whether a first TGT gateway corresponding to the first access path is connected to a preset distributed coordination service module;

[0013] a processing module configured to, in a case where it is determined that the first TGT gateway is disconnected from the preset distributed coordination service module, select a second access path configured as an available path from the access path group, and switch the second access path to the first access path currently accessed by the client to the block storage device, wherein a second TGT gateway corresponding to the second access path is connected to the distributed coordination server module.

[0014] In a third aspect, a distributed coordination server is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus;

[0015] a memory for storing a computer program;

[0016] a processor for executing the program stored in the memory, so as to realize the steps of the block storage device access control method according to any one of the first aspect.

[0017] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to realize the steps of the block storage device access control method according to any one of the first aspect.

[0018] Compared with the related art, the block storage device access control method, device, electronic device and storage medium provided in the embodiment can improve the reliability of the client reading the block storage device by using the multi-path management module to create logical unit numbers for multiple TGT programs, and manage the access paths corresponding to the logical unit numbers. By setting only one available access path at any time, the client will not read data incorrectly when accessing the block storage device after switching the access path. By setting the TGT gateway to establish a connection with the distributed coordination service module, the corresponding access path is available, ensuring the accuracy of the access path. The problem of reading and writing data errors caused by automatic switching to access the block storage device is solved. The client can read and write the same block storage device from multiple access paths, and switch when the access path fails, thereby achieving the high availability of the storage service.

[0019] The details of one or more embodiments of the present application are presented in the following drawings and description to make other features, objects and advantages of the present application more apparent. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings incorporated in and forming a part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application.

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.

[0022] Figure 1 A flowchart of a block storage device access control method provided by the embodiment of the present application is shown in the figure.

[0023] Figure 2 A flowchart of a block storage device access control method according to a preferred embodiment of the present application is provided as follows;

[0024] Figure 3 A structural block diagram of a block storage device access control apparatus according to an embodiment of the present application is provided as follows;

[0025] Figure 4 An electronic device structural diagram according to an embodiment of the present application is provided as follows. DETAILED DESCRIPTION

[0026] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the 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 of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.

[0027] First, the related terms and prior art involved in the embodiments of the present application are explained as follows:

[0028] Multipath is an open source software providing multi-path management function in Linux environment, which has functions of fault switching and load balancing.

[0029] Elastic Block Storage (EBS) is used to provide real block storage service.

[0030] Logical Unit Number (LUN) is used for storage, and LUN can be used as a system physical drive to install an operating system. LUN can be used in clusters, virtual servers, Storage Area Network and SAN Protocols (SAN), and the main use of LUN in virtual servers is as storage of an operating system. The performance and reliability of LUN are determined according to the drive used when creating a target storage server.

[0031] TGT is the full name of iSCSI Target FrameWork, which is a SCSI target framework supporting the creation and maintenance of various SCSI target driver protocols (iSCSI, Fibre Channel (FC), Secure Remote Password (SRP), etc.). TGT can provide a method for accessing various storage devices, and is also a driver program for exporting block storage devices. The complete TGT framework includes two parts: user space and kernel space. The creation and modification of protocols only need to be completed in the user space. The main motivation for the emergence of TGT is to transfer the creation and maintenance of traditional SCSI target protocol drivers from the kernel state to the user state, avoiding the need to recompile the kernel every time the code is modified. In the user state, developers can use various third-party libraries and debugging tools, etc., reducing the burden on developers.

[0032] The TGT program serves as a gateway for creating LUNs and exporting them to clients. Each LUN corresponds to a real block device (volume) created in EBS. Multiple LUNs can correspond to the same block storage device in EBS. For example, if client A connects to LUN1 and LUN2 created by TGT1 and TGT2 respectively, LUN1 and LUN2 correspond to the same block storage device in EBS. Each LUN is a path for the client.

[0033] ZooKeeper is an open-source software that provides distributed coordination services and is also defined as a distributed coordination service module. It is used for TGT node registration, query, and control of path switching.

[0034] In the prior art, a multipath management module Multipath under a Linux environment is introduced to manage multiple block storage devices created by different TGT programs or TGT gateways. When a block storage device fails, the multipath management module Multipath process checks the failure and switches the failure, so that the client read-write service is not affected. In the prior art, the multipath management module Multipath performs path management and switching strategy: when initialized, the multipath management module Multipath discovers all available access paths, and aggregates access paths to the same block storage device into an access path group; one access path is selected as the currently used access path, and the others are standby; when the currently used access path of the client fails, the multipath management module Multipath sets the currently available access path to the fail state, selects one access path from the remaining available access paths for failure switching, and the multipath also periodically detects all access paths, and sets the access path to fail when a failure is found. The fail state path will not be selected. A problem caused by introducing the multipath management module Multipath to manage multiple block storage devices created by different TGT programs or TGT gateways is that if the access path switching is left to the module itself without intervention, it will cause the client to read old data and cause data errors, for example: the client writes data a in TGT A-->TGT A fails-->switches to TGT B, updates data a to data b-->TGT B fails, TGT A recovers-->switches to TGT A, and reads data a in A, but the correct data to be read at this time is data b. Therefore, the related art has the problem that automatic failure switching is used to access the block storage device, which is easy to cause read-write data errors.

[0035] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

[0036] Figure 1 A flowchart of a block storage device access control method provided by the embodiments of the present application is shown in FIG. 1. Figure 1 As shown in FIG. 1, the embodiments of the present application provide a block storage device access control method, which includes the following steps:

[0037] In step S101, a first access path in a preset access path group through which a client currently accesses a block storage device and is configured as an available path is found, and a connection state of the first access path is detected, wherein each client is connected to multiple logical unit numbers created by a TGT gateway and managed by a multipath management module, each logical unit number corresponds to an access path in an access path group, and each logical unit number is also connected to a block storage device in a preset block storage system.

[0038] In the embodiment, the multipath management module includes but is not limited to Multipath, and the logical unit numbers (LUNs) created by different TGT programs are managed by the multipath management module, each of the LUNs corresponds to a same block storage device in the block storage system, and when a client reads and writes the block storage device, there are multiple selectable access paths, and the multiple selectable access paths are aggregated into an access path group.

[0039] In the embodiment, the number of the LUNs created by different TGT gateways can be different or the same, and the multiple LUNs connected by each client are created by different TGT gateways, for example, the client C and the client D are connected to two LUNs respectively, wherein the two LUNs connected by the client C are LUN-C1 and LUN-C2, the two LUNs connected by the client D are LUN-D1 and LUN-D2, LUN-C1 and LUN-D1 can be created by the TGT gateway A, and LUN-C2 and LUN-D2 can be created by the TGT gateway B; meanwhile, the multiple LUNs connected by each client correspond to a same block storage device in the block storage system, for example, LUN-C1 and LUN-C2 correspond to a same block storage device C in the block storage system.

[0040] In the embodiment, when initialized, one of all the access paths in the access path group is selected as an available path, that is, the first access path, and the rest of the access paths are set to be invalid or unavailable regardless of whether they are available or not, so that at any moment when the client accesses the block storage device, there is only one available access path, thereby avoiding read-write data errors.

[0041] In the embodiment, a corresponding distributed coordination service module is added in the TGT program corresponding to the TGT gateway, and after the TGT gateway is started, the registration is performed on the distributed coordination service module, so that the corresponding TGT gateway joins the system ecology corresponding to the corresponding distributed coordination service module.

[0042] In the embodiment, after the first access path through which the client currently accesses the block storage device is found, the connection state of the first access path is detected in real time, so as to determine whether the client accesses the block storage device abnormally and whether the first access path is faulty by detecting the connection state of the first access path.

[0043] In step S102, when the connection state indicates that the first access path is faulty, it is determined whether the first TGT gateway corresponding to the first access path is connected with the preset distributed coordination service module.

[0044] In the embodiment, when the first access path fails, at this time, the first TGT gateway which has joined the distributed coordination service module before can be in the distributed coordination service module and has not exited the distributed coordination service module, at this time, whether the first TGT gateway is connected with the distributed coordination service module is detected to determine whether the first TGT gateway exits, when it is detected that the first TGT gateway is connected with the distributed coordination service module, it is indicated that other faults can occur or the first TGT gateway is temporarily disconnected with the distributed coordination service module and then the connection is established again.

[0045] In step S103, when it is determined that the first TGT gateway is disconnected with the preset distributed coordination service module, a second access path configured as an available path is selected from the access path group, and the second access path is switched as the first access path of the client for accessing the block storage device at present, wherein the second TGT gateway corresponding to the second access path is connected with the distributed coordination service module.

[0046] In the embodiment, when it is determined that the first TGT gateway is disconnected with the distributed coordination service module, the first TGT gateway exits the distributed coordination service module, at this time, in order to ensure that the client reads the block storage device, the access path switching needs to be performed, that is, one available access path is selected from the access path group as the access path of the client for accessing the block storage device at present.

[0047] In the embodiment, when the second access path is selected, it is required that the second access path is available, for example, the first access path which has failed before cannot be selected, at the same time, when the second access path is started, the second TGT gateway corresponding to the second access path completes the registration in the distributed coordination service module and joins the distributed coordination service module, whether the second TGT gateway is connected with the distributed coordination service module is checked to detect whether the second access path is normal, in the embodiment, after the corresponding second access path is selected, the second access path is configured as the available path used at present, the client accesses the corresponding block storage device through the second access path, and thereafter, the first access path and the remaining access paths are configured as invalid or unavailable states.

[0048] By the steps S101 to S103, the first access path configured as an available path in the preset access path group is found, and the connection state of the first access path is detected, where the client is currently accessing the block storage device; when the connection state indicates that the first access path is faulty, it is judged whether the first TGT gateway corresponding to the first access path is connected with the preset distributed coordination service module; when it is judged that the first TGT gateway is disconnected with the preset distributed coordination service module, the second access path configured as an available path is selected from the access path group, and the second access path is switched as the first access path for the client to currently access the block storage device, thereby solving the problem that the block storage device is accessed by using the automatic switching, which is easy to cause the read / write data error. Meanwhile, the logical unit numbers created by the multiple TGT programs are managed by using the multi-path management module, so as to manage the access paths corresponding to the logical unit numbers, and the reliability of the client reading the block storage device is improved. By setting only one available access path at any time, when the access path is switched, the client accesses the block storage device without reading the data error. By setting the TGT gateway to be connected with the distributed coordination service module, the corresponding access path is available, the accuracy of the access path is ensured, the client reads and writes the same block storage device from multiple access paths, and the switching is performed when the access path is faulty, thereby ensuring the high availability of the storage service.

[0049] Figure 2 A flowchart of a block storage device access control method provided by the preferred embodiment of the present application is shown in FIG. 1. As shown in FIG. 1, the control method includes the following steps: Figure 2

[0050] Step S201: finding, in a preset access path group, a first access path configured as an available path for a client to currently access a block storage device, and detecting a connection state of the first access path, where each client is connected with multiple logical unit numbers created by a TGT gateway and managed by a multi-path management module, each logical unit number corresponds to an access path in the access path group, and each logical unit number is further connected with a block storage device in a preset block storage system.

[0051] Step S202: when the connection state indicates that the first access path is faulty, judging whether a first TGT gateway corresponding to the first access path is connected with a preset distributed coordination service module.

[0052] Step S203: when it is judged that the first TGT gateway is connected with the distributed coordination service module, maintaining the first access path as the access path for the client to currently access the block storage device.

[0053] ​In the embodiment, when the first access path fails, the first TGT gateway which has joined the distributed coordination service module before can be in the distributed coordination service module and has not exited the distributed coordination service module. At this time, whether the first TGT gateway is connected with the distributed coordination service module is detected to determine whether the first TGT gateway exits. When it is detected that the first TGT gateway is connected with the distributed coordination service module, it is indicated that other failures or the first TGT gateway is temporarily disconnected with the distributed coordination service module and then the connection is established again.

[0054] Through the steps S201 to S203, the first access path through which the client currently accesses the block storage device and which is configured as an available path in the preset access path group is searched, and the connection state of the first access path is detected. When the connection state indicates that the first access path fails, whether the first TGT gateway corresponding to the first access path is connected with the preset distributed coordination service module is determined. When it is determined that the first TGT gateway is connected with the distributed coordination service module, the first access path is maintained as the access path through which the client currently accesses the block storage device. The check of the recovery work after the first access path fails due to the non-logical unit number failure or the first access path temporarily fails is implemented, and the reliability of the block storage device access is ensured.

[0055] In some embodiments, whether the first TGT gateway corresponding to the first access path is connected with the preset distributed coordination service module further includes the following steps:

[0056] Step 12, in the distributed coordination service module, whether the first TGT gateway exists is detected to determine a first detection result. The first TGT gateway joins the distributed coordination service module after being started.

[0057] In the embodiment, the distributed coordination service module is added in the program corresponding to the TGT gateway. Therefore, when the TGT gateway is started, the corresponding TGT gateway is registered on the distributed coordination service module Zookeeper to represent that the TGT gateway joins the system ecology corresponding to the distributed coordination service module. After the corresponding TGT gateway is disconnected with the distributed coordination service module Zookeeper, whether the corresponding TGT gateway exists is detected to determine the connection state of the TGT gateway and the distributed coordination service module Zookeeper.

[0058] Step 14, according to the first detection result, a first connection state of the first TGT gateway and the distributed coordination service module is determined. The first connection state includes a temporary disconnection state.

[0059] Step 16, after judging that the first connection state is the temporary disconnection state and after the interval preset time, rechecking whether the first TGT gateway exists in the distributed coordination service module.

[0060] In the embodiment, when it is judged that the first TGT gateway is temporarily disconnected with the distributed coordination service module, the first TGT gateway reconnects with the distributed coordination service module within a certain time after the temporary disconnection state, and in the case of successful reconnection, the access path switching is not needed, therefore, after the interval preset time, the rechecking of the first TGT gateway in the distributed coordination service module can determine that the first TGT gateway is successfully reconnected, and if the first TGT gateway is not rechecked, it can be determined that the first TGT gateway fails to reconnect.

[0061] Step 18, in the case that the first TGT gateway is not rechecked in the distributed coordination service module, it is determined that the first TGT gateway is disconnected with the distributed coordination service module.

[0062] In the embodiment, when the first TGT gateway is not rechecked in the distributed coordination service module, it indicates that the first TGT gateway fails to reconnect, and the first TGT gateway is completely disconnected with the distributed coordination service module, the first access path of the client to access the block storage device fails, and the access path needs to be switched. In the above steps 12 to 18, whether the first TGT gateway exists in the distributed coordination service module is detected to determine the first detection result, wherein the first TGT gateway is added to the distributed coordination service module after being started; according to the first detection result, the first connection state of the first TGT gateway and the distributed coordination service module is judged, wherein the first connection state includes the temporary disconnection state; after judging that the first connection state is the temporary disconnection state and after the interval preset time, whether the first TGT gateway exists in the distributed coordination service module is rechecked; in the case that the first TGT gateway does not exist in the distributed coordination service module, it is determined that the first TGT gateway is disconnected with the distributed coordination service module, which realizes the rechecking of the first TGT gateway after the temporary disconnection, and confirms the first access path to ensure the effectiveness of the client to access the block storage module.

[0063] In some embodiments, in order to confirm the failure of the first access path, after the detection of whether the first TGT gateway exists in the distributed coordination service module in step 12 to determine the first detection result, the following steps are implemented:

[0064] Step 15, in the case that the first detection result indicates that the first TGT gateway exists in the distributed coordination service module, it is determined that the first TGT gateway is connected with the distributed coordination service module, wherein the first connection state includes that the first TGT gateway is connected with the distributed coordination service module; or

[0065] Step 19, in case of rechecking the first TGT gateway existing in the distributed coordination service module, determining the first TGT gateway connecting with the distributed coordination service module.

[0066] In some embodiments, in order to confirm the failure of the first access path, the following step is further implemented: if the first TGT gateway is not rechecked in the distributed coordination service module or the first TGT gateway is rechecked not existing in the distributed coordination service module, the first TGT gateway is exited from the distributed coordination service module.

[0067] In the present embodiment, when the corresponding TGT gateway is disconnected from the distributed coordination service module, a zk preset interval time (defined timeout time) is waited, and the distributed coordination service module is tried to reconnect within the interval time to reestablish the connection, which indicates that the first access path does not need to be switched; the corresponding TGT gateway and the corresponding logical unit number are exited from the distributed coordination service module in case of reconnection failure. Meanwhile, when it is determined that the reconnection session is expired, the corresponding TGT gateway and the corresponding logical unit number are also exited from the distributed coordination service module.

[0068] In some embodiments, the second access path configured as the available path is further selected from the access path group in step S103, and the following steps are further included:

[0069] Step 31, one selected access path is selected from the access path group, wherein the access path group includes a plurality of selected access paths configured as the unavailable paths.

[0070] Step 32, the selected access path and the third TGT gateway corresponding to the selected access path are started, and whether the third TGT gateway joins the distributed coordination service module is judged, wherein the third TGT gateway is joined into the distributed coordination service module after being started.

[0071] Step 33, in case of judging the third TGT gateway joining the distributed coordination service module, it is determined that the selected access path is started successfully, wherein the second access path includes the selected access path started successfully, and the second TGT gateway includes the third TGT gateway.

[0072] The above steps involve selecting an alternative access path from the access path group, where the access path group includes multiple alternative access paths configured as unavailable; starting the alternative access path and its corresponding third TGT gateway, and determining whether the third TGT gateway has joined the distributed coordination service module; if the third TGT gateway has joined the distributed coordination service module, the alternative access path is considered successfully started. The second access path includes the successfully started alternative access path, and the second TGT gateway includes the third TGT gateway. By determining whether the alternative access path is registered and added to the distributed coordination service module after startup, the availability of the second access path is determined, ensuring that only one access path exists at any given time for client access to the block storage device, thus preventing data read / write errors when clients access the block storage device.

[0073] In some embodiments, step S103, which switches the second access path to the first access path that the client is currently accessing the block storage device, further includes the following steps: configuring the second access path as the currently available access path and removing the first TGT gateway from the distributed coordination service module.

[0074] This embodiment also provides an access control device for a block storage device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. The terms "module," "unit," "subunit," etc., used below can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0075] Figure 3 This is a structural block diagram of the access control device for a block storage device according to an embodiment of this application, such as... Figure 3 As shown, the device includes:

[0076] The query module 31 is used to find the first access path in the preset access path group where the client is currently accessing the block storage device and is configured as an available path, and to detect the connection status of the first access path. Each client is connected to multiple logical unit numbers created by the TGT gateway and managed by the multi-path management module. Each logical unit number corresponds to an access path in the access path group, and each logical unit number is also connected to a block storage device in the preset block storage system.

[0077] The judging module 32 is coupled to the querying module 31, and is configured to, when the connection state indicates that the first access path is faulty, judge whether the first TGT gateway corresponding to the first access path is connected to the preset distributed coordination service module.

[0078] The processing module 33 is coupled to the judging module 32, and is configured to, when it is judged that the first TGT gateway is disconnected from the preset distributed coordination service module, select a second access path configured as an available path from the access path group, and switch the second access path as the first access path through which the client currently accesses the block storage device, wherein the second TGT gateway corresponding to the second access path is connected to the distributed coordination server module.

[0079] The access control device provided in the embodiments of the present application uses the multi-path management module to manage the logical unit numbers created by the multiple TGT programs, thereby managing the access paths corresponding to the logical unit numbers, improving the reliability of the client reading the block storage device, and ensuring the accuracy of the access path. The problem that reading and writing data are prone to errors when the block storage device is accessed through automatic fault switching is solved, and the client reads and writes the same block storage device from multiple access paths and switches the access path when the access path is faulty, thereby achieving the high-availability feature of the storage service.

[0080] In some embodiments, the access control device is further configured to, when it is judged that the first TGT gateway is connected to the distributed coordination service module, maintain the first access path as the access path through which the client currently accesses the block storage device.

[0081] In some embodiments, the judging module 32 further includes:

[0082] The first detection unit is configured to detect, in the distributed coordination service module, whether the first TGT gateway exists, and determine a first detection result, wherein the first TGT gateway is added to the distributed coordination service module after being started.

[0083] The first judging unit is coupled to the first detection unit, and is configured to judge, according to the first detection result, a first connection state of the first TGT gateway and the distributed coordination service module, wherein the first connection state includes a temporary disconnection state.

[0084] The first rechecking unit is coupled to the first judging unit, and is configured to, when it is judged that the first connection state is the temporary disconnection state and after a preset time interval, recheck, in the distributed coordination service module, whether the first TGT gateway exists.

[0085] The first determining unit is coupled to the first rechecking unit and is configured to determine that the first TGT gateway is disconnected from the distributed coordination service module if it is rechecked that the first TGT gateway does not exist in the distributed coordination service module.

[0086] In some embodiments, the judging module 32 is further configured to determine that the first TGT gateway is connected to the distributed coordination service module if the first detection result indicates that the first TGT gateway exists in the distributed coordination service module, wherein the first connection state includes that the first TGT gateway is connected to the distributed coordination service module; or configured to determine that the first TGT gateway is connected to the distributed coordination service module if it is rechecked that the first TGT gateway exists in the distributed coordination service module.

[0087] In some embodiments, if the first TGT gateway is not rechecked in the distributed coordination service module or it is rechecked that the first TGT gateway does not exist in the distributed coordination service module, the access control device of the block storage device is further configured to log out the first TGT gateway from the distributed coordination service module.

[0088] In some embodiments, the processing module 33 further includes:

[0089] The first selecting unit is configured to select one candidate access path from the access path group, wherein the access path group includes a plurality of candidate access paths configured as unavailable paths;

[0090] The second judging unit is coupled to the first selecting unit and is configured to start the candidate access path and a third TGT gateway corresponding to the candidate access path, and to judge whether the third TGT gateway joins the distributed coordination service module, wherein the third TGT gateway joins the distributed coordination service module after being started.

[0091] The second processing unit is coupled to the second judging unit and is configured to determine that the candidate access path is successfully started if it is judged that the third TGT gateway joins the distributed coordination service module, wherein the second access path includes the candidate access path successfully started, and the second TGT gateway includes the third TGT gateway.

[0092] In some embodiments, the processing module is further configured to configure the second access path as a current available access path, and to log out the first TGT gateway from the distributed coordination service module.

[0093] Figure 4 is a structural schematic diagram of an electronic device of an embodiment of the present application, as Figure 4As shown, this application embodiment provides an electronic device, including a processor 41, a communication interface 42, a memory 43, and a communication bus 44, wherein the processor 41, the communication interface 42, and the memory 43 communicate with each other through the communication bus 44.

[0094] Memory 43 is used to store computer programs;

[0095] When processor 41 executes the program stored in memory 43, it implements... Figure 1 The methods and steps in the text.

[0096] The processing implementation in this server Figure 1 The method steps described above, and the resulting technical effects, are the same as those achieved in the embodiments described above. Figure 1 The technical effects of the access control methods for medium-sized storage devices are the same, so they will not be elaborated here.

[0097] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0098] The communication interface is used for communication between the aforementioned terminal and other devices.

[0099] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0100] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0101] The embodiment of the present application further provides a computer readable storage medium, which has a computer program stored thereon, and the computer program is executed by a processor to implement the steps of the access control method of the block storage device provided in any one of the preceding method embodiments.

[0102] In another embodiment provided by the present application, a computer program product containing instructions, which, when executed on a computer, causes the computer to perform the access control method of the block storage device described in any one of the preceding embodiments.

[0103] It should be noted that, in the present document, relational terms such as "first" and "second", and the like, are used solely to distinguish one entity or action from another entity or action, without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. In addition, the term "coupled" is used herein to express a relationship between or among multiple elements. Such a relationship can be a physical or logical relationship, and can include electrical connections, physical connections, or other relationships between or among the multiple elements.

[0104] The above description is merely one specific implementation of the application. Many modifications and other embodiments of the application set forth herein will come to mind to one skilled in the art to which the application pertains having the benefit of the teachings presented in the foregoing description. Therefore, it is to be understood that the application is not to be limited to the specific embodiments disclosed and that modifications and other embodiments are intended to be included within the scope of the appended claims.

Claims

1. An access control method of a block storage device, characterized by, The method comprises: finding a first access path in a preset access path group, wherein the first access path is currently used by a client to access a block storage device and is configured as an available path, and detecting a connection state of the first access path, wherein each of the clients is connected to a plurality of logical unit numbers created by a TGT gateway and managed by a multi-path management module, each of the logical unit numbers corresponds to an access path in the access path group, and each of the logical unit numbers is further connected to one of the block storage devices in a preset block storage system; in initialization, selecting the first access path from all the access paths in the access path group, and setting the first access path as the available path, and setting the remaining access paths as invalid or unavailable paths regardless of whether they are available or not; when the connection state indicates that the first access path is faulty, determining whether a first TGT gateway corresponding to the first access path is connected to a preset distributed coordination service module; when it is determined that the first TGT gateway is disconnected from the distributed coordination service module, selecting a second access path configured as an available path from the access path group, and switching the second access path to the first access path currently used by the client to access the block storage device, wherein a second TGT gateway corresponding to the second access path is connected to the distributed coordination server module; when it is determined that the first TGT gateway is connected to the distributed coordination service module, maintaining the first access path as the access path currently used by the client to access the block storage device; wherein determining whether the first TGT gateway corresponding to the first access path is connected to the preset distributed coordination service module comprises: in the distributed coordination service module, detecting whether the first TGT gateway exists, and determining a first detection result, wherein the first TGT gateway joins the distributed coordination service module after being started; determining a first connection state of the first TGT gateway and the distributed coordination service module according to the first detection result, wherein the first connection state includes a temporary disconnection state; when it is determined that the first connection state is the temporary disconnection state and after a preset time interval, rechecking whether the first TGT gateway exists in the distributed coordination service module; and when it is rechecked that the first TGT gateway does not exist in the distributed coordination service module, determining that the first TGT gateway is disconnected from the distributed coordination service module.

2. The method of claim 1, wherein, The method further comprises: when the first detection result indicates that the first TGT gateway exists in the distributed coordination service module, determining that the first TGT gateway is connected to the distributed coordination service module, wherein the first connection state includes that the first TGT gateway is connected to the distributed coordination service module; or when it is rechecked that the first TGT gateway exists in the distributed coordination service module, determining that the first TGT gateway is connected to the distributed coordination service module.

3. The method of claim 1, wherein, The method further comprises: if the first TGT gateway is not found in the distributed coordination service module or the first TGT gateway is found not to exist in the distributed coordination service module, the first TGT gateway is exited from the distributed coordination service module.

4. The method of claim 1, wherein, The second access path configured as an available path is selected from the access path group, including: An alternative access path is selected from the access path group, wherein the access path group includes a plurality of alternative access paths configured as unavailable paths; The alternative access path and a third TGT gateway corresponding to the alternative access path are started, and it is determined whether the third TGT gateway joins the distributed coordination service module, wherein the third TGT gateway joins the distributed coordination service module after being started; In a case where it is determined that the third TGT gateway joins the distributed coordination service module, it is determined that the alternative access path is successfully started, wherein the second access path includes the alternative access path successfully started, and the second TGT gateway includes the third TGT gateway.

5. The method of claim 1, wherein, The second access path is switched to the first access path through which the client currently accesses the block storage device, including: the second access path is configured as a currently available access path, and the first TGT gateway is exited from the distributed coordination service module.

6. An access control apparatus of a block storage device, characterized by comprising: Including: The query module is configured to find a first access path in a preset access path group through which a client currently accesses a block storage device and configured as an available path, and detect a connection state of the first access path, wherein each client is connected to a plurality of logical unit numbers (LUNs) created by a TGT gateway and managed by a multipath management module, each LUN corresponds to an access path in the access path group, and each LUN is further connected to one block storage device in a preset block storage system; during initialization, the first access path is selected from all access paths in the access path group and set as an available path, and the remaining access paths are set as invalid or unavailable regardless of whether they are available or not; The determination module is configured to determine whether a first TGT gateway corresponding to the first access path is connected to a preset distributed coordination service module when the connection state indicates that the first access path fails; The processing module is configured to select a second access path configured as an available path from the access path group and switch the second access path to the first access path through which the client currently accesses the block storage device when it is determined that the first TGT gateway is disconnected from the preset distributed coordination service module, wherein a second TGT gateway corresponding to the second access path is connected to the distributed coordination service module; The access control device is further configured to maintain the first access path as an access path through which the client currently accesses the block storage device when it is determined that the first TGT gateway is connected to the distributed coordination service module; The determination module includes: The first detection unit is configured to detect whether the first TGT gateway exists in the distributed coordination service module and determine a first detection result, wherein the first TGT gateway is added to the distributed coordination service module after being started up. The first judgment unit is coupled with the first detection unit and configured to judge a first connection state of the first TGT gateway and the distributed coordination service module according to the first detection result, wherein the first connection state includes a temporary disconnection state. The first recheck unit is coupled with the first judgment unit and configured to recheck whether the first TGT gateway exists in the distributed coordination service module after the first connection state is judged to be the temporary disconnection state and a preset time interval elapses. The first determination unit is coupled with the first recheck unit and configured to determine that the first TGT gateway is disconnected with the distributed coordination service module in a case that the first TGT gateway is rechecked not to exist in the distributed coordination service module.

7. A distributed coordination server, characterized by The computer device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are in communication with each other through the communication bus. The memory is configured to store a computer program. The processor is configured to execute the program stored in the memory to implement the access control method of the block storage device according to any one of claims 1-5.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the access control method of the block storage device according to any one of claims 1-5.

Citation Information

Patent Citations

  • Method and system for realizing access of asymmetric logical units in distributed storage to multiple paths

    CN113489784A