A rbd-nbd mapping method and device
By creating an independent rbd-nbd process in the rbd-nbd mapping mode, the problem of POD being unable to read or write nbd devices due to unexpected crashes or upgrade restarts of the ceph-csi nodeplugin container was solved, thus achieving reliable hot upgrades.
Patent Information
- Application Number
- CN202210856680.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-07-20
AI Technical Summary
In rbd-nbd mapping mode, the ceph-csi nodeplugin container crashes unexpectedly or restarts after an upgrade, causing the POD to be unable to read and write the nbd device normally.
Hot upgrades are achieved by creating a separate rbd-nbd process outside the first device, ensuring that the process is unaffected when the container storage interface plugin or the first device malfunctions or restarts.
This ensures that PODs for reading/writing NBD devices can still function normally when the container storage interface plugin malfunctions or restarts, thus resolving the issue of hot upgrades.
Smart Images

Figure CN115291998B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to an RBD-NBD mapping method and device. Background Art
[0002] The Ceph Distributed File System (Ceph) is a unified, distributed storage system with excellent performance, reliability, and scalability. While fully leveraging the storage system's inherent computing power, Ceph eliminates reliance on a single central node, achieving a truly decentralized architecture. The Ceph Distributed File System Container Storage Interface (Ceph-CSI) is a Container Storage Interface (CSI) plug-in that provides Ceph block and file storage to open source container orchestration systems (such as Kubernetes and K8s). It enables interaction between container storage orchestration and Ceph clusters, allocating storage space within the Ceph storage cluster to container applications.
[0003] Ceph block storage can be mapped using either the kernel reliable autonomic distributed object store block device (krbd) or the user-mode reliable autonomic distributed object store block device-network block device (rbd-nbd). Rbd-nbd offers two advantages over krbd mapping: First, it's easier to upgrade, requiring no kernel upgrades or host reboots. Second, it's more comprehensive, including features like rbd cache, Quality of Service (QoS), and persistent write-back cache, which krbd lacks. However, rbd-nbd mapping also has a huge flaw: after the distributed file system container storage interface plug-in (ceph-csi no deplugin) container crashes unexpectedly or is restarted after an upgrade, all rbd-nbd processes in the ceph-csi nodeplugin container will disappear, causing the nbd devices mapped by rbd-nbd to be unable to read / write. Containers that require persistent volumes for read / write nbd devices (for example, PODs) will be unable to read and write data normally (IO hang). Summary of the Invention
[0004] The present invention provides an rbd-nbd mapping method and device, which are used to solve the problem that a POD cannot normally read / write an nbd device after a ceph-csi nodeplugin container unexpectedly crashes or is upgraded and restarted, that is, a hot upgrade cannot be performed in the rbd-nbd mapping mode.
[0005] In a first aspect, an embodiment of the present invention provides an RBD-NBD mapping method, including:
[0006] The first device obtains mapping information from the container storage interface plug-in, wherein the mapping information is used to request the creation of the rbd-nbd process;
[0007] The first device creates the rbd-nbd process according to the mapping information, and the rbd-nbd process runs outside the first device.
[0008] In the above technical solution, the independent rbd-nbd process created by the first device can ensure that no matter whether the container storage interface plug-in or the first device has an abnormality or restart, it will not affect the already running rbd-nbd process, and the POD that reads / writes the nbd device will not be affected, which solves the problem that the ceph-csi nodeplugin cannot be hot-upgraded in the rbd-nbd mapping mode.
[0009] Optionally, the rbd-nbd process runs on a host machine, and the host machine has an rbd-nbd operating environment.
[0010] Optionally, the rbd-nbd process runs in a first container, and the first container has an rbd-nbd operating environment.
[0011] Optionally, the first device obtains mapping information from the container storage interface plug-in, including: the first device monitors the mapping information received by the container storage interface plug-in.
[0012] In a second aspect, an embodiment of the present invention provides an RBD-NBD mapping device, including:
[0013] A transceiver unit, configured to obtain mapping information from a container storage interface plug-in, wherein the mapping information is used to request the creation of an rbd-nbd process;
[0014] A processing unit is configured to create the rbd-nbd process from the transceiver unit according to the mapping information, wherein the rbd-nbd process runs outside the transceiver unit.
[0015] In the above technical solution, the rbd-nbd mapping device creates an independent rbd-nbd process outside the transceiver unit, so that no matter whether the container storage interface plug-in or the transceiver unit has an abnormality or restarts, it will not affect the already running rbd-nbd process, and the POD that reads / writes the nbd device will not be affected. This solves the problem that the ceph-csi nodeplugin cannot be hot-upgraded in the rbd-nbd mapping mode.
[0016] Optionally, the rbd-nbd process runs on a host machine, and the host machine has an rbd-nbd operating environment.
[0017] Optionally, the rbd-nbd process runs in a first container, and the first container has an rbd-nbd operating environment.
[0018] Optionally, the transceiver unit is configured to monitor the mapping information received by the container storage interface plug-in when acquiring the mapping information from the container storage interface plug-in.
[0019] In a third aspect, the present application further provides an apparatus. The apparatus can execute the above-described method design. The apparatus can be a chip or circuit capable of executing the functions corresponding to the above-described method, or a device including the chip or circuit.
[0020] In one possible implementation, the apparatus includes: a memory for storing computer-executable program code; and a processor coupled to the memory. The program code stored in the memory includes instructions that, when executed by the processor, cause the apparatus or a device equipped with the apparatus to perform any of the methods described above.
[0021] The device may further include a communication interface, which may be a transceiver, or, if the device is a chip or a circuit, the communication interface may be an input / output interface of the chip, such as an input / output pin.
[0022] In one possible design, the device includes corresponding functional units for implementing the steps in the above method. The functions can be implemented by hardware or by hardware executing corresponding software implementations. The hardware or software includes one or more units corresponding to the above functions.
[0023] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a device, it executes the method in any one of the possible designs described above.
[0024] In addition, the technical effects brought about by any implementation method in the third to fourth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a schematic diagram of the existing rbd-nbd mapping method in the present invention;
[0026] Figure 2 A flowchart of an RBD-NBD mapping method provided in an embodiment of the present invention;
[0027] Figure 3 A schematic diagram of an RBD-NBD mapping method provided in an embodiment of the present invention;
[0028] Figure 4 An apparatus 400 provided in an embodiment of the present invention;
[0029] Figure 5 The embodiment of the present invention further provides another apparatus 500 . DETAILED DESCRIPTION
[0030] To make the objectives, technical solutions, and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the embodiments described herein are merely some, rather than all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.
[0031] The application scenarios described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Persons skilled in the art will appreciate that as new application scenarios emerge, the technical solutions provided by the embodiments of the present invention will also be applicable to similar technical problems. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0032] Figure 1 This is a schematic diagram of the existing rbd-nbd mapping method, such as Figure 1 The storage system shown includes a host machine and a storage cluster, wherein the host machine includes user state, nbd device and kernel state.
[0033] The specific steps for creating an nbd device using the current rbd-nbd mapping method are:
[0034] First, the distributed file system container storage interface plug-in (ceph-csi nodeplugin) container in user mode receives the mapping information transmitted by the caller. Since the ceph-csi nodeplugin container does not have the ability to create independent processes, it creates the rbd-nbd process inside its container. For example, Figure 1 The rbd-nbd processes in the kernel are rbd-nbd0 and rbd-nbd1 respectively. Then the rbd-nbd process calls the nbd module (nbd.ko) in the kernel state, and finally maps the nbd device through the Virtual File System interface (VFS interface) in the kernel state. For example, Figure 1 As shown in the figure, the nbd device corresponding to rbd-nbd0 is / dev / nbd0, and the nbd device corresponding to rbd-nbd1 is / dev / nbd1.
[0035] After creating an nbd device, the POD can access the nbd device and perform read / write operations on it. Since the nbd device is a mapped virtual device, its actual storage space is located in the storage cluster. Therefore, all read and write requests to the nbd device are forwarded to the storage cluster through the rbd-nbd process.
[0036] Specifically, the process for POD to access the nbd device and read / write the nbd device is as follows:
[0037] Pod1 accesses the nbd device / dev / nbd0 and initiates a read / write operation. The nbd device forwards the information to the nbd module in the kernel state through the virtual file system conversion interface in the kernel state. The nbd module then forwards the information to the rbd-nbd process rbd-nbd0. After the rbd-nbd0 process obtains the corresponding data from the storage cluster, it passes through the rbd-nbd process rbd-nbd0, the nbd module in the kernel state, the virtual file system conversion interface in the kernel state, and the nbd device / dev / nbd0 in sequence, and finally the data is returned to pod1.
[0038] Pod2 accesses the nbd device / dev / nbd1 and initiates read / write operations. You can refer to the above process and will not repeat it here.
[0039] Once the ceph-csi nodeplugin container crashes unexpectedly or is restarted due to an upgrade, the rbd-nbd process inside the container will disappear, and the corresponding nbd device will also be affected, making the POD unable to perform read / write operations on the nbd device.
[0040] Based on this, the present application provides an rbd-nbd mapping method for solving the problem that the POD cannot read and write nbd devices normally due to an unexpected crash or upgrade restart of the ceph-csi nodeplugin container.
[0041] like Figure 2 As shown, the method includes:
[0042] Step 200: The first device obtains mapping information from the container storage interface plug-in, where the mapping information is used to request the creation of an rbd-nbd process.
[0043] For example, the first device may be a proxy server or other name, which is not limited in this application. Figure 3 The rbd-ndb map server in user mode; the container storage interface plug-in can be a ceph-csi nodeplugin container, for example, the container storage interface plug-in corresponds to Figure 3 A distributed file system container storage interface plug-in (ceph-csi nodeplugin) container in user mode, wherein the first device and the container storage interface plug-in are both run on the host machine, that is, deployed on the host machine.
[0044] In one possible design, when the first device obtains mapping information from the container storage interface plugin, the first device monitors the mapping information received by the container storage interface plugin. Specifically, the container storage interface plugin originally creates an rbd-nbd process, which only forwards the mapping information to the first device. The first device then waits for the mapping information forwarded by the plugin.
[0045] The mapping information may include attribute information such as the size of the nbd device.
[0046] Step 210: The first device creates an rbd-nbd process according to the mapping information. The rbd-nbd process runs outside the first device.
[0047] In one possible implementation, the rbd-nbd process runs on a host machine, and the host machine has an rbd-nbd runtime environment, such as Figure 3 shown.
[0048] Here, the host machine has the rbd-nbd running environment, which can be understood as the host machine has some dependency packages of rbd-nbd, which can meet the conditions for running the rbd-nbd process.
[0049] In another possible implementation, the rbd-nbd process runs in a first container, which includes the rbd-nbd runtime environment. This first container can also be referred to as a dedicated container or a container for running the rbd-nbd process. It should be understood that this first container is not the container storage interface plugin mentioned above, namely the ceph-csi nodeplugin container.
[0050] Here, the first container has the rbd-nbd operating environment. This means that the first container has some dependency packages of rbd-nbd and can meet the conditions for running the rbd-nbd process.
[0051] In addition, with the above Figure 1 The process shown is similar. After the first device creates the rbd-nbd process, the rbd-nbd process calls the nbd module in the kernel state and obtains the nbd device through the virtual file system conversion interface mapping in the kernel state. For example, Figure 3 In the example, the rbd-nbd processes are rbd-nbd0 and rbd-nbd1. The nbd device corresponding to rbd-nbd0 is / dev / nbd0, and the nbd device corresponding to rbd-nbd1 is / dev / nbd1.
[0052] After the nbd device is created, POD accesses the nbd device and reads / writes to the nbd device. The specific process can be referred to the above related content and will not be repeated here.
[0053] At this time, since the rbd-nbd process is an independent process independent of the container storage interface plug-in and the first device, if the container storage interface plug-in or the first device encounters an abnormality or restarts, the already running rbd-nbd process will not be affected, thus supporting ceph-csi hot upgrade.
[0054] The division of units in the embodiments of the present invention is illustrative and represents only a logical functional division. In actual implementation, other divisions may be employed. Furthermore, the functional units in the various embodiments of the present invention may be integrated into a single processor, exist as separate physical units, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in either hardware or software functional units.
[0055] The embodiment of the present invention further provides a device 400, see Figure 4 As shown, it includes: a processing module 410 and a transceiver module 420.
[0056] The transceiver module 420 may include a receiving unit and a sending unit. The processing module 410 is used to control and manage the operation of the device 400. The transceiver module 420 is used to support communication between the device 400 and other devices. Optionally, the device 400 may also include a storage unit for storing program code and data of the device 400.
[0057] Optionally, each module in the apparatus 400 may be implemented by software.
[0058] Optionally, the processing module 410 can be a processor or a controller, for example, a general-purpose central processing unit (CPU), a general-purpose processor, a digital signal processing (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute the various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the embodiments of the present application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc. The transceiver module 420 can be a communication interface, a transceiver or a transceiver circuit, etc., wherein the communication interface is a general term. In a specific implementation, the communication interface can include multiple interfaces, and the storage unit can be a memory.
[0059] The processing module 410 calls the transceiver module 420 to execute:
[0060] Obtain mapping information from the container storage interface plug-in, wherein the mapping information is used to request the creation of the rbd-nbd process;
[0061] The rbd-nbd process is created according to the mapping information, and the rbd-nbd process runs outside the device 400.
[0062] The embodiment of the present invention also provides another device 500, see Figure 5 Shown, including:
[0063] Communication interface 501, memory 502 and processor 503;
[0064] The communication device 500 communicates with other devices through the communication interface 501, such as sending and receiving messages; the memory 502 is used to store program instructions; the processor 503 is used to call the program instructions stored in the memory 502 and execute the program according to the obtained method.
[0065] The processor 503 calls the program instructions stored in the communication interface 501 and the memory 502 to execute:
[0066] Obtain mapping information from the container storage interface plug-in, wherein the mapping information is used to request the creation of the rbd-nbd process;
[0067] The rbd-nbd process is created according to the mapping information, and the rbd-nbd process runs outside the device 500.
[0068] The embodiment of the present invention does not limit the specific connection medium between the communication interface 501, the memory 502 and the processor 503, such as a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0069] In the embodiments of the present invention, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field-programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention may be directly implemented and executed by a hardware processor, or by a combination of hardware and software modules within the processor.
[0070] In an embodiment of the present invention, the memory may be a non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or a volatile memory (volatile memory), such as a random-access memory (RAM). The memory may also be any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in an embodiment of the present invention may also be a circuit or any other device that can implement a storage function, for storing program instructions and / or data.
[0071] An embodiment of the present invention further provides a computer-readable storage medium, comprising program code. When the program code is run on a computer, the program code is used to enable the computer to execute the steps of the method provided in the embodiment of the present invention.
[0072] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0073] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0074] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0075] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0076] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0077] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A block device-network block device rbd-nbd mapping method, characterized in that: include: The first device obtains mapping information from the container storage interface plug-in, wherein the mapping information is used to request the creation of the rbd-nbd process; The first device creates the rbd-nbd process according to the mapping information, and the rbd-nbd process runs outside the first device.
2. The method according to claim 1, wherein The rbd-nbd process runs on a host machine, and the host machine has an rbd-nbd operating environment.
3. The method according to claim 1, wherein The rbd-nbd process runs in a first container, and the first container has an rbd-nbd operating environment.
4. The method according to any one of claims 1 to 3, wherein The first device obtains mapping information from the container storage interface plug-in, including: The first device monitors the mapping information received by the container storage interface plug-in.
5. An rbd-nbd mapping device, characterized in that: include: A transceiver unit, configured to obtain mapping information from a container storage interface plug-in, wherein the mapping information is used to request the creation of an rbd-nbd process; A processing unit is configured to create the rbd-nbd process from the transceiver unit according to the mapping information, wherein the rbd-nbd process runs outside the transceiver unit.
6. The device according to claim 5, characterized in that The rbd-nbd process runs on a host machine, and the host machine has an rbd-nbd operating environment.
7. The device according to claim 5, characterized in that The rbd-nbd process runs in a first container, and the first container has an rbd-nbd operating environment.
8. The device according to any one of claims 5 to 7, characterized in that The transceiver unit is configured to monitor the mapping information received by the container storage interface plug-in when acquiring the mapping information from the container storage interface plug-in.
9. An rbd-nbd mapping device, characterized in that: The device includes a processor and an interface circuit, wherein the interface circuit is used to receive signals from other devices outside the device and transmit them to the processor or send signals from the processor to other devices outside the device, and the processor is used to implement the method according to any one of claims 1 to 4 through logic circuits or executing code instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Information processing method and equipment and computer readable storage medium
CN109347896A
Container set abnormality processing method and device, storage medium and server
CN111176789A