Target device renaming method and device based on distributed storage system

By adding the mapping between logical names and service names to the logical targets of distributed storage systems, the problem of difficult operation consistency when modifying logical target names in the prior art is solved, and the efficiency and data consistency of logical target renaming are achieved.

CN113377714BActive Publication Date: 2025-04-08SANDSTONE DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110661804.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-15
Publication Date
2025-04-08
Estimated Expiration
2041-06-15

AI Technical Summary

Technical Problem

In existing distributed storage systems, when the name of the logical target is modified, the mapping table of multiple objects needs to be changed, which makes it difficult to ensure the consistency of operation instructions, which easily leads to inconsistent metadata information, resulting in the inability to delete the relevant disk but is unavailable.

Method used

By adding a mapping between logical names and service names to the logical target, you only need to perform database configuration operations on one object to realize the renaming of the logical target and ensure the consistency of data.

Benefits of technology

This method only requires one write request when renaming the logical target, ensuring data consistency, improving renaming efficiency, and avoiding disk unavailability caused by operation consistency problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113377714B_ABST
    Figure CN113377714B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention relates to a target device renaming method and device based on a distributed storage system. In a logical target device, a logical name and a service name are recorded as an attribute of a logical target, and by adding a mapping between a logical name and a service name in the logical target device, the logical name and the service name are saved in different mapping tables of the same object; and in a storage cluster, a mapping relationship is still established between the logical name of the logical target device and the client, block storage client and SCS I gateway. When a logical target device is renamed, it is actually the addition and modification of the mapping relationship between the logical name and the service name in the logical target device. Only one write request needs to be sent to the underlying database, that is, only a database configuration operation needs to be performed on the mapping between the logical name and the service name of an object, which ensures data consistency and effectively improves the renaming efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the technical field of distributed storage systems, and in particular to a target device renaming method and device based on a distributed storage system. Background Art

[0002] In the distributed storage system, taking the Ceph distributed file system as an example, Ceph is a unified distributed file system designed for excellent performance, reliability and scalability.

[0003] In traditional storage systems, commands, status, and block data are transmitted between hosts and storage devices mainly through the SCSI protocol. However, with the introduction of distributed storage and the need for SCSI interfaces to use the SCSI protocol, iSCSI architecture has been widely used.

[0004] The architecture of iSCSI (Internet Small Computer System Interface) defines the provider and user of storage services as the iSCSI target, which is used to convert SCSI commands and data in TCP / IP packets, and the iSCSI initiator, which is used to generate SCSI requests and encapsulate SCSI commands and data into TCP / IP packets and send them to the IP network, which is the storage client. The storage service client and the storage client communicate using TCP, and the storage service client maps the block storage device as a volume and provides it to the storage client, thereby realizing remote block storage services.

[0005] However, in the prior art, in a distributed storage system based on a logical target, the logical target is the core of providing block storage services, and a relationship with a SCSI gateway node, a block storage device, and a storage client is established. The relevant metadata information is persistently stored in multiple mapping tables of multiple underlying objects. If a user wants to modify the name of the logical target, it is necessary to perform change operation instructions on the mapping tables of multiple objects, and it is difficult to ensure the consistency of the operation instructions. If a failure occurs during execution (such as a sudden network disconnection or power failure), the metadata information will be inconsistent. In severe cases, the relevant disk cannot be deleted but is unavailable, which brings a lot of unnecessary trouble. Summary of the invention

[0006] The purpose of the embodiments of the present application is to provide a target device renaming method and device based on a distributed storage system, add a mapping between a logical name and a service name in a logical target device, and only need to perform a database configuration operation on one object when renaming a logical target device, avoiding database configuration operations on multiple objects by directly modifying the name, thereby ensuring data consistency.

[0007] In a first aspect, an embodiment of the present application provides a target renaming method based on a distributed storage system, the method comprising:

[0008] When receiving a rename operation instruction for a logical target, obtaining the original logical name and target service name of the logical target to be renamed;

[0009] If the logical target is found to be a created target in the metadata mapping table of the distributed storage system according to the original logical name, then verify the legitimacy of the target service name;

[0010] When the legitimacy verification of the target service name passes, if the original service name exists in the logical target, the mapping relationship between the original service name and the original logical name in the logical target is deleted, and a mapping relationship between the target service name and the target logical name is added, and is persistently stored in the metadata mapping table of the storage cluster;

[0011] After the saving is successful, based on the subscription notification mechanism, the SCSI gateway is notified to reload the metadata mapping table, and the mapping relationship between the target service name and the target logical name is updated based on the latest metadata mapping table.

[0012] In a second aspect, an embodiment of the present application further provides a target renaming device based on a distributed storage system, the device comprising:

[0013] A renaming operation receiving module, used for obtaining the original logical name and target service name of the logical target to be renamed when receiving a renaming operation instruction for the logical target;

[0014] A legitimacy verification module, used for verifying the legitimacy of the target service name if the logical target is found to be a created target in a metadata mapping table of a distributed storage system according to the original logical name;

[0015] A renaming module, which is used to delete the mapping relationship between the original service name and the original logical name in the logical target device when the legitimacy verification of the target service name passes, if the original service name exists in the logical target device, and to add a mapping relationship between the target service name and the target logical name, and to persist the mapping relationship in the metadata mapping table of the storage cluster;

[0016] The notification module is used to notify the SCSI gateway to reload the metadata mapping table based on the subscription notification mechanism after the save is successful, and to update the mapping relationship between the target service name and the target logical name based on the latest metadata mapping table.

[0017] In a third aspect, an embodiment of the present application further provides a server, which includes at least one processor and a memory, wherein the memory is communicatively connected to the at least one processor, and the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above method.

