A method, apparatus, device, and storage medium for managing block storage devices.
By receiving target requests, identifying device type fields, and invoking corresponding processes, unified management and scheduling of different types of disks are achieved, solving the problem of lack of unified management in existing technologies and improving the efficiency of cloud host queries and the ease of user operation.
Patent Information
- Application Number
- CN202210895923.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-27
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2042-07-27
AI Technical Summary
Existing technologies lack a unified management and scheduling scheme for different types of disks.
By receiving target requests, identifying the device type field, and invoking the corresponding storage block device mounting or unmounting process, unified management and scheduling of different types of disks can be achieved.
It enables unified management and scheduling of different types of disks, improves the efficiency of cloud host querying block devices, simplifies user operations, and reduces database access pressure.
Smart Images

Figure CN115185467B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for managing block storage devices. Background Technology
[0002] Currently, no technical solutions for managing storage block devices cover the unified management and scheduling of different types of disks. Therefore, how to provide a technical solution for the unified management and scheduling of different types of disks is a problem that needs to be solved in this field. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a storage block device management method, apparatus, device, and storage medium, capable of achieving unified management and scheduling of different types of disks. The specific solution is as follows:
[0004] In a first aspect, this application discloses a method for managing storage block devices, including:
[0005] Receive target requests for managing storage block devices to be processed;
[0006] The device type field in the request message body of the target request is identified, and the block device type of the storage block device to be processed is determined based on the device type field; the device type field is a field added in advance at the target position in the request message body to mark the storage block device type;
[0007] The receiving call request triggers the storage block device mounting process or storage block device unmounting process corresponding to the block device type.
[0008] The storage block device to be processed is mounted or unmounted according to the storage block device mounting process or the storage block device unmounting process.
[0009] Optionally, determining the block device type of the storage block device to be processed based on the device type field includes:
[0010] When the device type field is normal, the block device type of the storage block device to be processed is determined to be a normal storage block device type;
[0011] When the device type field is ISO, the block device type of the storage block device to be processed is determined to be a read-only optical disc type;
[0012] When the device type field is local, the block device type of the storage block device to be processed is determined to be a local disk type;
[0013] When the device type field is vhostuser, the block device type of the storage block device to be processed is determined to be an SPDK disk type.
[0014] Optionally, mounting the current storage block device to be processed according to the storage block device mounting process includes:
[0015] When the block device type is the ordinary storage block device type, the connection information of the storage backend is obtained, and the type of the storage backend is determined to obtain the storage backend type;
[0016] When the storage backend type is Ceph storage type, the corresponding connection operation is performed according to the RBD protocol and the connection information to obtain the mapping information of the block device to be processed, and the mapping information is used to mount the current storage block device to be processed.
[0017] When the storage backend type is centralized storage, a disk scan operation is performed based on the connection information to obtain the mapping information of the block device to be processed, and the mapping information is used to mount the current storage block device to be processed.
[0018] Optionally, mounting the current storage block device to be processed according to the storage block device mounting process includes:
[0019] When the block device type is the read-only optical disc type, the storage block device information of the storage block device to be processed is obtained from the glance service, and the storage block device information is used to mount the current storage block device to be processed.
[0020] Optionally, mounting the current storage block device to be processed according to the storage block device mounting process includes:
[0021] When the block device type is the local disk type, the disk letter device on the host machine is obtained, and the current storage block device to be processed is mounted according to the disk letter device.
[0022] Optionally, mounting the current storage block device to be processed according to the storage block device mounting process includes:
[0023] When the block device type is an SPDK disk, determine whether the SPDK service is deployed on the current node where the virtual machine is located;
[0024] If the current node has already deployed the SPDK service, then the SPDK service is used to convert the storage block device to be processed into a socket-type bdev device, and the bdev device is mounted.
[0025] If the SPDK service is not deployed on the current node, a corresponding error message will be returned.
[0026] Optionally, the storage block device management method further includes:
[0027] The storage block device information corresponding to the storage block device type is read from the block device data record table according to the received information query instruction, and the storage block device information is sent to the user interface for display; the block device data record table is a data table that records the block device information of each storage block device corresponding to each block device type.
[0028] Secondly, this application discloses a storage block device management apparatus, comprising:
[0029] The request receiving module is used to receive target requests for managing the storage block devices to be processed.
[0030] The field recognition module is used to identify the device type field in the request message body of the target request;
[0031] The device type determination module is used to determine the block device type of the storage block device to be processed based on the device type field; the device type field is a field added in advance at a target position in the request message body to mark the storage block device type;
[0032] The process invocation module is used to invoke the storage block device mounting process or storage block device unmounting process corresponding to the block device type according to the received invocation request;
[0033] A block device mounting or unmounting module is used to mount or unmount the storage block device to be processed according to the storage block device mounting process or the storage block device unmounting process.
[0034] Thirdly, this application discloses an electronic device, including:
[0035] Memory, used to store computer programs;
[0036] A processor is configured to execute the computer program to implement the steps of the aforementioned disclosed storage block device management method.
[0037] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the steps of the aforementioned disclosed storage block device management method.
[0038] As can be seen, this application provides a storage block device management method, including: receiving a target request to manage a storage block device to be processed; identifying the device type field in the request message body of the target request, and determining the block device type of the storage block device to be processed based on the device type field; the device type field is a field pre-added at a target position in the request message body to mark the storage block device type; invoking a storage block device mounting process or a storage block device unmounting process corresponding to the block device type according to the received call request; and mounting or unmounting the storage block device to be processed according to the storage block device mounting process or the storage block device unmounting process. Therefore, this application receives a target request to manage a storage block device to be processed, then identifies the device type field in the request message body of the target request, determines the block device type of the storage block device to be processed based on the device type field, and invoking a storage block device mounting process or a storage block device unmounting process corresponding to the block device type according to the received call request, thereby mounting or unmounting the device to be processed, thus enabling unified management and scheduling of different types of disks. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0040] Figure 1 This is a flowchart of a storage block device management method disclosed in this application;
[0041] Figure 2 This is a schematic diagram of disk mounting management disclosed in this application;
[0042] Figure 3 This is a schematic diagram of a disk unloading management method disclosed in this application;
[0043] Figure 4 This application discloses a specific method for managing storage block devices.
[0044] Figure 5 This application discloses a specific method for managing storage block devices.
[0045] Figure 6 This application discloses a specific method for managing storage block devices.
[0046] Figure 7 This application discloses a flowchart of various service interactions.
[0047] Figure 8 This application discloses a specific method for managing storage block devices.
[0048] Figure 9 This application discloses a specific method for managing storage block devices.
[0049] Figure 10 This application discloses a specific method for managing storage block devices.
[0050] Figure 11 This is a schematic diagram of the structure of a storage block device management device disclosed in this application;
[0051] Figure 12 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0052] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0053] Currently, existing technologies for managing storage block devices do not address the unified management and scheduling of different types of disks. Therefore, this application provides a storage block device management solution that enables unified management and scheduling of different types of disks.
[0054] This invention discloses a method for managing storage block devices, see [link to relevant documentation]. Figure 1 As shown, the method includes:
[0055] Step S11: Receive a target request to manage the storage block device to be processed.
[0056] In this embodiment, a target request for managing the storage block device to be processed is received. It should be noted that, in this embodiment, processing the storage block device can be achieved through the URL (Uniform Resource Locator) interface.
[0057] Step S12: Identify the device type field in the request message body of the target request, and determine the block device type of the storage block device to be processed based on the device type field; the device type field is a field added in advance at the target position in the request message body to mark the storage block device type.
[0058] In this embodiment, after receiving a target request to manage a storage block device, the device type field in the request message body of the target request can be identified, and the block device type of the storage block device to be managed can be determined based on the device type field. It is understood that the device type field is a field pre-added at the target location in the request message body to mark the storage block device type. That is, the block device type of the storage block device to be managed can be marked by setting the attach_dev_protocol field in the request message body of the target request. For example, to indicate the management of different types of storage block devices, the attach_dev_protocol field needs to be added to the API (Application Program Interface) request message body to mark the type of storage block device to be managed, and the storage block device to be managed is uniformly recorded in the BDM (Block_Device_Mapping) data table.
[0059] Step S13: Invoke the storage block device mounting process or storage block device unmounting process corresponding to the block device type according to the received call request.
[0060] In this embodiment, after determining the block device type of the storage block device to be processed based on the device type field, the storage block device mounting process or storage block device unmounting process corresponding to the block device type is invoked according to the received invocation request.
[0061] Step S14: Mount or unmount the storage block device to be processed according to the storage block device mounting process or the storage block device unmounting process.
[0062] In this embodiment, the storage block device mounting process or storage block device unmounting process corresponding to the block device type is invoked, and then the storage block device to be processed is mounted or unmounted according to the storage block device mounting process or the storage block device unmounting process. That is, for different storage block device types, the specific storage block device mounting or unmounting process can be performed on the node where the cloud host is located using the invoked storage block device mounting process or storage block device unmounting process corresponding to the block device type, achieving a unified management approach for various storage block devices. It should be noted that a cloud host can mount ordinary disks (i.e., ordinary cloud hard drives), as well as SPDK (Storage Performance Development Kit) storage disks, pass-through disks, and ISO (i.e., optical disc image files), etc., with the type of storage block device to be mounted indicated by fields in the request message body. SPDK, developed by Intel, is a storage performance development kit that provides a set of tools to enable scalable user-mode storage applications. It moves all necessary drivers to user space, avoiding system calls and enabling zero-copy access for applications. It also avoids latency issues caused by interrupts through hardware polling. Therefore, SPDK can provide highly parallel I / O (Input / Output) access mechanisms in application space through polling, asynchronous, and lock-free mechanisms. SPDK also provides support for NVMe-oF, iSCSI, and vhost servers to achieve high-performance storage. These features enable unified management of various storage block device interfaces, unifying management and form factors for easy deployment and user use on the OpenStack cloud platform. OpenStack is a cloud computing management platform project based on the OpenStack open-source platform, and is a combination of a series of open-source software projects. Figure 2 As shown, when a cloud host mounts a disk, it first generates a BDM data table and fills the BDM data table with the information of the storage block device to be mounted. This storage block device information may include storage block device type information: `attach_dev_protocol`. That is, by placing the storage block device information into a unified data table, the cloud host can reduce the number of database queries during startup, restart, cold migration, and hot migration processes, greatly alleviating database access pressure and improving business-level execution efficiency. Simultaneously, it unifies and streamlines the hot addition and unloading of storage block devices at the architecture level. After completing the construction of the BDM data table, an RPC (Remote Procedure Call) cast request is sent to the compute service of the node where the cloud host resides to begin the specific block device mounting process. Figure 3 As shown, when a cloud host unloads a disk, it first determines the disk type. If it's a regular disk, it unloads according to the normal disk unloading process. If it's an ISO, an empty ISO device is created to replace the current ISO device. If it's a passthrough disk, it's unloaded directly according to the passthrough disk unloading process. If it's an SPDK storage disk, it first checks if the SPDK service exists on the current host. If it does, it unloads the current disk and calls the SPDK service to delete the corresponding bdev device. In other words, this embodiment provides a unified management approach, uniformly managing and scheduling regular disks, ISOs, passthrough disks, and SPDK storage disks; it implements a unified process and standard for cloud host mounting and unloading, and records the mounted storage devices in the BDM data table. Specific mounting and unloading processes are performed on the node where the cloud host resides for different disk types.
[0063] As can be seen, this application embodiment receives a target request for managing a storage block device to be processed, then identifies the device type field in the request message body of the target request, determines the block device type of the storage block device to be processed based on the device type field, and invokes the storage block device mounting process or storage block device unmounting process corresponding to the block device type according to the received call request, thereby performing mounting or unmounting processing on the device to be processed, thereby enabling unified management and scheduling of different types of disks.
[0064] See Figure 4 As shown, this embodiment of the invention discloses a specific method for managing storage block devices. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0065] Step S21: Receive a target request to manage the storage block device to be processed.
[0066] Step S22: Identify the device type field in the request message body of the target request, and determine the block device type of the storage block device to be processed based on the device type field; the device type field is a field added in advance at the target position in the request message body to mark the storage block device type.
[0067] Step S23: Read the storage block device information of the storage block device to be processed corresponding to the block device type from the block device data record table according to the received information query instruction, and send the storage block device information to the user interface for display; the block device data record table is a data table that records the block device information of each storage block device corresponding to each block device type.
[0068] In this embodiment, the block device type of the storage block device to be processed is determined based on the device type field. Then, according to the received information query instruction, the storage block device information of the storage block device to be processed corresponding to the block device type is read from the block device data record table, and the storage block device information is sent to the user interface for display. It can be understood that the block device data record table is a data table that records the block device information of each storage block device corresponding to each block device type. For example, when receiving an information query instruction from the UI (User Interface) to query the storage block device information currently managed by the cloud host, the BDM data table is read according to the information query instruction, and the attach_dev_protocol field is identified to display the specific block device information of different currently managed storage block device types. This improves the efficiency of the cloud host in querying block devices, and also makes it more convenient to query block devices when displaying the storage block device information on the UI interface. That is, this embodiment can query the BDM data table in the database through the UI interface to obtain the various storage device types owned by the cloud host, which is convenient for user operation and identification, greatly simplifying the user's learning and operation costs.
[0069] For details regarding steps S21 to S23, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0070] As can be seen, this application embodiment receives a target request for managing a storage block device to be processed, then identifies the device type field in the request message body of the target request, determines the block device type of the storage block device to be processed based on the device type field, reads the storage block device information of the storage block device to be processed corresponding to the block device type in the block device data record table according to the received information query instruction, and sends the storage block device information to the user interface for display, thereby improving the efficiency of cloud host querying block devices and enabling unified management and scheduling of different types of disks.
[0071] See Figure 5 As shown, this embodiment of the invention discloses a specific method for managing storage block devices. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0072] Step S31: Receive a target request to manage the storage block device to be processed.
[0073] Step S32: Identify the device type field in the request message body of the target request.
[0074] Step S33: When the device type field is normal, the block device type of the storage block device to be processed is determined to be a normal storage block device type.
[0075] In this embodiment, the device type field in the request message body of the target request is identified. When the identified device type field is "normal", the block device type of the storage block device to be processed is determined to be a normal storage block device type. It can be understood that setting the `attach_dev_protocol` field in the request message body of the target request to "normal" marks the block device type of the storage block device to be processed as a normal storage block device type.
[0076] Step S34: Invoke the storage block device mounting process corresponding to the block device type according to the received call request.
[0077] Step S35: Obtain the connection information of the storage backend according to the storage block device mounting process, and determine the type of the storage backend to obtain the storage backend type.
[0078] In this embodiment, the block device type of the storage block device to be processed is determined to be a normal storage block device type, and the storage block device mounting process corresponding to the normal storage block device type is called. In the storage block device mounting process, the connection information of the storage backend is first obtained, and the type of the storage backend is determined to obtain the storage backend type.
[0079] Step S36: When the storage backend type is Ceph storage type, perform the corresponding connection operation according to the RBD protocol and the connection information to obtain the mapping information of the block device to be processed, and use the mapping information to mount the current block device to be processed.
[0080] In this embodiment, when the storage backend is determined to be of Ceph storage type, the corresponding connection operation is performed according to the RBD protocol and the connection information to obtain the mapping information of the ordinary storage block device, and the mapping information is used to mount the current ordinary storage block device.
[0081] Step S37: When the storage backend type is centralized storage type, a disk scan operation is performed according to the connection information to obtain the mapping information of the block device to be processed, and the mapping information is used to mount the current storage block device to be processed.
[0082] In this embodiment, when it is determined that the type of the storage backend is centralized storage, a disk scan operation is performed based on the connection information to obtain the mapping information of the ordinary storage block device, and the mapping information is used to mount the current ordinary storage block device.
[0083] For example, such as Figure 6As shown, for ordinary disks, where the block device field `attach_dev_protocol=normal` is added to the API request message body, the connection information of the storage backend is obtained through Cinder, and the current storage backend type is determined. If it is Ceph storage, the connection is established according to the RBD (Rados Block Device) protocol; where RBD is a block storage protocol provided by Rados. If it is centralized storage, a disk scan operation is performed based on the connection information to obtain disk mapping information, and finally, the libvirt interface is called to mount the block device.
[0084] For details regarding steps S31 to S32 and S34, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0085] As can be seen, in this embodiment of the application, a target request for managing a storage block device to be processed is received, and then the device type field of the request message body in the target request is identified as normal. Based on the normal field, the block device type of the storage block device to be processed is determined to be a normal storage block device type. The storage block device mounting process corresponding to the normal storage block device type is invoked according to the received call request, and then the normal disk is mounted under the storage block device mounting process.
[0086] See Figure 7 As shown, this embodiment of the invention discloses a specific method for managing storage block devices. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0087] Step S41: Receive a target request to manage the storage block device to be processed.
[0088] Step S42: Identify the device type field in the request message body of the target request.
[0089] Step S43: When the device type field is ISO, the block device type of the storage block device to be processed is determined to be a read-only optical disc.
[0090] In this embodiment, the device type field in the request message body of the target request is identified. When the identified device type field is ISO, the block device type of the storage block device to be processed is determined to be a read-only optical disc type. It can be understood that setting the attach_dev_protocol field in the request message body of the target request to ISO marks the block device type of the storage block device to be processed as a read-only optical disc type.
[0091] Step S44: Invoke the storage block device mounting process corresponding to the block device type according to the received call request.
[0092] Step S45: Obtain the storage block device information of the storage block device to be processed from the glance service according to the storage block device mounting process, and mount the current storage block device to be processed using the storage block device information.
[0093] In this embodiment, the block device type of the storage block device to be processed is determined to be a read-only optical disc type, and the storage block device mounting process corresponding to this ordinary storage block device type is called. In this storage block device mounting process, the storage block device information of CDROM (Compact Disk Read Only Memory) is first obtained from the glance service, and the storage block device information is used to mount the current CDROM.
[0094] For details regarding steps S41 to S42 and S44, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0095] As can be seen, this embodiment of the application receives a target request to manage the storage block device to be processed, then identifies the device type field of the request message body in the target request as ISO, determines the block device type of the storage block device to be processed as read-only optical disc type based on the ISO, invokes the storage block device mounting process corresponding to the read-only optical disc type according to the received call request, and then performs CDROM mounting processing under the storage block device mounting process.
[0096] See Figure 8 As shown, this embodiment of the invention discloses a specific method for managing storage block devices. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0097] Step S51: Receive a target request to manage the storage block device to be processed.
[0098] Step S52: Identify the device type field in the request message body of the target request.
[0099] Step S53: When the device type field is local, the block device type of the storage block device to be processed is determined to be a local disk type.
[0100] In this embodiment, the device type field in the request message body of the target request is identified. When the identified device type field is "local", the block device type of the storage block device to be processed is determined to be a local disk type. It can be understood that setting the `attach_dev_protocol` field in the request message body of the target request to a local disk type marks the block device type of the storage block device to be processed as a local disk type.
[0101] Step S54: Invoke the storage block device mounting process corresponding to the block device type according to the received call request.
[0102] Step S55: Obtain the drive letter device on the host machine according to the storage block device mounting process, and mount the current storage block device to be processed according to the drive letter device.
[0103] In this embodiment, the block device type of the storage block device to be processed is determined to be a local disk type, and the storage block device mounting process corresponding to this local disk type is invoked. In this storage block device mounting process, the drive letter device on the host machine is directly obtained, and the local pass-through disk is mounted according to the drive letter device. For example, for the local pass-through disk type, the drive letter device on the host machine will be obtained to realize the mounting of the pass-through disk storage device.
[0104] For details regarding steps S51 to S52 and S54, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0105] As can be seen, in this embodiment of the application, a target request to manage the storage block device to be processed is received, and then the device type field of the request message body in the target request is identified as local. Based on local, the block device type of the storage block device to be processed is determined to be a local disk type. The storage block device mounting process corresponding to the local disk type is invoked according to the received call request, and then the local passthrough disk is mounted under the storage block device mounting process.
[0106] See Figure 9 As shown, this embodiment of the invention discloses a specific method for managing storage block devices. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
[0107] Step S61: Receive a target request to manage the storage block device to be processed.
[0108] Step S62: Identify the device type field in the request message body of the target request.
[0109] Step S63: When the device type field is vhostuser, the block device type of the storage block device to be processed is determined to be SPDK disk type.
[0110] In this embodiment, the device type field in the request message body of the target request is identified. When the identified device type field is vhostuser, the block device type of the storage block device to be processed is determined to be an SPDK disk type. It can be understood that setting the attach_dev_protocol field in the request message body of the target request to vhostuser marks the block device type of the storage block device to be processed as an SPDK disk type.
[0111] Step S64: Invoke the storage block device mounting process corresponding to the block device type according to the received call request.
[0112] Step S65: Determine whether the SPDK service is deployed on the current node where the virtual machine is located according to the storage block device mounting process.
[0113] In this embodiment, the block device type of the storage block device to be processed is determined to be an SPDK disk type, and the storage block device mounting process corresponding to the SPDK disk type is called. In the storage block device mounting process, it is first determined whether the SPDK service is deployed on the current node where the virtual machine is located.
[0114] Step S66: If the current node has deployed the SPDK service, then use the SPDK service to convert the storage block device to be processed into a socket type bdev device, and mount the bdev device.
[0115] In this embodiment, when determining whether the SPDK service is deployed on the current node where the virtual machine is located, if the SPDK service has been deployed on the current node, the storage block device to be processed is converted into a socket-type bdev device using the SPDK service, and the bdev device is mounted.
[0116] Step S67: If the SPDK service is not deployed on the current node, return the corresponding error message.
[0117] In this embodiment, when determining whether the SPDK service is deployed on the current node where the virtual machine is located, if the SPDK service is not deployed on the current node, the corresponding error message is returned.
[0118] For example, such as Figure 10As shown, the `attach_dev_protocol` field in the request message body of the target request is `vhostuser`, and the determined block device type is an SPDK disk type. The storage block device mounting process corresponding to the SPDK disk type is called. That is, for the SPDK type disk, a `Block_Device_Mapping` data table is created to determine whether the corresponding SPDK service is deployed on the node where the virtual machine is located. If the SPDK service is not deployed, an HTTP (Hypertext Transfer Protocol) Conflict error message will be returned. If the current node has deployed the SPDK service, the ordinary disk will be transformed into a socket-type `bdev` device using the SPDK service, and then mounted to the cloud host.
[0119] For details regarding steps S61 to S62 and S64, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0120] As can be seen, this embodiment of the application receives a target request to manage the storage block device to be processed, then identifies the device type field of the request message body in the target request as vhostuser, determines the block device type of the storage block device to be processed as an SPDK disk type based on the vhostuser, invokes the storage block device mounting process corresponding to the SPDK disk type according to the received call request, and then performs mounting processing on the SPDK storage disk under the storage block device mounting process.
[0121] Accordingly, embodiments of this application also disclose a storage block device management apparatus, see [link to relevant documentation]. Figure 11 As shown, the device includes:
[0122] Request receiving module 11 is used to receive target requests for managing storage block devices to be processed;
[0123] The field recognition module 12 is used to recognize the device type field in the request message body of the target request;
[0124] The device type determination module 13 is used to determine the block device type of the storage block device to be processed based on the device type field; the device type field is a field added in advance at a target position in the request message body to mark the storage block device type;
[0125] The process invocation module 14 is used to invoke the storage block device mounting process or storage block device unmounting process corresponding to the block device type according to the received invocation request.
[0126] The block device mounting or unmounting module 15 is used to mount or unmount the storage block device to be processed according to the storage block device mounting process or the storage block device unmounting process.
[0127] As can be seen from the above, this embodiment of the application receives a target request for managing a storage block device to be processed, then identifies the device type field in the request message body of the target request, determines the block device type of the storage block device to be processed based on the device type field, reads the storage block device information of the storage block device to be processed corresponding to the block device type in the block device data record table according to the received information query instruction, and sends the storage block device information to the user interface for display, thereby improving the efficiency of cloud host querying block devices and enabling unified management and scheduling of different types of disks.
[0128] In some specific embodiments, the device type determination module 13 may specifically include:
[0129] The first type determination unit is used to determine that the block device type of the storage block device to be processed is a normal storage block device type when the device type field is normal;
[0130] The second type determination unit is used to determine that the block device type of the storage block device to be processed is a read-only optical disc type when the device type field is ISO.
[0131] The third type determination unit is used to determine that the block device type of the storage block device to be processed is a local disk type when the device type field is local;
[0132] The fourth type determination unit is used to determine that the block device type of the storage block device to be processed is an SPDK disk type when the device type field is vhostuser.
[0133] In some specific embodiments, the block device mounting or unmounting module 15 may specifically include:
[0134] The first information acquisition unit is used to acquire the connection information of the storage backend and determine the type of the storage backend when the block device type is the ordinary storage block device type.
[0135] The second information acquisition unit is used to perform corresponding connection operations according to the RBD protocol and the connection information to obtain the mapping information of the block device to be processed when the storage backend type is Ceph storage type, and to mount the current storage block device to be processed using the mapping information.
[0136] The third information acquisition unit is used to perform a disk scanning operation based on the connection information to obtain the mapping information of the block device to be processed when the storage backend type is a centralized storage type.
[0137] The first mounting unit is used to mount the current storage block device to be processed using the mapping information.
[0138] In some specific embodiments, the block device mounting or unmounting module 15 may specifically include:
[0139] The fourth information acquisition unit is used to acquire the storage block device information of the storage block device to be processed from the glance service when the block device type is the read-only optical disc type.
[0140] The second mounting unit is used to mount the current storage block device to be processed using the storage block device information.
[0141] In some specific embodiments, the block device mounting or unmounting module 15 may specifically include:
[0142] The disk device acquisition unit is used to acquire the disk device on the host machine when the block device type is the local disk type;
[0143] The third mounting unit is used to mount the current storage block device to be processed according to the drive letter device.
[0144] In some specific embodiments, the block device mounting or unmounting module 15 may specifically include:
[0145] The determination unit is used to determine whether an SPDK service is deployed on the current node where the virtual machine is located when the block device type is an SPDK disk type.
[0146] The device type conversion unit is used to convert the storage block device to be processed into a socket-type bdev device when the SPDK service has been deployed on the current node.
[0147] The fourth mounting unit is used to mount the bdev device;
[0148] The error message return unit is used to return the corresponding error message when the SPDK service is not deployed on the current node.
[0149] In some specific embodiments, the storage block device management apparatus may further include:
[0150] The block device information reading module is used to read the storage block device information of the storage block device to be processed corresponding to the block device type from the block device data record table according to the received information query instruction;
[0151] The block device information display module is used to send the storage block device information to the user interface for display; the block device data record table is a data table that records the block device information of each storage block device corresponding to each block device type.
[0152] Furthermore, embodiments of this application also provide an electronic device. Figure 12 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0153] Figure 12 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the storage block device management method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0154] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0155] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0156] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the storage block device management method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0157] Furthermore, embodiments of this application also disclose a computer-readable storage medium storing a computer program. When the computer program is loaded and executed by a processor, it implements the storage block device management method steps disclosed in any of the foregoing embodiments.
[0158] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0159] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0160] The present invention has provided a detailed description of a storage block device management method, apparatus, device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for managing storage block devices, characterized in that, include: Receive target requests for managing storage block devices to be processed; The device type field in the request message body of the target request is identified, and the block device type of the storage block device to be processed is determined based on the device type field; the device type field is a field added in advance at the target position in the request message body to mark the storage block device type; The receiving call request triggers the storage block device mounting process or storage block device unmounting process corresponding to the block device type. The storage block device to be processed is mounted or unmounted according to the storage block device mounting process or the storage block device unmounting process. Also includes: The storage block device information corresponding to the storage block device type is read from the block device data record table according to the received information query instruction, and the storage block device information is sent to the user interface for display; the block device data record table is a data table that records the block device information of each storage block device corresponding to each block device type.
2. The storage block device management method according to claim 1, characterized in that, Determining the block device type of the storage block device to be processed based on the device type field includes: When the device type field is normal, the block device type of the storage block device to be processed is determined to be a normal storage block device type; When the device type field is ISO, the block device type of the storage block device to be processed is determined to be a read-only optical disc type; When the device type field is local, the block device type of the storage block device to be processed is determined to be a local disk type; When the device type field is vhostuser, the block device type of the storage block device to be processed is determined to be an SPDK disk type.
3. The storage block device management method according to claim 2, characterized in that, The step of mounting the current storage block device according to the storage block device mounting process includes: When the block device type is the ordinary storage block device type, the connection information of the storage backend is obtained, and the type of the storage backend is determined to obtain the storage backend type; When the storage backend type is Ceph storage type, the corresponding connection operation is performed according to the RBD protocol and the connection information to obtain the mapping information of the storage block device to be processed, and the mapping information is used to mount the current storage block device to be processed. When the storage backend type is centralized storage, a disk scan operation is performed based on the connection information to obtain the mapping information of the storage block device to be processed, and the mapping information is used to mount the current storage block device to be processed.
4. The storage block device management method according to claim 2, characterized in that, The step of mounting the current storage block device according to the storage block device mounting process includes: When the block device type is the read-only optical disc type, the storage block device information of the storage block device to be processed is obtained from the glance service, and the storage block device information is used to mount the current storage block device to be processed.
5. The storage block device management method according to claim 2, characterized in that, The step of mounting the current storage block device according to the storage block device mounting process includes: When the block device type is the local disk type, the disk letter device on the host machine is obtained, and the current storage block device to be processed is mounted according to the disk letter device.
6. The storage block device management method according to claim 2, characterized in that, The step of mounting the current storage block device according to the storage block device mounting process includes: When the block device type is an SPDK disk, determine whether the SPDK service is deployed on the current node where the virtual machine is located; If the current node has already deployed the SPDK service, then the SPDK service is used to convert the storage block device to be processed into a socket-type bdev device, and the bdev device is mounted. If the SPDK service is not deployed on the current node, a corresponding error message will be returned.
7. A storage block device management apparatus, characterized in that, include: The request receiving module is used to receive target requests for managing the storage block devices to be processed. The field recognition module is used to identify the device type field in the request message body of the target request; The device type determination module is used to determine the block device type of the storage block device to be processed based on the device type field; the device type field is a field added in advance at a target position in the request message body to mark the storage block device type; The process invocation module is used to invoke the storage block device mounting process or storage block device unmounting process corresponding to the block device type according to the received invocation request; A block device mounting or unmounting module is used to mount or unmount the storage block device to be processed according to the storage block device mounting process or the storage block device unmounting process. Also includes: The block device information reading module is used to read the storage block device information of the storage block device to be processed corresponding to the block device type from the block device data record table according to the received information query instruction; The block device information display module is used to send the storage block device information to the user interface for display; the block device data record table is a data table that records the block device information of each storage block device corresponding to each block device type.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the storage block device management method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Used for storing computer programs; wherein, when the computer programs are executed by a processor, they implement the steps of the storage block device management method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for mounting virtual disk on cloud physical machine, equipment and medium
CN113504872A
Data storage method based on distributed cluster, and related device thereof
WO2021051570A1