Data reading method and device of hard disk, server and storage medium
By using the NVME-MI protocol and MCTP protocol for data reading during hard disk monitoring, the problem of strong dependence on BIOS during hard disk monitoring is solved, and independent reading of hard disk data and BMC independence is improved.
Patent Information
- Application Number
- CN202411898656.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-18
AI Technical Summary
In the prior art, the dependence on the BIOS during the monitoring of the hard disk is strong, resulting in a decrease in the independence of the BMC, and it is impossible to directly obtain some important hard disk information such as PCIE link information or port information.
By using the NVME-MI protocol and the MCTP protocol, data reading is performed on the hard disk. The server sends NVME-MI protocol format data reading commands to the driver service through the MCTP service, carrying the target hard disk identification and the corresponding BMC identification to realize independent reading of hard disk data.
It realizes reducing dependence on BIOS during hard disk monitoring, improving BMC independence, and being able to read more NVME hard disk data to meet the needs of operation and maintenance personnel.
Smart Images

Figure CN119847428A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of hard disk technology, and in particular to a hard disk data reading method, device, server and storage medium. Background Art
[0002] The Baseboard Management Controller (BMC) is the basic core functional subsystem of the server. 2 The C link communicates with a hard disk (hereinafter referred to as hard disk) using the interface specification of non-volatile memory Express (NVME), and can obtain basic information of the hard disk, such as the model and capacity of the hard disk.
[0003] However, there is still some information that cannot be directly obtained in the above method, and the basic information obtained cannot meet the data requirements of the server operation and maintenance personnel in the process of monitoring the hard disk. For example, the information that cannot be directly obtained is the link information or port information of the high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIE), which needs to rely on the push of the basic input and output system (Basic Input Output System, BIOS). When the server starts, the BIOS will push information to the BMC, and the hard disk service needs to find the PCIE link information or port information related to the hard disk in the information pushed by the BIOS.
[0004] Therefore, in the process of monitoring the hard disk in the related art, the BIOS is highly dependent, which reduces the independence of the BMC. Summary of the invention
[0005] In an exemplary embodiment of the present application, a hard disk data reading method, device, server and storage medium are provided to ensure data requirements during the hard disk monitoring process, reduce dependence on BIOS during the hard disk data reading process, and improve the independence of BMC.
[0006] According to a first aspect of an exemplary embodiment, a method for reading data from a hard disk is provided, which is applied to a server, wherein the server provides a baseboard management controller BMC, and the BMC provides a non-volatile memory interface specification hard disk service, a management controller transmission protocol MCTP service, and a driver service;
[0007] The server sends a data read command to the driver service through the MCTP service; wherein the format of the data read command is the NVME-MI protocol format, and the data read command carries a target hard disk identifier of the target hard disk and a target BMC identifier corresponding to the target hard disk identifier; the BMC identifier and the hard disk identifier correspond one to one; the target BMC identifier indicates a target MCTP transmission channel between the BMC and the target hard disk; the target BMC identifier is any one in the BMC identifier set, and the target hard disk identifier is any one in the hard disk identifier set;
[0008] The server converts the data read command into a target data read command in the MCTP protocol format through the driver service, and sends the target data read command to the target hard disk through the target MCTP transmission channel;
[0009] The server receives hard disk data obtained from the target hard disk in response to the target data read command through the driver service.
[0010] In an embodiment of the present application, the server sends a data read command in NVME-MI protocol format to the driver service through the MCTP service. The data read command carries the target hard disk identifier of the target hard disk to be monitored and the corresponding target BMC identifier, and the BMC identifier and the hard disk identifier correspond one to one, and the target BMC identifier indicates that the target MCTP transmission channel is formed between the BMC and the target hard disk. In this way, the server converts the data read command into a target data read command in the MCTP protocol format through the driver service, and sends the target data read command to the target hard disk through the target MCTP transmission channel. The server receives the hard disk data obtained after the target hard disk responds to the target data read command through the driver service. In this way, the hard disk is read using the NVME-MI protocol and the MCTP protocol, and more NVME hard disk data can be read compared with the traditional application of NVME basic command to read data. It can not only meet the needs of operation and maintenance personnel, but also reduce the dependence on BIOS and strengthen the independence of BMC.
[0011] In an optional embodiment, the method further includes:
[0012] The server sends the target hard disk identifier to the MCTP service through the hard disk service;
[0013] Before the server sends a data read command to the driver service through the MCTP service, the method further includes:
[0014] The server determines the target BMC identifier through the MCTP service according to the target hard disk identifier and the pre-stored correspondence between the hard disk identifier and the BMC identifier.
[0015] In the above embodiment, since the hard disk identifier is an identifier stored on the hard disk side for uniquely identifying a hard disk, and the BMC identifier is an identifier stored on the BMC side for uniquely identifying a hard disk, the BMC identifier and the hard disk identifier correspond one to one. The server can first send the target hard disk identifier to the MCTP service through the hard disk service, and then determine the target BMC identifier through the MCTP service according to the correspondence between the target hard disk identifier and the pre-stored hard disk identifier and the BMC identifier. In this way, it is convenient to determine the target MCTP transmission channel between the target BMC identifier indicating the BMC and the target hard disk.
[0016] In an optional implementation, the BMC also provides a configuration service, and the method further includes:
[0017] The server obtains configuration information provided by each of the multiple processes through the configuration service; wherein one process provides one type of configuration information; the configuration service includes multiple processes;
[0018] The server sends an information acquisition request to the configuration service through the hard disk service, and receives configuration information after the configuration service responds to the information acquisition request.
[0019] In the above embodiment, the first configuration information is needed in the process of creating a hard disk identification set, and the first configuration information is part of the configuration information, so the configuration information can be obtained first. Since one process provides one type of configuration information, the configuration service includes multiple processes. In this way, the server obtains the configuration information provided by each of the multiple processes through the configuration service, and sends an information acquisition request to the configuration service through the hard disk service to obtain the configuration information, and then receives the configuration information after the configuration service responds to the information acquisition request. In this way, the first configuration information in the configuration information can be directly applied when creating a hard disk identification set.
[0020] In an optional embodiment, the method further includes:
[0021] The server creates a hard disk identification set according to the first configuration information through the MCTP service;
[0022] The server creates a BMC identity set through the MCTP service;
[0023] The first configuration information is the bus identifier and bus address in the configuration information.
[0024] In the above embodiment, the hard disk identifier is an identifier stored on the hard disk side for uniquely identifying a hard disk, and the BMC identifier is an identifier stored on the BMC side for uniquely identifying a hard disk, and the BMC identifier and the hard disk identifier correspond one to one. Therefore, when there are multiple hard disks, the set of their corresponding hard disk identifiers is called a hard disk identifier set, and the corresponding BMC identifiers are called a BMC identifier set. In order to obtain the hard disk identifier and the corresponding BMC identifier of each hard disk, the server creates a hard disk identifier set according to the bus identifier and bus address through the MCTP service, and creates a BMC identifier set through the MCTP service.
[0025] In an optional implementation, the server creates a hard disk identification set according to the first configuration information through the MCTP service, including:
[0026] The server sends a query request to a first hard disk corresponding to a first bus address based on a first channel indicated by a first bus identifier through an MCTP service, and receives feedback information from the first hard disk; the first bus is any one of the buses corresponding to each hard disk;
[0027] If the feedback information indicates that the first hard disk does not have a hard disk identifier, the server sets a first hard disk identifier for the first hard disk through the MCTP service, and sends the first hard disk identifier to the first hard disk;
[0028] If the feedback information indicates that the first hard disk has a first hard disk identifier, the server obtains the first hard disk identifier of the first hard disk based on the feedback information through the MCTP service;
[0029] The server determines the hard disk IDs of each hard disk through the MCTP service to form a hard disk ID set.
[0030] In the above embodiment, in the process of creating a hard disk identification set, there are two cases, one of which is that the first hard disk does not have a hard disk identification, and the other is that the first hard disk has a first hard disk identification. For the first case, the server can set the first hard disk identification for the first hard disk through the MCTP service; for the second case, the server can receive the first hard disk identification from the first hard disk through the MCTP service. In this way, the server can obtain the hard disk identification of each hard disk through the MCTP service to form a hard disk identification set.
[0031] In an optional implementation, the server creates a BMC identifier set through the MCTP service, including:
[0032] The server determines the BMC identifier corresponding to each hard disk identifier from a pre-stored identifier library through the MCTP service to form a BMC identifier set.
[0033] In the above embodiment, the MCTP service includes a pre-stored identification library, which includes multiple identifications for use. In this way, a corresponding BMC identification can be assigned to each hard disk identification through the MCTP service, and each BMC identification constitutes a BMC identification set. Therefore, communication can be performed based on the MCTP protocol through the MCTP transmission channel indicated by the one-to-one corresponding BMC identification and hard disk identification.
[0034] In an optional embodiment, the method further includes:
[0035] The server creates a corresponding DBus object for each hard disk according to the second configuration information through the hard disk service; wherein the DBus object is a storage space, and the DBus object is used to store the read hard disk data; the second configuration information is the serial number of the hard disk.
[0036] In the above embodiment, after reading the hard disk data, in order to classify and store different data, a corresponding DBus object can be created for each hard disk to store the corresponding category of data. These DBus objects are used to display the hard disk information for use by other services. Moreover, the hard disk service can also display more comprehensive hard disk information to the user.
[0037] According to a second aspect of an exemplary embodiment, a hard disk data reading device is provided, which is applied to a server, and the device includes:
[0038] The first service unit is used to send a data read command to the driver service through the MCTP service; wherein the format of the data read command is the NVME-MI protocol format, and the data read command carries a target hard disk identifier of the target hard disk and a target BMC identifier corresponding to the target hard disk identifier; the BMC identifier and the hard disk identifier correspond one to one; the target BMC identifier indicates a target MCTP transmission channel between the BMC and the target hard disk; the target BMC identifier is any one in the BMC identifier set, and the target hard disk identifier is any one in the hard disk identifier set;
[0039] A second service unit is used to convert the data read command into a target data read command in the MCTP protocol format through the driver service, and send the target data read command to the target hard disk through the target MCTP transmission channel;
[0040] The third service unit is used to receive hard disk data obtained from the target hard disk in response to the target data read command through the drive service.
[0041] According to a third aspect of an exemplary implementation, a server is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above methods when executing the computer program.
[0042] According to a fourth aspect of the exemplary implementation, a computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the steps of any of the above methods are implemented.
[0043] According to a fifth aspect of the exemplary implementation, a computer program product is provided, comprising a computer program, which implements the steps of any method provided in the first aspect of the present application when the computer program is executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0045] Figure 1 A flowchart of a hard disk data reading method provided by an embodiment of the present application is exemplarily shown;
[0046] Figure 2 The signaling flow chart of a hard disk data reading method provided by an embodiment of the present application is exemplarily shown;
[0047] Figure 3 A flowchart of a complete hard disk data reading method provided by an embodiment of the present application is exemplarily shown;
[0048] Figure 4 The following is a schematic diagram showing the structure of a data reading device for a hard disk provided in an embodiment of the present application;
[0049] Figure 5 A schematic diagram of the structure of a server provided in an embodiment of the present application is exemplified. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0051] For ease of understanding, the terms involved in the embodiments of the present application are explained below:
[0052] (1) Baseboard Management Controller (BMC) is the basic core functional subsystem of the server, responsible for the server's hardware status management, operating system management, health status management, power consumption management and other core functions.
[0053] Among them, OpenBMC is an open source BMC solution, jointly developed by Facebook, IBM, Rackspace and other companies, and hosted by the Linux Foundation. It supports system management tasks such as hard disk monitoring, environmental monitoring, and fan control. It is built using the Yocto Project framework and aims to promote the openness and customizability of system management software. The embodiment of the present application provides a hard disk data reading method under the OpenBMC architecture.
[0054] (2) Basic Input Output System (BIOS) is the firmware that runs when the server starts up and is responsible for initializing the hardware and loading the operating system.
[0055] (3) Non-Volatile Memory Express (NVME) is a high-speed transmission protocol designed for flash memory storage that can significantly increase the speed of data reading and writing. NVME is a bus transmission protocol specification based on the device logic interface (equivalent to the application layer in the communication protocol) that can be used to access non-volatile memory media (such as solid-state hard drives using flash memory) attached to the high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIE) bus.
[0056] When differentiating hard disks, they are usually distinguished by their interface types, and hard disks that use the NVME interface specification are called NVME hard disks. NVME hard disks are high-performance storage devices that use PCIE bus to directly connect to the server's central processing unit (CPU). They are widely used in servers, workstations, and personal computers to meet high-bandwidth demand scenarios such as big data and high-speed games. The hard disks in the embodiments of this application are all NVME hard disks.
[0057] (4) Management Component Transport Protocol (MCTP) is a standardized protocol for communication between different management controllers in a computer system. It has strong flexibility and scalability and can be used for communication between different management controllers and devices. Because the MCTP protocol can run on a variety of underlying transmission media, such as I 2C, System Management Bus (SMBus), I3C, PCIE, Universal Serial Bus (USB) and Ethernet, so MCTP has wide applicability in different hardware platforms and communication environments.
[0058] (5) NVME Management Interface (NVME-MI), an interface associated with each NVME controller in the NVM subsystem, responsible for performing management operations on behalf of the management endpoint. The corresponding protocol is a standardized communication protocol for managing and monitoring NVME storage devices.
[0059] (6) Entity Identifier (EID): In MCTP, it is a unique identifier used to distinguish different management devices in the network.
[0060] (7)D-Bus, an advanced inter-process communication mechanism.
[0061] (8) U.2 hard drive is a solid-state drive that supports the NVME or Serial Advanced Technology Attachment (SATA) protocol and uses an SFF-8639 connector.
[0062] (9)M.2 hard drive is a small, modular solid-state drive that can be directly inserted into the M.2 slot of the motherboard. It supports NVME and has a different size from U.2.
[0063] The existing BMC hard disk monitoring technology uses NVME basic commands to communicate with the hard disk, which is fast and stable. However, the data that can be accessed is limited and cannot fully meet the data requirements of server operation and maintenance personnel for hard disk monitoring. BMC usually needs to obtain data from BIOS to fill in the missing hard disk data. This leads to BMC's dependence on BIOS and reduces BMC's independence.
[0064] To this end, the embodiment of the present application provides a method for reading data from a hard disk, in which the NVME-MI protocol and the MCTP protocol are used to read data from the hard disk, and more NVME hard disk data can be read compared to the traditional NVME basic command data reading method. This can meet the needs of operation and maintenance personnel, reduce dependence on BIOS, and strengthen the independence of BMC.
[0065] After introducing the design ideas of the embodiments of the present application, the following briefly introduces the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited. In specific implementation, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.
[0066] refer to Figure 1 , which is a structural diagram of a hard disk monitoring system provided in an embodiment of the present application, the system includes a server 11 and a hard disk 12. The server includes a BMC, and the BMC provides NVME hard disk service (hereinafter referred to as hard disk service), MCTP service and drive service. The BMC in the server 11 is connected to the hard disk 12 by I 2 The CPU in the server 11 communicates with the hard disk via the PCIE bus.
[0067] In the embodiment of the present application, during the communication between the BMC and the hard disk, communication is performed based on the NVME-MI protocol and the MCTP protocol.
[0068] Of course, the method provided in the embodiment of the present application is not limited to Figure 1 The application scenarios shown can also be used in other possible application scenarios, and the embodiments of the present application are not limited thereto. Figure 1 The functions that can be implemented by each device in the application scenario shown will be described in the subsequent method embodiments, and will not be described in detail here.
[0069] To further illustrate the technical solution provided by the embodiment of the present application, this is described in detail below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiment of the present application provides the method operation steps shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided in the embodiment of the present application.
[0070] Figure 2 The flowchart of a method for reading data from a hard disk is shown, and the method is applied to a server. Figure 2 , the technical solution provided in the embodiments of the present application is described.
[0071] S201: The server sends a data read command to the driver service through the MCTP service.
[0072] S202: The server converts the data read command into a target data read command in the MCTP protocol format through the driver service, and sends the target data read command to the target hard disk through the target MCTP transmission channel.
[0073] S203: The server receives hard disk data obtained from the target hard disk in response to the target data read command through the driver service.
[0074] In an embodiment of the present application, the server sends a data read command in NVME-MI protocol format to the driver service through the MCTP service. The data read command carries the target hard disk identifier of the target hard disk to be monitored and the corresponding target BMC identifier, and the BMC identifier and the hard disk identifier correspond one to one, and the target BMC identifier indicates that the target MCTP transmission channel is formed between the BMC and the target hard disk. In this way, the server converts the data read command into a target data read command in the MCTP protocol format through the driver service, and sends the target data read command to the target hard disk through the target MCTP transmission channel. The server receives the hard disk data obtained after the target hard disk responds to the target data read command through the driver service. In this way, the hard disk is read using the NVME-MI protocol and the MCTP protocol, and more NVME hard disk data can be read compared with the traditional application of NVME basic command to read data. It can not only meet the needs of operation and maintenance personnel, but also reduce the dependence on BIOS and strengthen the independence of BMC.
[0075] In relation to S201, the hard disk identifier is used by the BMC to uniquely locate a hard disk. The BMC identifier is an identifier of a hard disk stored in the BMC. The BMC identifier and the hard disk identifier correspond one to one. Both types of identifiers can be represented by EID. The hard disk identifiers corresponding to each hard disk constitute a hard disk identifier set, and the identifiers of each hard disk stored in the BMC constitute a BMC identifier set.
[0076] In a specific example, suppose there are 10 hard disks, whose EIDs are 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10 respectively. The identifiers of these 10 hard disks stored in the BMC can be a, b, c, d, e, f, g, h, i, and j. Then the hard disk identifier set is {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, and the BMC identifier set is {a, b, c, d, e, f, g, h, i, j}. In this way, during the MCTP transmission process, the BMC can communicate with the hard disk 1 through the channel indicated between a and 1. It should be noted that these identifiers are only for illustration and do not limit the identifiers in the actual application process.
[0077] In order to monitor a certain hard disk, the service first sends the target hard disk identifier (any one in the hard disk identifier set, such as 2) to the MCTP service through the hard disk service. The MCTP service determines the target BMC identifier (any one in the BMC identifier set, such as b) based on the correspondence between the target hard disk identifier and the pre-stored hard disk identifier and BMC identifier.
[0078] The server sends a data read command to the driver service through the MCTP service. The format of the data read command is the NVME-MI protocol format. The data read command carries the target hard disk identifier of the target hard disk and the target BMC identifier corresponding to the target hard disk identifier. The target BMC identifier indicates the target MCTP transmission channel between the BMC and the target hard disk. In this way, when the BMC communicates with the target hard disk, it can be done through the target MCTP channel.
[0079] Next, the creation process of the hard disk identification set and the BMC set will be described.
[0080] 1. The process of creating a hard disk identification set
[0081] Since configuration information is needed in this process, the generation process of configuration information is first described through steps A1-A2. BMC also provides configuration services, and the generation process of configuration information is generated by the configuration service.
[0082] A1: The server obtains the configuration information provided by multiple processes through the configuration service.
[0083] The configuration service generally includes multiple processes, each of which provides a type of NVME configuration information, such as I 2 CBus number, I 2 C address information and the hard disk serial number (used in I 2 C transmission layer to identify the location of the hard disk). In addition, the configuration information may also include interface information of hard disks with multiple physical interfaces, such as a U.2 interface and an M.2 interface.
[0084] A2: The server sends an information acquisition request to the configuration service through the hard disk service, and receives configuration information from the configuration service in response to the information acquisition request.
[0085] Optionally, the server sends an information acquisition request to the configuration service through the hard disk service, so that the configuration service can respond to the information acquisition request and send configuration information to the hard disk service. After receiving the configuration information, the hard disk service enables the MCTP driver, which is responsible for establishing a bridge for communication between the BMC and the hard disk.
[0086] The server creates a hard disk identification set according to the first configuration information through the MCTP service; the first configuration information here is the bus identification in the configuration information (I 2 CBus number) and bus address (I 2 C address). The following is a method of generating a hard disk identification set through steps B1-B4.
[0087] B1: The server sends a query request to the first hard disk corresponding to the first bus address based on the first channel indicated by the first bus identifier through the MCTP service, and receives feedback information from the first hard disk.
[0088] The first bus is any one of the buses corresponding to each hard disk. 2 C1, the first hard disk corresponding to it is hard disk 1, then the first channel indicated by the first bus identifier is the first channel between the BMC identifier a and the first hard disk under the MCTP protocol. The query request is used to query whether the hard disk identifier of the first hard disk itself already exists in the first hard disk, and the MCTP service receives feedback information of the first hard disk, and the feedback information can indicate whether the hard disk identifier of the first hard disk exists or does not exist.
[0089] B2: If the feedback information indicates that the first hard disk does not have a hard disk identifier, the server sets a first hard disk identifier for the first hard disk through the MCTP service and sends the first hard disk identifier to the first hard disk.
[0090] Optionally, in one case, there is no hard disk identifier for the first hard disk, that is, the first identifier has never been set for the first hard disk. In this case, the server can set the first hard disk identifier for the first hard disk through the MCTP service. The setting rule is, for example, to randomly select one from the identifiers that have never been used in the identifier library pre-stored by the MCTP service, or select a minimum one, and assign it to the first hard disk as the first hard disk identifier of the first hard disk. After the first hard disk identifier of the first hard disk is set, the first hard disk identifier can be sent to the first hard disk.
[0091] B3: If the feedback information indicates that the first hard disk has a first hard disk identifier, the server obtains the first hard disk identifier of the first hard disk based on the feedback information through the MCTP service.
[0092] Optionally, in another case, the first hard disk has a first hard disk identifier. In this case, the first hard disk can send the first hard disk identifier to the MCTP service as part of the feedback information. In this way, the MCTP service obtains the first hard disk identifier based on the feedback information.
[0093] B4: The server determines the hard disk IDs of each hard disk through the MCTP service to form a hard disk ID set.
[0094] Combining the above two situations, the server can use the MCTP service to combine the hard disk identifiers corresponding to each hard disk to form a hard disk identifier set.
[0095] It should be noted that an asynchronous creation method is used when creating a hard disk identification set. In order to avoid conflicts when multiple hard disks create hard disk identifications and generate the same hard disk identification, a locked method is used for creation, that is, when one hard disk creates a hard disk identification, other hard disks cannot be created, and only one hard disk can create a hard disk identification at a time.
[0096] 2. The process of creating a BMC identification set.
[0097] This process can be implemented by the server through the MCTP service. Optionally, the server determines the BMC identifier corresponding to each hard disk identifier from a pre-stored identifier library through the MCTP service to form a BMC identifier set.
[0098] For each hard disk, a random identifier is selected from unused identifiers, or a minimum identifier is selected as the BMC identifier corresponding to the hard disk. After the BMC identifier of each hard disk is generated, a BMC identifier set can be formed.
[0099] Therefore, in the process of creating a BMC identifier set, not only each BMC identifier can be obtained, but also the corresponding relationship between the hard disk identifier and the BMC identifier can be obtained, which is used to determine the corresponding target BMC identifier according to an existing target hard disk identifier.
[0100] In S202, after the driver service of the server receives the data read command, the driver service converts the data read command into a target data read command in the MCTP protocol format, and sends the target data read command to the target hard disk through the target MCTP transmission channel.
[0101] The driver service converts the format of the data read command, and then sends the converted target MCTP command to the target hard disk through the target MCTP book removal channel. In this way, since the data read command is in NVME-MI format, it is converted into the MCTP protocol format, and the NVME-MI protocol based on the MCTP protocol is used to read the hard disk data, without relying on BIOS, and the BMC can independently obtain the hard disk information.
[0102] In S203, after receiving the target data read command, the target hard disk responds to the target data read command, obtains hard disk data, and sends the hard disk data to the server through the driver service. The server receives the hard disk data obtained from the target hard disk after responding to the target data read command through the driver service.
[0103] Optionally, the hard disk data may include information such as the firmware version and lifespan of the hard disk, and may also include PCIE link information and port information, etc.
[0104] On the basis of the above technical solution, after the hard disk data is read, the hard disk data also needs to be stored. In the embodiment of the present application, the server creates a corresponding DBus object for each hard disk according to the second configuration information (for example, the serial number of the hard disk) through the hard disk service. The DBus object is a storage space for storing the read hard disk data. The acquired hard disk data is stored in the hard disk service, and the hard disk service displays more comprehensive hard disk information to the user. For example, DBus objects of hard disk temperature, assets, and status are created. These DBus objects are used to display hard disk information for use by other services.
[0105] The above embodiment is a data reading process for a hard disk. In actual application, a timer may be set. When the timer expires, the data of all hard disks are read in a loop in the same way. Since the communication between the hard disk and the BMC takes time, and the BMC does not need to access the hard disk data so frequently, the timer is generally set to 1 second or 2 seconds.
[0106] Figure 3 A signaling flow chart of a hard disk data reading method provided in an embodiment of the present application, Figure 3 The process includes at least the following steps:
[0107] S301: The configuration service obtains configuration information provided by multiple processes respectively.
[0108] S302: The hard disk service sends an information acquisition request to the configuration service.
[0109] S303: The configuration service responds to the information acquisition request.
[0110] S304: The configuration service sends configuration information to the hard disk service.
[0111] S305: The hard disk service creates a corresponding DBus object for each hard disk to store hard disk data according to the second configuration information (part of the configuration information).
[0112] S306: The configuration service sends configuration information to the MCTP service.
[0113] S307: The MCTP service creates a hard disk identification set according to the first configuration information (part of the configuration information):
[0114] Based on the first channel indicated by the first bus identifier, a query request is sent to the first hard disk corresponding to the first bus address, and feedback information from the first hard disk is received; if the feedback information indicates that the hard disk identifier does not exist in the first hard disk, the first hard disk identifier of the first hard disk is set, and the first hard disk identifier is sent to the first hard disk; if the feedback information indicates that the first hard disk identifier exists in the first hard disk, the first hard disk identifier of the first hard disk is obtained based on the feedback information; and it is determined that the hard disk identifiers of each hard disk constitute a hard disk identifier set.
[0115] S308: The MCTP service determines the BMC identifiers corresponding to the hard disk identifiers from a pre-stored identifier library to form a BMC identifier set.
[0116] S309: The MCTP service sends a data read command in the NVME-MI protocol format to the driver service, carrying the target hard disk identifier of the target hard disk and the target BMC identifier corresponding to the target hard disk identifier.
[0117] The target BMC identifier is any one in the BMC identifier set, and the target hard disk identifier is any one in the hard disk identifier set.
[0118] S310: The driver service converts the data read command into a target data read command in the MCTP protocol format.
[0119] S311: The driver service sends the target data read command to the target hard disk through the target MCTP transmission channel.
[0120] S312: The target hard disk responds to the target data read command and generates hard disk data.
[0121] S313: The driver service receives hard disk data from the target hard disk.
[0122] S314: The driver service sends the hard disk data to the hard disk service.
[0123] S315: The hard disk service stores hard disk data through the DBus object.
[0124] in, Figure 3 The order of each step can be adjusted according to the actual situation and does not form a specific limitation. In addition, the implementation method of each step can refer to the above embodiment and will not be repeated here.
[0125] like Figure 4 As shown, based on the same inventive concept, an embodiment of the present application provides a hard disk data reading device, which is applied to a server, and the device includes a first service unit 41 and a second service unit 42.
[0126] The first service unit 41 is used to send a data read command to the driver service through the MCTP service; wherein the format of the data read command is the NVME-MI protocol format, and the data read command carries a target hard disk identifier of the target hard disk and a target BMC identifier corresponding to the target hard disk identifier; the BMC identifier and the hard disk identifier correspond one to one; the target BMC identifier indicates a target MCTP transmission channel between the BMC and the target hard disk; the target BMC identifier is any one in the BMC identifier set, and the target hard disk identifier is any one in the hard disk identifier set;
[0127] The second service unit 42 is used to convert the data read command into a target data read command in the MCTP protocol format through the drive service, and send the target data read command to the target hard disk through the target MCTP transmission channel;
[0128] The second service unit 42 is further configured to receive hard disk data obtained from the target hard disk in response to the target data read command through the drive service.
[0129] In an optional embodiment, the device further includes a fourth service unit;
[0130] A third service unit is used to send a target hard disk identifier to the MCTP service through the hard disk service;
[0131] The first service unit 41 is further configured to determine the target BMC identifier through the MCTP service according to the target hard disk identifier and the pre-stored correspondence between the hard disk identifier and the BMC identifier before sending the data read command to the drive service through the MCTP service.
[0132] In an optional implementation, the BMC also provides configuration services, and the apparatus further includes a fourth service unit;
[0133] A fourth service unit is used to obtain configuration information provided by each of the multiple processes through a configuration service; wherein one process provides one type of configuration information; and the configuration service includes multiple processes;
[0134] The third service unit is further configured to send an information acquisition request to the configuration service through the hard disk service, and receive configuration information after the configuration service responds to the information acquisition request.
[0135] In an optional implementation manner, the first service unit 41 is further configured to:
[0136] The server creates a hard disk identification set according to the first configuration information through the MCTP service;
[0137] The server creates a BMC identity set through the MCTP service;
[0138] The first configuration information is the bus identifier and bus address in the configuration information.
[0139] In an optional implementation manner, the first service unit 41 is specifically configured to:
[0140] Through the MCTP service, based on the first channel indicated by the first bus identifier, a query request is sent to the first hard disk corresponding to the first bus address, and feedback information from the first hard disk is received; the first bus is any one of the buses corresponding to each hard disk;
[0141] If the feedback information indicates that the hard disk identifier does not exist for the first hard disk, setting the first hard disk identifier of the first hard disk through the MCTP service, and sending the first hard disk identifier to the first hard disk;
[0142] If the feedback information indicates that the first hard disk has a first hard disk identifier, the server obtains the first hard disk identifier of the first hard disk based on the feedback information through the MCTP service;
[0143] The server determines the hard disk IDs of each hard disk through the MCTP service to form a hard disk ID set.
[0144] In an optional implementation manner, the first service unit 41 is specifically configured to:
[0145] Through the MCTP service, the BMC identifier corresponding to each hard disk identifier is determined from the pre-stored identifier library to form a BMC identifier set.
[0146] In an optional implementation manner, the third service unit is specifically configured to:
[0147] Through the hard disk service, a corresponding DBus object is created for each hard disk according to the second configuration information; wherein the DBus object is a storage space, and the DBus object is used to store the read hard disk data; the second configuration information is the serial number of the hard disk.
[0148] Since the device is the device in the method in the embodiment of the present application, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0149] Based on the same inventive concept as the hard disk data reading method, the embodiment of the present application also provides a server, which can be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), a cloud server, etc. Figure 5 As shown, the server may include a processor 51 and a memory 52 .
[0150] The processor 51 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and may implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0151] The memory 52 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 52 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0152] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; the above computer storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to: mobile storage devices, random access memory (RAM, Random Access Memory), magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO)), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)) and other media that can store program codes.
[0153] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: a mobile storage device, a random access memory (RAM, Random Access Memory), a magnetic storage device (such as a floppy disk, a hard disk, a magnetic tape, a magneto-optical disk (MO), etc.), an optical storage device (such as CD, DVD, BD, HVD, etc.), and a semiconductor memory (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), a solid-state drive (SSD)) and other various media that can store program codes.
[0154] Based on the same inventive concept, the embodiment of the present application also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes any of the hard disk data reading methods discussed above. Since the principle of solving the problem by the above computer program product is similar to that of the hard disk data reading method, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.
[0155] The above embodiments are only used to introduce the technical solutions of the present application in detail, but the description of the above embodiments is only used to help understand the methods of the embodiments of the present application and should not be understood as limiting the embodiments of the present application. Any changes or substitutions that can be easily thought of by technicians in this technical field should be included in the protection scope of the embodiments of the present application.
Claims
1. A method for reading data from a hard disk, characterized in that: Applied to a server, the server includes a baseboard management controller BMC, the BMC provides a non-volatile memory interface specification NVME hard disk service, a management controller transmission protocol MCTP service and a driver service; The server sends a data read command to the drive service through the MCTP service; wherein the format of the data read command is the NVME-MI protocol format, and the data read command carries a target hard disk identifier of a target hard disk and a target BMC identifier corresponding to the target hard disk identifier; the BMC identifier and the hard disk identifier correspond one to one; the target BMC identifier indicates a target MCTP transmission channel between the BMC and the target hard disk; the target BMC identifier is any one in a BMC identifier set, and the target hard disk identifier is any one in a hard disk identifier set; The server converts the data read command into a target data read command in MCTP protocol format through the driver service, and sends the target data read command to the target hard disk through the target MCTP transmission channel; The server receives hard disk data obtained from the target hard disk in response to the target data read command through the drive service.
2. The method according to claim 1, characterized in that The method further comprises: The server sends a target hard disk identifier to the MCTP service through the hard disk service; Before the server sends the data read command to the drive service through the MCTP service, the method further includes: The server determines the target BMC identifier through the MCTP service according to the target hard disk identifier and the correspondence between the pre-stored hard disk identifier and the BMC identifier.
3. The method according to claim 1, characterized in that The BMC also provides configuration services, and the method further includes: The server obtains configuration information provided by each of the multiple processes through the configuration service; wherein one process provides one type of configuration information; the configuration service includes multiple processes; The server sends an information acquisition request to the configuration service through the hard disk service, and receives the configuration information after the configuration service responds to the information acquisition request.
4. The method according to claim 3, characterized in that The method further comprises: The server creates the hard disk identification set according to the first configuration information through the MCTP service; The server creates the BMC identification set through the MCTP service; The first configuration information is the bus identifier and bus address in the configuration information.
5. The method according to claim 4, characterized in that The server creates a hard disk identification set according to the first configuration information through the MCTP service, including: The server sends a query request to a first hard disk corresponding to a first bus address based on a first channel indicated by a first bus identifier through the MCTP service, and receives feedback information from the first hard disk; the first bus is any one of the buses corresponding to each hard disk; If the feedback information indicates that the first hard disk does not have a hard disk identifier, the server sets a first hard disk identifier for the first hard disk through the MCTP service, and sends the first hard disk identifier to the first hard disk; If the feedback information indicates that the first hard disk has a first hard disk identifier, the server obtains the first hard disk identifier of the first hard disk based on the feedback information through the MCTP service; The server determines, through the MCTP service, that the hard disk identifiers of the respective hard disks constitute a hard disk identifier set.
6. The method according to claim 4, characterized in that The server creates a BMC identification set through the MCTP service, including: The server determines the BMC identifiers corresponding to the hard disk identifiers from a pre-stored identifier library through the MCTP service to form a BMC identifier set.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: The server creates a corresponding DBus object for each hard disk through the hard disk service according to the second configuration information; wherein the DBus object is a storage space, and the DBus object is used to store the read hard disk data; the second configuration information is the serial number of the hard disk.
8. A data reading device for a hard disk, characterized in that: Applied to a server, the device comprises: A first service unit is configured to send a data read command to the drive service through the MCTP service; wherein the format of the data read command is the NVME-MI protocol format, and the data read command carries a target hard disk identifier of a target hard disk and a target BMC identifier corresponding to the target hard disk identifier; the BMC identifier and the hard disk identifier have a one-to-one correspondence; the target BMC identifier indicates a target MCTP transmission channel between the BMC and the target hard disk; the target BMC identifier is any one of a BMC identifier set, and the target hard disk identifier is any one of a hard disk identifier set; A second service unit is used to convert the data read command into a target data read command in MCTP protocol format through the drive service, and send the target data read command to the target hard disk through the target MCTP transmission channel; The second service unit is further configured to receive, through the drive service, hard disk data obtained from the target hard disk in response to the target data read command.
9. A server comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.