[0018] In a fourth aspect, an embodiment of the present application further provides a distributed storage system, including a server, a SCSI gateway, and a storage cluster; the server is the server as described in the third aspect;

[0019] The server permanently stores the mapping relationship between the service name and the logical name of the renamed logical target in the metadata mapping table of the storage cluster;

[0020] The server notifies the SCSI gateway to reload the metadata mapping table based on a subscription notification mechanism;

[0021] The SCSI gateway loads the metadata mapping table based on the subscription notification mechanism, and updates the mapping relationship between the service name and the logical name based on the metadata mapping table;

[0022] The SCSI gateway provides an access interface for the client based on the mapping relationship between the service name and the logical name, and when exposing the logical target, if the service name of the logical target has been set, the service name of the logical target is exposed externally, otherwise the logical name of the logical target is exposed;

[0023] The client initiates an access request to the SCSI gateway through the access interface;

[0024] If the service name of the logical target corresponding to the access request has been set, the SCSI gateway converts the service name of the access request into a corresponding first actual logical name based on the mapping relationship between the service name and the logical name of the logical target;

[0025] If the service name of the logical target corresponding to the access request is not set, the SCSI gateway uses the logical name of the logical target as the second actual logical name of the access request;

[0026] The client accesses the volume associated with the logical target according to the first actual logical name or the second actual logical name.

[0027] In a fifth aspect, an embodiment of the present application further provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are executed by a distributed storage system, the distributed storage system executes the method described above.

[0028] In a sixth aspect, an embodiment of the present application further provides a computer program product, wherein the computer program product comprises a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program comprises program instructions, and when the program instructions are executed by a server, the server executes the above-mentioned method.

[0029] Compared with the prior art, the present application has at least the following beneficial effects: the target renaming method and device based on the distributed storage system of the embodiment of the present application, in the logical target, records the logical name and service name as an attribute of the logical target, and by adding the mapping between the logical name and the service name in the logical target, the logical name and the service name are saved in different mapping tables of the same object; and in the storage cluster, the logical name of the logical target is still used to establish a mapping relationship with the client, block storage client and SCSI gateway. When renaming the logical target, it is actually the addition and modification of the mapping relationship between the logical name and the service name in the logical target, which only requires sending a write request to the underlying database once, that is, only the database configuration operation is required for the mapping between the logical name and the service name of an object, which ensures the consistency of the data and effectively improves the renaming efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0031] Figure 1 It is a schematic diagram of a model of an embodiment of the distributed storage system of the present application;

[0032] Figure 2 This is a schematic diagram of another embodiment of the distributed storage system of the present application.

[0033] Figure 3 It is a structural diagram of an embodiment of the distributed storage system of the present application;

[0034] Figure 4 It is a flowchart of an embodiment of the target device renaming method based on the distributed storage system of the present application;

[0035] Figure 5It is a flowchart of another embodiment of the target device renaming method based on the distributed storage system of the present application;

[0036] Figure 6 It is a flowchart of another embodiment of the target device renaming method based on the distributed storage system of the present application;

[0037] Figure 7 It is a flowchart of another embodiment of the target device renaming method based on the distributed storage system of the present application;

[0038] Figure 8 It is a structural diagram of an embodiment of the target device renaming device based on a distributed storage system of the present application;

[0039] Fig. 9 It is a structural diagram of an embodiment of a target renaming device based on a distributed storage system of the present application. DETAILED DESCRIPTION

[0040] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several variations and improvements may be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0042] It should be noted that, if there is no conflict, the various features in the embodiments of the present invention can be combined with each other, all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device or the flow chart. In addition, the words "first", "second", "third", etc. used herein do not limit the data and execution order, but only distinguish the same items or similar items with basically the same functions and effects.

[0043] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in this specification and in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.

[0044] In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0045] Distributed storage systems, such as Ceph, are unified distributed storage systems designed for excellent performance, reliability, and scalability. Distributed storage systems usually include storage devices and storage clusters. Storage devices include storage service clients and storage clients. The storage cluster and storage devices mainly transmit commands, status, and block data through the SCSI protocol. When using the SCSI protocol, a SCSI interface is required, which makes the iSCSI architecture widely used.

[0046] The architecture of iSCSI (Internet Small Computer System Interface) defines the provider and user of storage services as the iSCSI target, which is used to convert SCSI commands and data in TCP / IP packets, and the iSCSI initiator, which is used to generate SCSI requests and encapsulate SCSI commands and data into TCP / IP packets and send them to the IP network, which is the storage client. The storage service client and the storage client communicate using TCP, and the storage service client maps the block storage device as a volume and provides it to the storage client, thereby realizing remote block storage services.

[0047] In a distributed storage system, there is usually a target (Linux target framework, tgt), which is an architecture proposed for creating and maintaining storage service end drivers and is indirectly integrated into the SCSI middle layer. When the storage service end starts the target service process, a logical target is created, and a mapping relationship between the logical target and the storage client and block storage device is established. The storage client can access the block storage device through the logical target.

[0048] To solve the problem of communication between multiple nodes, Ceph provides a watch / notify mechanism.

[0049] The watch / notify mechanism is similar to the information publish-subscribe mode: subscribe to messages through watch and publish messages through notify. That is, the client registers the watch object with the OSD and maintains the session connection with the main OSD. The client can send notification messages and message contents to all clients that have registered the watch object (also called monitors), and receive notifications when the monitors receive notifications, which allows the client to use any object as a synchronous communication channel.

[0050] The logical target and the storage cluster complete message notification and data synchronization through the watch / notify mechanism. Therefore, when the process of the logical target service is started, a watch object will be registered with the OSD. After that, the storage cluster only needs to send a message to the watch object to complete the message notification from the storage cluster to the logical target.

[0051] When metadata information is modified, the storage cluster will update the modified content to the logical target through notification. After receiving the notification, the logical target reloads the metadata mapping table and updates the corresponding volume mapping relationship based on the latest metadata mapping table. The metadata information includes the information of the logical target; the association information between the logical target and the SCSI gateway; the association information between the logical target and the block storage device; and the association information between the logical target and the client.

[0052] The storage client, i.e. the client mentioned above, is the user of the storage. It interacts with the logical target through the iSCSI protocol. When interacting, it specifically: obtains the list of logical targets maintained in the logical target, and accesses the block storage devices associated with the logical target by adding access control permissions to the logical target. The same storage client can be authorized to access multiple logical targets. For unauthorized storage clients, they cannot access the block storage devices associated with the logical target. In this way, the access rights to the block storage devices are controlled through the logical target, which has the effect of isolating the block storage devices. Finally, the client accesses the block storage device lunmask associated with the logical target through the logical target. It is particularly important to point out that in each logical target, when the service name is specified, the mapping of the service name to the logical name is included. When the service name is not specified, the logical name has a mapping relationship with the client and the volume lun alone. The model diagram is as follows Figure 1 shown.

[0053] Specifically, in an embodiment of the present application, the distributed storage system includes a server, a SCSI gateway and a storage cluster; the server persistently stores the mapping relationship between the service name and the logical name of the renamed logical target in the metadata mapping table of the storage cluster;

[0054] The server notifies the SCSI gateway to reload the metadata mapping table based on a subscription notification mechanism;

[0055] The SCSI gateway loads the metadata mapping table based on the subscription notification mechanism, and updates the mapping relationship between the service name and the logical name based on the metadata mapping table;

[0056] The SCSI gateway provides an access interface for the client based on the mapping relationship between the service name and the logical name, and when exposing the logical target, if the service name of the logical target has been set, the service name of the logical target is exposed externally, otherwise the logical name of the logical target is exposed;

[0057] The client initiates an access request to the SCSI gateway through the access interface;

[0058] If the service name of the logical target corresponding to the access request has been set, the SCSI gateway converts the service name of the access request into a corresponding first actual logical name based on the mapping relationship between the service name and the logical name of the logical target;

[0059] If the service name of the logical target corresponding to the access request is not set, the SCSI gateway uses the logical name of the logical target as the second actual logical name of the access request;

[0060] The client accesses the volume associated with the logical target according to the first actual logical name or the second actual logical name.

[0061] To sum up: when the service name of the logical target is not set, the storage client scans to obtain the logical name and uses the logical name to access the block storage device; when the service name of the logical target is set, the storage client scans to obtain the service name and uses the service name to access the block storage device. The storage cluster still uses the logical name to establish a mapping relationship with the block storage device and the SCSI gateway. Therefore, the mutual conversion interface between the service name and the logical name needs to be implemented in the SCSI gateway to ensure the correct interaction between the storage cluster and the storage client. Figure 1 After simplification, we get Figure 2 The simplified lunmask model diagram shown.

[0062] Figure 3 The hardware structure of the server is schematically shown, such as Figure 3 As shown, the server includes a memory 11 and a processor 12, and the processor 12 is connected to the memory 11. Those skilled in the art can understand that Figure 1 The structure shown does not constitute a limitation on the server, and the distributed storage system may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently.

[0063] Among them, the memory 11, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 11 may include a program storage area and a data storage area, wherein the program storage area can store an operating instruction system, an application required for at least one function; the data storage area can store data created according to the use of a distributed storage system, etc. In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 11 may optionally include a memory remotely arranged relative to the processor 12, and these remote memories may be connected to the server 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.

[0064] The processor 12 is the control center of the server, and uses various interfaces and lines to connect various parts of the entire server. By running or executing software programs and / or modules stored in the memory 11, and calling data stored in the memory 11, it executes various functions of the server and processes data, thereby monitoring the server as a whole, such as implementing the target renaming method based on the distributed storage system described in any embodiment of the present application.

[0065] The processor 12 may be one or more, Figure 1 A processor 12 is taken as an example. The processor 12 and the memory 11 may be connected via a bus or other means. Figure 1 In the example, the connection through the bus is taken. The processor 12 may include a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a controller, a field programmable gate array (FPGA) device, etc. The processor 12 may also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors combined with a DSP core, or any other such configuration.

[0066] The target device renaming method and device based on the distributed storage system provided in the embodiments of the present application can be executed by the server. Specifically, in some embodiments, the method can be executed by the processor 12.

[0067] Figure 4 A flow chart of a target device renaming method based on a distributed storage system provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the method includes:

[0068] 401: When receiving a renaming operation instruction for a logical target, obtaining the original logical name and target service name of the logical target to be renamed.

[0069] When the customer wants to modify the name of the logical target without changing the business scenario, the customer renames the logical target that he wants to rename on the client. The client sends the logical target renaming operation instruction through the configuration tool. At this time, the distributed storage system receives the renaming operation instruction for the logical target, and then obtains the original logical name and target logical name of the logical target to be renamed.

[0070] In order to persist the information of the logical target, such as Figure 2 As shown, in the logical target, the logical name and service name are recorded as the attributes of a logical target. Therefore, when renaming, it is necessary to obtain the original logical name of the logical target to be renamed, and obtain the original logical name of the logical target to be renamed, and obtain the target service name that the user wants to rename.

[0071] 402: If it is found in the metadata mapping table of the distributed storage system according to the original logical name that the logical target is a created target, then the legitimacy of the target service name is verified.

[0072] After obtaining the original logical name of the logical target to be renamed, query whether the logical target to be renamed is a created target in the metadata mapping table of the distributed storage system according to the original logical name. If so, verify the legitimacy of the target service name.

[0073] It is understandable that since the renaming operation is mainly for the logical target that has been successfully created, the renaming operation cannot be performed on the logical target that has not been successfully created.

[0074] When verifying the legitimacy of the target service name, it is also verified through the configuration tool. The legitimacy mainly verifies whether the target service name complies with the naming rules of the service name and whether it conflicts with the service names of other logical targets.

[0075] 403: When the validity verification of the target service name passes, if the original service name exists in the logical target, the mapping relationship between the original service name and the original logical name in the logical target is deleted, and a mapping relationship between the target service name and the target logical name is added.

[0076] Specifically, when the legitimacy verification of the target service name passes, since there is a situation where the service name is not set when the logical target is created, it will be determined whether the original service name exists in the logical target, that is, whether the service name is set in the logical target to be renamed. If the original service name exists in the logical target, it means that there is a mapping relationship between the original service name and the original logical name in the logical target to be renamed. At this time, it is necessary to delete the mapping relationship between the original service name and the original logical name in the logical target, and add a mapping relationship between the target service name and the target logical name, and persist it in the metadata mapping table of the storage cluster.

[0077] Correspondingly, when the validity verification of the target service name passes, if the original service name does not exist in the logical target, the attributes of the target service name are set, and a mapping relationship between the target service name and the target logical name is added.

[0078] More specifically, the configuration tool rbdtool directly calls the logical target renaming interface provided by the cluster to complete the setting of the logical target service name and update the metadata mapping table maintained in the cluster. When renaming, in the TARGETS.NODES.MAP.LIST object, the logical target information to be renamed is queried with the logical name as the key, the service name field attribute is updated, and then the logical name is used as the key and the updated information as the value to overwrite and write; then the service name and the logical name are used as the key and the logical name as the value to record the mapping information of the service name and the logical name, that is, stored in the TARGETS.NODES.MAP.LIST object. If the service name in the original logical target information is not empty, the mapping relationship between the original service name and the logical name also needs to be deleted.

[0079] 404: After the save is successful, based on the subscription notification mechanism, the SCSI gateway is notified to reload the metadata mapping table, and the mapping relationship between the target service name and the target logical name is updated based on the latest metadata mapping table.

[0080] Specifically, after successfully saving the metadata mapping table in the storage cluster, the configuration tool pushes the information of the logical target through notify. Based on the subscription notification mechanism, the server informs the SCSI gateway. After receiving the notify message, the SCSI gateway reloads the metadata mapping table and updates the mapping relationship between the target service name and the target logical name based on the latest metadata mapping table.

[0081] In the storage cluster, the logical name of the logical target is still used to establish mapping relationships with the storage client, block storage device, and SCSI gateway. In addition, when the SCSI gateway exposes the logical target, if the service name of the logical target is set, the service name is exposed; otherwise, the logical name is exposed, such as Figure 2 As shown, Figure 2 This is a simplified model diagram of lunmask. In tgtnode2, there is a situation where the service name is not specified. At this time, the logical name 3 is directly exposed. After the SCSI gateway loads and exposes the updated logical target externally, the SCSI gateway is able to provide an access interface for the client.

[0082] Furthermore, based on the subscription notification mechanism, the SCSI gateway subscribes to the change notification of the logical target in the distributed storage system, that is, the SCSI gateway learns that the logical target to be renamed has completed the renaming operation and obtains the target logical name of the logical target after the renaming operation.

[0083] After the SCSI gateway provides an access interface for the client, the client initiates a scan action to the SCSI gateway in an attempt to obtain a list of logical targets. After the client obtains the list of logical targets, the client can initiate an access request. If the access request initiated is to access the renamed logical target, then if the renamed logical target is assigned a service name, since the service name is exposed, the SCSI gateway converts the service name of the access request into the actual logical name of the renamed logical target. If the renamed logical target is not assigned a service name, since the logical name is exposed, the SCSI gateway uses the logical name of the access request as the actual logical name of the renamed logical target without the need for conversion.

[0084] Therefore, the client does not know whether the name of the logical target in the scan result is a service name or a logical name. When the client logs in, it can use the obtained logical target name to complete the login.

[0085] After the client obtains the target list, the client can access the volumes associated with the logical targets based on the logical targets.

[0086] In the embodiment of the present application, in the logical target, the logical name and the service name are recorded as an attribute of the logical target, and by adding the mapping between the logical name and the service name in the logical target, the logical name and the service name are saved in different mapping tables of the same object; and in the storage cluster, the logical name of the logical target is still used to establish a mapping relationship with the client, block storage client and SCSI gateway. When the logical target is renamed, it is actually the addition and modification of the mapping relationship between the logical name and the service name in the logical target, which only requires sending a write request to the underlying database, that is, only the database configuration operation is required for the mapping between the logical name and the service name of an object, which ensures the consistency of the data and effectively improves the renaming efficiency.

[0087] In some of these embodiments, a logical target may also be created, so that, for example Figure 5 As shown, the method may also include:

[0088] 501: when receiving a logical target creation operation instruction, determining a logical name of a logical target to be created and a SCSI gateway associated with the logical target to be created, and determining whether the logical target to be created has been created;

[0089] 502: If the logical target to be created has not been created, verify whether the service name to be created is specified in the logical target to be created;

[0090] 503: if the service name to be created is specified in the logical target to be created, verify whether the service name to be created conflicts with the logical name and service name of the already created logical target;

[0091] 504: when the service name to be created does not conflict with the logical name and service name of the created logical target, determine that the service name to be created is legal, and create a first logical target based on the service name to be created and the logical name to be created, wherein the first logical target records a mapping relationship between the service name to be created and the logical name to be created, and records a mapping relationship between the service name to be created and the SCSI gateway associated with the logical target to be created;

[0092] 505: Based on the subscription notification mechanism, notify the SCSI gateway associated with the to-be-created logical target of the service name of the first logical target, so that when the SCSI gateway exposes the first logical target, the service name of the first logical target is exposed.

[0093] Specifically, when creating, it will be verified whether the service name to be created conflicts with the logical name and service name of the already created logical target. If there is no conflict, the service name to be created is determined to be legal; if there is a conflict, it can be prompted to modify the service name to be created. When the service name to be created is legal, the first logical target is created directly based on the service name to be created and the logical name to be created. At the same time, the mapping relationship between the service name to be created and the logical name to be created is recorded in the first logical target, and the mapping relationship between the service name to be created and the SCSI gateway associated with the logical target to be created is recorded.

[0094] In some embodiments, after step 502, the method may further include:

[0095] If the service name to be created is not specified in the logical target to be created, verify whether the logical name of the logical target to be created conflicts with the logical name and service name of the created logical target;

[0096] When the logical name of the to-be-created logical target does not conflict with the logical name and service name of the created logical target, creating a second logical target based on the logical name of the to-be-created logical target;

[0097] Based on the subscription notification mechanism, the SCSI gateway associated with the to-be-created logical target is notified of the logical name of the second logical target, so that when the SCSI gateway exposes the second logical target, the logical name of the second logical target is exposed.

[0098] Correspondingly, when the service name to be created is not specified in the logical target to be created, the second logical target is directly created, and there is no mapping relationship between the service name and the logical name in the second logical target. Then, when notifying the SCSI gateway associated with the logical target to be created, it is sufficient to send a message notification, that is: when the service name is not specified, the service name obtained by the SCSI gateway associated with the logical target to be created is an empty string; correspondingly, if the service name is specified, the service name obtained by the SCSI gateway is the actual service name, and when the SCSI gateway associated with the logical target to be created exposes the target, if the service name is an empty string, the logical name is exposed, and if the service name is the actual service name, the actual service name is exposed.

[0099] Furthermore, the client sends a creation operation instruction of the logical target through the configuration tool. In the creation operation instruction, the logical name of the logical target to be created, at least one access gateway information and the service name of the optional logical target must be specified.

[0100] In the process of creating a logical target, the configuration tool directly calls the logical target creation interface provided by the storage cluster cluster to complete the creation of the logical target, and writes the logical target information to the TARGETS.NODES.MAP.LIST object (key is the logical name of the logical target, value is the logical name of the logical target, the service name of the logical target (if not specified, the field value is empty), read-write properties, type, creation time, access node); and assigns an id to this logical target, and writes the logical target information to the node.targets.list object (key is the logical name of the logical target, value is id, read-write properties, type); after the metadata is updated, the configuration tool pushes the information of the created logical target to the SCSI gateway associated with the logical target to be created through the subscription notification mechanism. After receiving the notiyf message, the SCSI gateway reloads the metadata mapping table and updates the corresponding volume mapping relationship based on the latest metadata mapping table.

[0101] The user can also query the logical target. In some embodiments, such as Figure 6 As shown, the method may also include:

[0102] 601: when receiving a query operation instruction of a logical target, obtaining a list of created logical targets;

[0103] 602: Return each queryable target in the logical target list and the attributes of the queryable target. If a service name is specified in the queryable target, the service name attribute of the queryable target is displayed as the service name. If a service name is not specified in the queryable target, the service name attribute of the queryable target is displayed as empty.

[0104] When querying, when the user queries the logical target, the server will return all the logical targets that have been created and obtain a list of logical targets. The user can click on each logical target in the list, and the server will return the logical target and its various properties, as shown in Table 1 below.

[0105]

[0106]

[0107] Table 1

[0108] Obviously, since the logical target has a new service name attribute, the service name attribute will also be returned when it is queried, and other attributes will also be returned, including the creation timestamp attribute, read-write attribute, and type attribute. ISCSI / FC are two protocol attributes. In addition, in the logical target, if the service name is specified in the logical target to be queried, the service name will be returned. For example, the name corresponding to the service name attribute in logical target 1 is B.

[0109] Correspondingly, when the service name in the logical target to be queried is not set, the query result with the service name to be queried being empty is returned, that is, the value of the relevant service name field in the echo is empty, such as the service name in the logical target 4 is echoed <blank line>.

[0110] The user can also delete the created logical target. In some embodiments, such as Figure 7 As shown, the method may also include:

[0111] 701: when receiving a deletion operation instruction for deleting a logical target, obtaining a to-be-deleted logical name of the to-be-deleted logical target corresponding to the deletion operation instruction;

[0112] 702: According to the to-be-deleted logical name, query in the metadata mapping table whether the to-be-deleted logical target is a created target, and query whether the to-be-deleted logical target has a mapping relationship with a volume and whether the to-be-deleted logical target has a mapping relationship with a client;

[0113] 703: If the logical target to be deleted is a created target, and there is a mapping relationship between the logical target to be deleted and a volume and / or there is a mapping relationship between the logical target to be deleted and a client, it is prompted that the deletion fails;

[0114] 704: If the logical target to be deleted is a created target, and there is no mapping relationship between the logical target to be deleted and the volume, and there is no mapping relationship between the logical target to be deleted and the client, then determine whether there is a service name to be deleted in the logical target to be deleted;

[0115] 705: If there is a service name to be deleted, deleting the logical name to be deleted, the service name to be deleted, the mapping relationship between the logical name to be deleted and the service name to be deleted, and the target information of the logical target to be deleted from the metadata mapping table;

[0116] 706: If the service name to be deleted does not exist, deleting the logical name to be deleted of the logical target to be deleted and the target information of the logical target to be deleted in the metadata mapping table;

[0117] 707: Based on the subscription notification mechanism, notify the SCSI gateway associated with the to-be-deleted logical target to reload the metadata mapping table.

[0118] Specifically, since the logical target has a new service name attribute, and the mapping between the service name and the logical name is added in the TARGETS.NODES.MAP.LIST object, when deleting the logical target, it is also necessary to delete the mapping between the service name and the logical name. Therefore, when receiving a deletion operation instruction to delete the logical target, if the logical target to be deleted is a created target, there is no mapping relationship between the logical target to be deleted and the volume, and there is no mapping relationship between the logical target to be deleted and the client, then it is determined whether there is a service name to be deleted in the logical target to be deleted. If it exists, a query is initiated in the metadata mapping table TARGETS.NODES.MAP.LIST object with the logical name to be deleted as the key and the service name to be deleted is obtained, and the logical name to be deleted, the service name to be deleted, the mapping relationship between the logical name to be deleted and the service name to be deleted, and the target information of the logical target to be deleted are deleted, that is, the keys of the logical name and the service name are deleted respectively; and the information about the logical target in the node.targets.list object will also be deleted.

[0119] If the service name to be deleted does not exist, the logical name to be deleted of the logical target to be deleted and the target information of the logical target to be deleted are deleted in the metadata mapping table. That is, when the service name in the logical target to be deleted is empty, there is no need to delete the mapping relationship between the logical name to be deleted and the service name to be deleted. The deletion operation can be completed by directly deleting the logical name to be deleted of the logical target to be deleted and the target information of the logical target to be deleted.

[0120] And, correspondingly, if there is a mapping relationship between the to-be-deleted logical target and the volume and / or there is a mapping relationship between the to-be-deleted logical target and the client, it is prompted that the deletion fails.

[0121] After the deletion operation is completed, based on the subscription notification mechanism, the SCSI gateway associated with the to-be-deleted logical target is notified to reload the metadata mapping table.

[0122] After the metadata is updated, the configuration tool rbdtool pushes the logical target information to the SCSI gateway (ie, tgt) through notify. After receiving the notify message, tgt reloads the metadata mapping table and updates the corresponding volume mapping relationship based on the latest metadata mapping table.

[0123] Correspondingly, such as Figure 8As shown, the embodiment of the present application also provides a target renaming device based on a distributed storage system, which can be applied to a distributed storage system, such as Figure 1 The distributed storage system shown, the target renaming device 800 based on the distributed storage system includes:

[0124] The renaming operation receiving module 801 is used to obtain the original logical name and target service name of the logical target to be renamed when receiving a renaming operation instruction for the logical target;

[0125] A legality verification module 802 is used to verify the legality of the target service name if the logical target is found to be a created target in the metadata mapping table of the distributed storage system according to the original logical name;

[0126] The renaming module 803 is used for deleting the mapping relationship between the original service name and the original logical name in the logical target device when the validity verification of the target service name passes, if the original service name exists in the logical target device, and adding a mapping relationship between the target service name and the target logical name, and persisting it in the metadata mapping table of the storage cluster;

[0127] The notification module 804 is used to notify the SCSI gateway to reload the metadata mapping table based on the subscription notification mechanism after the save is successful, and to update the mapping relationship between the target service name and the target logical name based on the latest metadata mapping table.

[0128] In the embodiment of the present application, in the logical target, the logical name and the service name are recorded as an attribute of the logical target, and by adding the mapping between the logical name and the service name in the logical target, the logical name and the service name are saved in different mapping tables of the same object; and in the storage cluster, the logical name of the logical target is still used to establish a mapping relationship with the client, block storage client and SCSI gateway. When the logical target is renamed, it is actually the addition and modification of the mapping relationship between the logical name and the service name in the logical target, which only requires sending a write request to the underlying database, that is, only the database configuration operation is required for the mapping between the logical name and the service name of an object, which ensures the consistency of the data and effectively improves the renaming efficiency.

[0129] In some embodiments, the renaming module 803 is further configured to:

[0130] When the validity verification of the target service name passes, if the original service name does not exist in the logical target, the attribute of the target service name is set, and a mapping relationship between the target service name and the target logical name is added.

[0131] In some embodiments, Fig. 9 As shown, the target renaming device 800 based on the distributed storage system further includes an access module 805, which is used to:

[0132] The SCSI gateway provides an access interface for the client based on the mapping relationship between the target service name and the target logical name. The access interface is used to receive an access request from the client. If the renamed logical target exposes a service name, the service name of the access request is converted into an actual logical name of the renamed logical target. If the renamed logical target exposes a logical name, the logical name of the access request is converted into an actual logical name of the renamed logical target, and the volume associated with the renamed logical target is accessed according to the actual logical name.

[0133] In some embodiments, the target renaming device 800 based on the distributed storage system further includes a creation module 806 for:

[0134] When receiving a logical target creation operation instruction, determining a logical name of the logical target to be created and a SCSI gateway associated with the logical target to be created, and determining whether the logical target to be created has been created;

[0135] If the logical target to be created has not been created, verifying whether the service name to be created is specified in the logical target to be created;

[0136] If the service name to be created is specified in the logical target to be created, verify whether the service name to be created conflicts with the logical name and service name of the already created logical target;

[0137] When the service name to be created does not conflict with the logical name and service name of the created logical target, determine that the service name to be created is legal, and create a first logical target based on the service name to be created and the logical name to be created, wherein the first logical target records the mapping relationship between the service name to be created and the logical name to be created, and records the mapping relationship between the service name to be created and the SCSI gateway associated with the logical target to be created;

[0138] Based on the subscription notification mechanism, the SCSI gateway associated with the logical target to be created is notified of the service name of the first logical target, so that when the SCSI gateway exposes the first logical target, the service name of the first logical target is exposed.

[0139] In some embodiments, the creation module 806 is further configured to:

[0140] If the service name to be created is not specified in the logical target to be created, verify whether the logical name of the logical target to be created conflicts with the logical name and service name of the created logical target;

[0141] When the logical name of the to-be-created logical target does not conflict with the logical name and service name of the created logical target, creating a second logical target based on the logical name of the to-be-created logical target;

[0142] Based on the subscription notification mechanism, the SCSI gateway associated with the to-be-created logical target is notified of the logical name of the second logical target, so that when the SCSI gateway exposes the second logical target, the logical name of the second logical target is exposed.

[0143] In some embodiments, the apparatus 800 further includes a query module 807, further configured to:

[0144] When receiving a query operation instruction of a logical target, obtaining a list of created logical targets;

[0145] Returns each queryable target and the attributes of the queryable target in the logical target list. If a service name is specified in the queryable target, the service name attribute of the queryable target is displayed as the service name; if a service name is not specified in the queryable target, the service name attribute of the queryable target is displayed as empty.

[0146] In some embodiments, the apparatus 800 further includes a deletion module 808, configured to:

[0147] When receiving a delete operation instruction for a logical target, obtaining a logical name of the logical target to be deleted;

[0148] According to the logical name of the to-be-deleted logical target, query in the metadata mapping table whether the to-be-deleted logical target is a created target, and query whether the to-be-deleted logical target has a mapping relationship with a volume and whether the to-be-deleted logical target has a mapping relationship with a client;

[0149] If the logical target to be deleted is a created target, and there is a mapping relationship between the logical target to be deleted and the volume and / or there is a mapping relationship between the logical target to be deleted and the client, it is prompted that the deletion fails;

[0150] If the to-be-deleted logical target is a created target, there is no mapping relationship between the to-be-deleted logical target and the volume, and there is no mapping relationship between the to-be-deleted logical target and the client, then determine whether there is a to-be-deleted service name in the to-be-deleted logical target;

[0151] If there is a service name to be deleted, the logical name to be deleted, the service name to be deleted, the mapping relationship between the logical name to be deleted and the service name to be deleted, and the target information of the logical target to be deleted are deleted in the metadata mapping table;

[0152] If the service name to be deleted does not exist, deleting the logical name to be deleted of the logical target to be deleted and the target information of the logical target to be deleted in the metadata mapping table;

[0153] Based on the subscription notification mechanism, the SCSI gateway associated with the to-be-deleted logical target is notified to reload the metadata mapping table.

[0154] It should be noted that the above device has the functional modules and beneficial effects corresponding to the method. For technical details not fully described in the device embodiment, please refer to the method provided in the embodiment of this application.

[0155] The present application also provides a non-volatile computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, for example Figure 1 A processor 12 in the embodiment may enable the one or more processors to execute the target renaming method based on the distributed storage system in any of the above method embodiments, for example, executing the above described Figure 4 Steps 401 to 404 of the method, Figure 5 Steps 501 to 505 of the method, Figure 6 Steps 601 to 602 of the method, Figure 7 Steps 701 to 707 of the method; implementing Figure 8 Modules 801-804 in Fig. 9 The functions of modules 801-808 in.

[0156] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0157] Through the description of the above embodiments, a person of ordinary skill in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, or of course by hardware. A person of ordinary skill in the art can understand that all or part of the processes in the above embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may also be combined, the steps may be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they may still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A target renaming method based on a distributed storage system, characterized in that: The method comprises: When receiving a logical target creation operation instruction, determining a logical name of the logical target to be created and a SCSI gateway associated with the logical target to be created, and determining whether the logical target to be created has been created; If the logical target to be created has not been created, verifying whether the service name to be created is specified in the logical target to be created; If the service name to be created is specified in the logical target to be created, verify whether the service name to be created conflicts with the logical name and service name of the already created logical target; When the service name to be created does not conflict with the logical name and service name of the created logical target, determine that the service name to be created is legal, and create a first logical target based on the service name to be created and the logical name to be created, wherein the first logical target records the mapping relationship between the service name to be created and the logical name to be created, and records the mapping relationship between the service name to be created and the SCSI gateway associated with the logical target to be created; Based on a subscription notification mechanism, notifying the SCSI gateway associated with the to-be-created logical target of the service name of the first logical target, so that when the SCSI gateway exposes the first logical target, the service name of the first logical target is exposed; When receiving a rename operation instruction for a logical target, obtaining the original logical name and target service name of the logical target to be renamed; If the logical target is found to be a created target in the metadata mapping table of the distributed storage system according to the original logical name, then verify the legitimacy of the target service name; When the legitimacy verification of the target service name passes, if the original service name exists in the logical target, the mapping relationship between the original service name and the original logical name in the logical target is deleted, and a mapping relationship between the target service name and the target logical name is added, and is persistently stored in the metadata mapping table of the storage cluster; After the saving is successful, based on the subscription notification mechanism, the SCSI gateway is notified to reload the metadata mapping table, and the mapping relationship between the target service name and the target logical name is updated based on the latest metadata mapping table.

2. The target device renaming method based on a distributed storage system according to claim 1, characterized in that: The method further comprises: When the validity verification of the target service name passes, if the original service name does not exist in the logical target, the attribute of the target service name is set, and a mapping relationship between the target service name and the target logical name is added.

3. The target device renaming method based on a distributed storage system according to claim 1, characterized in that: After verifying whether the service name to be created is specified in the logical target to be created, the method further includes: If the service name to be created is not specified in the logical target to be created, verify whether the logical name of the logical target to be created conflicts with the logical name and service name of the created logical target; When the logical name of the to-be-created logical target does not conflict with the logical name and service name of the created logical target, creating a second logical target based on the logical name of the to-be-created logical target; Based on the subscription notification mechanism, the SCSI gateway associated with the to-be-created logical target is notified of the logical name of the second logical target, so that when the SCSI gateway exposes the second logical target, the logical name of the second logical target is exposed.

4. The target renaming method based on a distributed storage system according to claim 1, characterized in that: The method further comprises: When receiving a query operation instruction of a logical target, obtaining a list of created logical targets; Returns each queryable target and the attributes of the queryable target in the logical target list. If a service name is specified in the queryable target, the service name attribute of the queryable target is displayed as the service name; if a service name is not specified in the queryable target, the service name attribute of the queryable target is displayed as empty.

5. The target renaming method based on a distributed storage system according to claim 1, characterized in that: The method further comprises: When receiving a delete operation instruction for a logical target, obtaining a logical name of the logical target to be deleted; According to the logical name of the to-be-deleted logical target, query in the metadata mapping table whether the to-be-deleted logical target is a created target, and query whether the to-be-deleted logical target has a mapping relationship with a volume and whether the to-be-deleted logical target has a mapping relationship with a client; If the logical target to be deleted is a created target, and there is a mapping relationship between the logical target to be deleted and the volume and / or there is a mapping relationship between the logical target to be deleted and the client, it is prompted that the deletion fails; If the to-be-deleted logical target is a created target, there is no mapping relationship between the to-be-deleted logical target and the volume, and there is no mapping relationship between the to-be-deleted logical target and the client, then determine whether there is a to-be-deleted service name in the to-be-deleted logical target; If there is a service name to be deleted, the logical name to be deleted, the service name to be deleted, the mapping relationship between the logical name to be deleted and the service name to be deleted, and the target information of the logical target to be deleted are deleted in the metadata mapping table; If the service name to be deleted does not exist, deleting the logical name to be deleted of the logical target to be deleted and the target information of the logical target to be deleted in the metadata mapping table; Based on the subscription notification mechanism, the SCSI gateway associated with the to-be-deleted logical target is notified to reload the metadata mapping table.

6. A target renaming device based on a distributed storage system, characterized in that: The device comprises: A creation module, used for, when receiving a creation operation instruction of a logical target, determining a logical name of the logical target to be created and a SCSI gateway associated with the logical target to be created, and determining whether the logical target to be created has been created; If the logical target to be created has not been created, verifying whether the service name to be created is specified in the logical target to be created; If the service name to be created is specified in the logical target to be created, verify whether the service name to be created conflicts with the logical name and service name of the already created logical target; When the service name to be created does not conflict with the logical name and service name of the created logical target, determine that the service name to be created is legal, and create a first logical target based on the service name to be created and the logical name to be created, wherein the first logical target records the mapping relationship between the service name to be created and the logical name to be created, and records the mapping relationship between the service name to be created and the SCSI gateway associated with the logical target to be created; Based on a subscription notification mechanism, notifying the SCSI gateway associated with the to-be-created logical target of the service name of the first logical target, so that when the SCSI gateway exposes the first logical target, the service name of the first logical target is exposed; A renaming operation receiving module, used for obtaining the original logical name and target service name of the logical target to be renamed when receiving a renaming operation instruction for the logical target; A legitimacy verification module, used for verifying the legitimacy of the target service name if the logical target is found to be a created target in a metadata mapping table of a distributed storage system according to the original logical name; A renaming module, which is used to delete the mapping relationship between the original service name and the original logical name in the logical target device when the legitimacy verification of the target service name passes, if the original service name exists in the logical target device, and to add a mapping relationship between the target service name and the target logical name, and to persist the mapping relationship in the metadata mapping table of the storage cluster; The notification module is used to notify the SCSI gateway to reload the metadata mapping table based on the subscription notification mechanism after the save is successful, and to update the mapping relationship between the target service name and the target logical name based on the latest metadata mapping table.

7. A server, characterized in that: The server includes at least one processor and a memory, wherein the memory is communicatively connected to the at least one processor, and the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in any one of claims 1-5.

8. A distributed storage system, characterized in that: The distributed storage system comprises a server, a SCSI gateway and a storage cluster; the server is the server as claimed in claim 7; The server permanently stores the mapping relationship between the service name and the logical name of the renamed logical target in the metadata mapping table of the storage cluster; The server notifies the SCSI gateway to reload the metadata mapping table based on a subscription notification mechanism; The SCSI gateway loads the metadata mapping table based on the subscription notification mechanism, and updates the mapping relationship between the service name and the logical name based on the metadata mapping table; The SCSI gateway provides an access interface for the client based on the mapping relationship between the service name and the logical name, and when exposing the logical target, if the service name of the logical target has been set, the service name of the logical target is exposed externally, otherwise the logical name of the logical target is exposed; The client initiates an access request to the SCSI gateway through the access interface; If the service name of the logical target corresponding to the access request has been set, the SCSI gateway converts the service name of the access request into a corresponding first actual logical name based on the mapping relationship between the service name and the logical name of the logical target; If the service name of the logical target corresponding to the access request is not set, the SCSI gateway uses the logical name of the logical target as the second actual logical name of the access request; The client accesses the volume associated with the logical target according to the first actual logical name or the second actual logical name.

9. A non-volatile computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by the server, the server executes the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Distributed file system and method for visiting data resource in distributed system

    CN102833287A

  • Renaming method, access method and device

    CN106484820A