A method, apparatus, electronic device, and storage medium for obtaining hard disk information
By obtaining server configuration information and dividing the target space in the PCI bridge resource space, the problem of not identifying NVME hard disks when the server is started is solved, and NVME hard disks can be identified and used without supporting hot-swap function to avoid error reports.
Patent Information
- Application Number
- CN202310149322.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2043-02-22
AI Technical Summary
When the server is started, if the NVME hard disk is not inserted or the external adapter board does not support hot-swap function, the NVME hard disk cannot be recognized, resulting in the inability to allocate the PCI bridge resource space. Then, when the NVME hard disk is inserted into the open operating system, an error occurs when the NVME hard disk is inserted.
By obtaining the server configuration information, including the relevant information of the target slot, external adapter board and virtual NVME hard disk, the target space is divided from the resource space of the PCI bridge, and the configuration information is stored in the target space, and finally the configuration information in the target space is mapped to the server memory, so that the open operating system can obtain relevant information of the virtual NVME hard disk.
Start the server when the NVME hard disk is not plugged in, and divide the corresponding target space from the resource space of the PCI bridge according to the virtual NVME hard disk to avoid unknown device errors when inserting the NVME hard disk after entering the open operating system, and realize the support of hot plugging function.
Smart Images

Figure CN116302499B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of servers, and in particular to a method for obtaining hard disk information, a device for obtaining hard disk information, an electronic device and a computer-readable storage medium. Background Art
[0002] With the rapid development of server technology, servers are now widely used, with a wide variety of server types and application loads. According to user needs, the use of server peripheral device resources is also increasing. For example, in a server, an NVME (Nonvolatile memory express) hard drive is connected to a PCIE (peripheral component interconnect express) device through an external adapter card.
[0003] In this scenario, when the server is started without inserting the NVME hard drive first, or when the external adapter board does not support the hot-swap function, the external adapter board cannot find the NVME hard drive, so the PCI bridge resource space cannot be allocated to the NVME hard drive. When the open operating system is entered and the NVME hard drive is inserted again, the NVME hard drive cannot be recognized and the hot-swap function of the NVME hard drive cannot be realized. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a method for obtaining hard disk information, a device for obtaining hard disk information, an electronic device and a computer-readable storage medium that overcome the above problems or at least partially solve the above problems.
[0005] In a first aspect, an embodiment of the present invention discloses a method for obtaining hard disk information, the method being applied to a server, the server having a slot, an external adapter card, and a peripheral component interconnect (PCI) bridge, the method comprising:
[0006] Acquire configuration information of the server; the configuration information includes slot information of a target slot, board information of a target external adapter board corresponding to the target slot, and hard disk information of a virtual non-volatile storage fast channel NVME hard disk corresponding to the target slot;
[0007] dividing a target space from a resource space of the PCI bridge according to the configuration information, and storing the configuration information in the target space;
[0008] Map the configuration information in the target space to the server memory so that the open operating system can obtain the relevant information of the virtual NVME hard disk; the relevant information includes the slot information, the board information, and the hard disk information.
[0009] Optionally, the hard disk information includes the space information of the PCI bridge corresponding to the virtual NVME hard disk; the dividing the target space from the resource space of the PCI bridge according to the configuration information includes:
[0010] Divide a target space corresponding to the space information of the PCI bridge from the resource space of the PCI bridge.
[0011] Optionally, the slot information includes a slot number and a function number; the board information includes device information and a device address; the storing the configuration information to the target space includes:
[0012] Bind the slot number and the function number of the target slot, the device information and the device address of the target external adapter board, and the hard disk information of the virtual NVME hard disk, and store the slot number, the function number, the device information, the device address, and the hard disk information to the target space.
[0013] Optionally, the dividing the target space from the resource space of the PCI bridge according to the configuration information includes:
[0014] When the server is in the power-on self-test stage, divide the target space from the resource space of the PCI bridge according to the configuration information.
[0015] Optionally, the mapping the configuration information in the target space to the server memory so that the relevant information of the virtual NVME hard disk under the open operating system includes:
[0016] Map the configuration information in the target space to the server memory so that the open operating system can obtain the relevant information of the virtual NVME hard disk when the server is started and the server is not connected to the NVME hard disk.
[0017] Optionally, the mapping the configuration information in the target space to the server memory so that the configuration information can be obtained under the open operating system includes:
[0018] Map the configuration information in the target space to the server memory so that the open operating system can obtain the relevant information of the virtual NVME hard disk when the server is started and the target external adapter board does not recognize the NVME hard disk.
[0019] Optionally, the external adapter board is an adapter board that does not support hot plugging function.
[0020] In a second aspect, an embodiment of the present invention discloses a device for obtaining hard disk information. The device is applied to a server, and the server has a slot, an external adapter board, and a Peripheral Component Interconnect (PCI) bridge. The device includes:
[0021] An obtaining module, configured to obtain configuration information of the server; the configuration information includes slot information of a target slot, board information of a target external adapter board corresponding to the target slot, and hard disk information of a virtual Non-Volatile Memory Express (NVME) hard disk corresponding to the target slot;
[0022] A partitioning module, configured to partition a target space from a resource space of the PCI bridge according to the configuration information, and store the configuration information in the target space;
[0023] A mapping module, configured to map the configuration information in the target space to the server memory, so that an open operating system can obtain relevant information of the virtual NVME hard disk; the relevant information includes the slot information, the board information, and the hard disk information.
[0024] Optionally, the hard disk information includes space information of the PCI bridge corresponding to the virtual NVME hard disk; the partitioning module includes:
[0025] A first sub-partitioning module, configured to partition a target space corresponding to the space information of the PCI bridge from the resource space of the PCI bridge.
[0026] Optionally, the slot information includes a slot number and a function number; the board information includes device information and a device address; the partitioning module includes:
[0027] A storage sub-module, configured to bind the slot number and the function number of the target slot, the device information and the device address of the target external adapter board, and the hard disk information of the virtual NVME hard disk, and store the slot number, the function number, the device information, the device address, and the hard disk information in the target space.
[0028] Optionally, the partitioning module includes:
[0029] A second sub-partitioning module, configured to partition the target space from the resource space of the PCI bridge according to the configuration information when the server is in a power-on self-test stage.
[0030] Optionally, the mapping module includes:
[0031] The first mapping sub-module is used to map the configuration information in the target space to the server memory, so that when the open operating system starts the server and the server is not connected to an NVME hard disk, the relevant information of the virtual NVME hard disk can be obtained.
[0032] Optionally, the mapping module includes:
[0033] The second mapping sub-module is used to map the configuration information in the target space to the server memory, so that when the open operating system starts the server and the target external adapter card does not recognize the NVME hard disk, the relevant information of the virtual NVME hard disk can be obtained.
[0034] Optionally, the external adapter card is a non-hot-pluggable adapter board.
[0035] In a third aspect, the present invention discloses an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the above method for obtaining hard disk information are implemented.
[0036] In a fourth aspect, the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method for obtaining hard disk information are implemented.
[0037] The embodiments of the present invention have the following advantages:
[0038] In the embodiments of the present invention, by obtaining the configuration information of the server, where the configuration information includes the slot information of the target slot, the board information of the target external adapter card corresponding to the target slot, and the hard disk information of the virtual non-volatile memory express (NVME) hard disk corresponding to the target slot; dividing a target space from the resource space of the PCI bridge according to the configuration information and storing the configuration information in the target space. Thus, a target space is reserved in the resource space of the PCI bridge for the corresponding virtual NVME hard disk, and then the configuration information in the target space is mapped to the server memory, so that the open operating system can obtain the relevant information of the virtual NVME hard disk. Therefore, when starting the server without inserting the NVME hard disk, a corresponding target space can be divided from the resource space of the PCI bridge based on the virtual NVME hard disk, avoiding the error reporting phenomenon of unknown devices when inserting the NVME hard disk after entering the open operating system. Description of the Drawings
[0039] Figure 1 is a flowchart of the steps of a method for obtaining hard disk information provided by an embodiment of the present invention;
[0040] Figure 2It is a structural block diagram of a hard disk information acquisition device provided by an embodiment of the present invention;
[0041] Figure 3 It is a structural block diagram of an electronic device provided by an embodiment of the present invention;
[0042] Figure 4 It is a structural block diagram of a computer-readable storage medium provided by an embodiment of the present invention. Specific embodiments
[0043] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0044] In the prior art, when the NVME hard disk is not inserted before the server starts, after the server starts, when the external adapter card cannot recognize the NVME hard disk, the PCI bridge resource space cannot be allocated to the NVME hard disk. When the NVME hard disk is inserted after the server completes startup and enters the open operating system, an unknown device error will occur. To solve the above technical problems, by obtaining the configuration information of the server, where the configuration information includes the relevant information of the virtual NVME hard disk, a target space for storing the configuration information is divided from the resource space of the PCI bridge according to the configuration information, and then the configuration information in the target space is mapped to the server memory, so that the open operating system can obtain the relevant information of the virtual NVME hard disk. Thus, when starting the server without inserting the NVME hard disk, a corresponding target space can be divided from the resource space of the PCI bridge based on the virtual NVME hard disk, avoiding the unknown device error when inserting the NVME hard disk after entering the open operating system.
[0045] Refer to Figure 1 , which shows a step flowchart of a method for obtaining hard disk information provided by an embodiment of the present invention. The method is applied to a server, and the server has a slot, an external adapter card, and a Peripheral Component Interconnect (PCI) bridge. The method may specifically include the following steps:
[0046] Step 101, obtain the configuration information of the server.
[0047] In the embodiment of the present invention, the server may have a slot, an external adapter card, and a PCI bridge. A PCI Express (PCIE) device may be connected to the external adapter card, and the PCIE device has a slot. The NVME hard disk can be connected to the server after being plugged into the slot. PCIE belongs to high-speed serial point-to-point dual-channel high-bandwidth transmission. The devices connected are allocated exclusive channel bandwidth and do not share bus bandwidth. It mainly supports functions such as active power management, error reporting, end-to-end reliable transmission, hot plugging, and quality of service.
[0048] In the present invention, the server may be provided with BIOS (Basic Input Output System). BIOS is a set of programs fixed to a ROM chip on the motherboard of the computer. It stores the most important basic input and output programs of the computer, the self-test program after power-on, and the system self-starting program. It can read and write specific information of system settings from CMOS (the abbreviation of Complementary Metal Oxide Semiconductor. It refers to a technology used to manufacture large-scale integrated circuit chips or a chip manufactured using this technology. It is a readable and writable RAM chip on the computer motherboard. The RAM chip is used to store data). Its main function is to provide the computer with the lowest-level and most direct hardware settings and controls. In addition, BIOS also provides some system parameters to the operating system. Changes in system hardware are hidden by BIOS, and the program uses BIOS functions instead of directly controlling the hardware. Modern operating systems ignore the abstraction layer provided by BIOS and directly control hardware components.
[0049] BIOS can obtain the configuration information of the server, wherein the configuration information includes the slot information of the target slot, the board information of the target external adapter board corresponding to the target slot, and the hard disk information of the virtual NVME hard disk corresponding to the target slot. Before obtaining the hard disk information of the virtual NVME hard disk, a virtual NVME hard disk can be set by BIOS, and the virtual NVME hard disk corresponds to the hard disk information of the NVME hard disk to be plugged into the target slot of the present invention. Among them, the external adapter board of the present invention can be a SW adapter board. For example: in actual use, the NVME hard disk is to be plugged into the second slot in the server, then the second slot in the server is the target slot, and the external adapter board corresponding to the target slot is the target external adapter board, then a virtual NVME hard disk corresponding to the hard disk information of the NVME hard disk can be set by BIOS.
[0050] In an embodiment of the present invention, a virtual NVMe hard disk is set up. The hard disk information of the virtual NVM hard disk to be virtualized can be bound to the slot information of the target slot corresponding to the hard disk information and the board information of the target external adapter card corresponding to the target slot, and stored in the target space in the resource space of the PCI bridge. Then, the slot information of the target slot corresponding to the hard disk information stored in the target space and the board information of the target external adapter card corresponding to the target slot are mapped to the server memory, and a virtual NVM hard disk is virtualized in the server memory. Among them, the hard disk information corresponding to the virtual NVM hard disk, the slot information of the target slot, and the board information of the target external adapter card corresponding to the target slot are the same as the information stored in the target space in the resource space of the PCI bridge. The technology of the present invention virtualizes a virtual NVM hard disk in the server memory. Similar to virtual memory, the speed of the memory is much faster than that of the hard disk. Utilizing this point, virtualizing an NVM hard disk in the memory can accelerate the data exchange speed of the disk, thereby improving the running speed.
[0051] In the present invention, the external adapter card can be an adapter board that does not support the hot plug function. By the method disclosed in this embodiment, the present invention can avoid the phenomenon that the NVMe hard disk cannot be recognized after inserting the NVMe hard disk when entering the open operating system when the external adapter card is an adapter board that does not support the hot plug function. Hot plug means plugging and unplugging while the power is on. The hot plug function allows users to remove and replace damaged hard disks, power supplies, or board cards and other components without shutting down the system or cutting off the power, thereby improving the system's ability to recover from disasters in a timely manner, expandability, and flexibility. For example, some disk mirroring systems for high-end applications can provide the hot plug function of the disk.
[0052] The method disclosed in the embodiment of the present invention can be applied to the scenario where no NVMe hard disk is plugged into the target slot corresponding to the target external adapter card when the server starts up.
[0053] Step 102, divide a target space from the resource space of the PCI bridge according to the configuration information, and store the configuration information in the target space.
[0054] In an embodiment of the present invention, after obtaining the configuration information of the server, a target space can be divided from the resource space of the PCI bridge according to the configuration information, and then the configuration information can be stored in the target space. To save the space used by the PCI bridge, only the slot information of the target slot, the board information of the target external adapter card, and the hard disk information of the virtual NVME hard disk in the configuration information can be stored in the target space, which can avoid the over-large target space divided, affecting the reasonable utilization of the resource space of the PCI bridge. Among them, the PCI bridge refers to the bridge function from the processor to the PCI interface, which is used to connect the CPU and the PCI interface for data exchange between the CPU and the PCI interface.
[0055] In an embodiment, the hard disk information of the virtual NVME hard disk may include the space information of the PCI bridge corresponding to the virtual NVME hard disk. In the present invention, the space information required by the virtual NVME hard disk in the PCI bridge can be set in the hard disk information of the virtual NVME hard disk, and the server can divide a target space corresponding to the space information of the PCI bridge from the resource space of the PCI bridge. For example: the space required by the virtual NVME hard disk in the PCI bridge is 64 bytes, that is, the space information of the PCI bridge corresponding to the virtual NVME hard disk is 64 bytes, and the server can divide 64 bytes from the resource space of the PCI bridge as the target space.
[0056] In an embodiment, the space information of the PCI bridge corresponding to the virtual NVME hard disk may further include the space location. When dividing the resource space of the PCI bridge, according to the space location in the space information, the space location to be divided can be determined from the resource space of the PCI bridge, and then the space at the determined space location can be divided as the target space. For example: there are multiple location areas set in the resource space of the PCI bridge, and the information stored in the resources in each location area is different, that is, the applications played by the resources in each location area are different. According to the space information of the PCI bridge corresponding to the virtual NVME hard disk being the second area, then the space at the second area in the resource space of the PCI bridge can be divided as the target space for storing the slot information of the target slot, the board information of the target external adapter card corresponding to the target slot, and the hard disk information of the virtual NVME hard disk corresponding to the target slot.
[0057] In one embodiment, the server can perform self-check on its own system resources and device resources. When the server is in the power self-check phase, it can divide a target space from the resource space of the PCI bridge according to the configuration information. The power self-check phase can be completed through the BIOS. When the server boots up, after waiting for the power supply to stabilize, the power supply will send a "power-on success message" to the chip. Then, the CPU is reset to its initial state and starts to prepare for operation. When the CPU is initially started, the system RAM is empty and there is no content to execute. Therefore, the CPU can be pre-programmed to always look for a fixed location in the ROM of the system BIOS at this stage to start the BIOS. After starting the BIOS, the power self-check phase is implemented. In this phase, the target space can be divided from the resource space of the PCI bridge according to the configuration information.
[0058] In one embodiment, the slot information of the target slot may include a slot number and a function number, and the board information of the target external adapter card may include device information and a device address. After dividing the target space from the resource space of the PCI bridge, the slot number and function number of the target slot, the device information and device address of the target external adapter card, and the hard disk information of the virtual NVME hard disk can be bound, and the slot number, function number, device information, device address, and hard disk information are stored in the target space. In the present invention, each slot has a corresponding function number and a slot number that is unique to and corresponding to the slot. The devices connected to each slot can be different, such as network card devices, hard disk devices, etc. Therefore, each slot number also represents the attributes of the device connected to the slot, and the functions corresponding to each slot are also different. Therefore, the function number of the slot represents the function corresponding to the slot.
[0059] In the present invention, each external adapter card in the server has a corresponding and unique device address. After binding the device address and device information of the target external adapter card, the slot number and function number of the target slot, and the hard disk information of the virtual NVME hard disk, the device information, slot number, function number, and hard disk information of the virtual NVME hard disk corresponding to the device address can be determined through the unique device address.
[0060] Step 103, map the configuration information in the target space to the server memory so that the open operating system can obtain the relevant information of the virtual NVME hard disk.
[0061] In an embodiment of the present invention, after storing the configuration information in the target space, the configuration information in the target space can be mapped to the server memory. Thus, when operating an open system, the open system can obtain the relevant information of the virtual NVME hard disk from the server memory. The relevant information may include the slot information of the target slot, the board information of the target external adapter card, and the hard disk information of the virtual NVME hard disk.
[0062] In one embodiment, after storing the configuration information in the target space, the configuration information in the target space can be mapped to the server memory so that the open operating system can obtain the relevant information of the virtual NVME hard disk when starting the server and the server is not connected to an NVME hard disk. For example, no NVME hard disk is plugged into the target slot in the server. At this time, when the server starts, the open system does not have the relevant information of the NVME hard disk, but can obtain the relevant information of the virtual NVME hard disk. Thus, after the server starts, even if no NVME hard disk is connected to the server, it can obtain the relevant information of the virtual NVME hard disk. When an NVME hard disk is plugged in again after entering the open system, since the PCI bridge resource space has been allocated to the virtual NVME hard disk through the relevant information of the virtual NVME hard disk, and the relevant information of the virtual NVME hard disk corresponds to the relevant information of the NVME hard disk, the relevant information of the virtual NVME hard disk can be used as the relevant information of the NVME hard disk, thus avoiding the phenomenon of failure to recognize the NVME hard disk. Moreover, even when the target external adapter does not support the hot plug function, after the NVME hard disk is plugged into the target slot, the hot plug function can also be supported.
[0063] In another embodiment, after storing the configuration information in the target space, the configuration information in the target space can be mapped to the server memory so that the open operating system can obtain the relevant information of the virtual NVME hard disk when starting the server and the target external adapter card fails to recognize the NVME hard disk. For example, an NVME hard disk is plugged into the target slot in the server, but at this time, due to other failures of the target slot or the target external adapter, the NVME hard disk cannot be recognized. When entering the open system, the relevant information of the virtual NVME hard disk can be directly obtained. When an NVME hard disk is plugged in again after entering the open system, since the PCI bridge resource space has been allocated to the virtual NVME hard disk through the relevant information of the virtual NVME hard disk, and the relevant information of the virtual NVME hard disk corresponds to the relevant information of the NVME hard disk, the relevant information of the virtual NVME hard disk can be used as the relevant information of the NVME hard disk, thus avoiding the phenomenon of failure to recognize the NVME hard disk.
[0064] To better understand the specific process of the embodiments of the present invention, the method of the present invention is further described through the following example: In a scenario, an NVMe hard disk to be inserted into a target slot is determined. According to the NVMe hard disk, the target slot, and the target external adapter card, the hard disk information of the NVMe hard disk, the slot number and function number of the target slot, and the device information and device address of the target external adapter card are determined. A virtual NVMe hard disk is virtualized through the BIOS according to the hard disk information. The hard disk information of the virtual NVMe hard disk is the same as that of the NVMe hard disk. During the power-on self-test stage in the BIOS, according to the space information of the PCI bridge corresponding to the virtual NVMe hard disk in the hard disk information, a target space corresponding to the PCI bridge space information is divided from the resource space of the PCI bridge. In the prior art, when the server is started without inserting an NVMe hard disk, since there is no NVMe hard disk, the target external adapter card will not obtain the NVMe hard disk, and no space will be divided in the PCI resource space for the NVMe hard disk to use. When the NVMe hard disk is inserted again after entering the open system, since there is no PCI resource space for the NVMe hard disk to use, the phenomenon of unable to recognize the NVMe hard disk will occur, resulting in an unknown device error message.
[0065] After a target space corresponding to the PCI bridge space information is divided from the resource space of the PCI bridge, the hard disk information of the virtual NVMe hard disk, the slot number and function number of the target slot, and the device information and device address of the target external adapter card are bound and stored in the target space. Then, the hard disk information of the virtual NVMe hard disk, the slot number and function number of the target slot, and the device information and device address in the target space are mapped to the server memory.
[0066] When the server is started into the open operating system without inserting an NVME hard disk, the open operating system obtains the hard disk information of the virtual NVME hard disk, the slot number and function number of the target slot, and the device information and device address of the target external adapter card from the target space of the PCI bridge through the server memory. After entering the open operating system, when the NVME hard disk is inserted, since a target space has been divided from the resource space of the PCI bridge through the virtual NVME hard disk, at this time, the resources in the target space can be exchanged with the resources of the NVME hard disk. The resources of the virtual NVME hard disk and the resources of the NVME hard disk are essentially the same. That is to say, the hard disk information, the slot number and function number of the target slot, and the device information and device address of the target external adapter card corresponding to the NVME hard disk are the same as those stored in the target space. Therefore, the NVME hard disk can be identified through the divided target space of the PCI bridge. Thus, the target space of the PCI bridge is used for the NVME hard disk, and the phenomenon of not being able to identify the NVME hard disk will not occur, avoiding the error reporting of unknown devices, and also enabling the realization of the hot plug function of the external adapter board in the server.
[0067] In this embodiment, the configuration information of the server is obtained; the configuration information includes the slot information of the target slot, the board information of the target external adapter card corresponding to the target slot, and the hard disk information of the virtual non-volatile memory express (NVME) hard disk corresponding to the target slot; a target space is divided from the resource space of the PCI bridge according to the configuration information, and the configuration information is stored in the target space; the configuration information in the target space is mapped to the server memory so that the open operating system can obtain the relevant information of the virtual NVME hard disk; the relevant information includes slot information, board information, and hard disk information. Thus, when the server is started without inserting an NVME hard disk and the target external adapter card does not support the hot plug function, the open system can still obtain the relevant information of the virtual NVME hard disk, and the relevant information of the virtual NVME hard disk has been used to allocate the PCI bridge resource space for the virtual NVME hard disk. When the NVME hard disk is inserted after the server is started and enters the open system, the relevant information of the virtual NVME hard disk can be used as the relevant information of the NVME hard disk, thereby identifying the NVME hard disk and realizing the hot plug function, avoiding the phenomenon of error reporting due to the inability to identify the relevant information of the NVME hard disk.
[0068] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequences, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present invention.
[0069] Referring to Figure 2 , a structural block diagram of a device for obtaining hard disk information provided by an embodiment of the present invention is shown. The device is applied to a server, and the server has a slot, an external adapter card, and a peripheral component interconnect PCI bridge. Specifically, it may include the following modules:
[0070] An obtaining module 201, configured to obtain the configuration information of the server; the configuration information includes slot information of a target slot, board card information of a target external adapter card corresponding to the target slot, and hard disk information of a virtual non-volatile memory express NVME hard disk corresponding to the target slot;
[0071] A partitioning module 202, configured to partition a target space from the resource space of the PCI bridge according to the configuration information, and store the configuration information in the target space;
[0072] A mapping module 203, configured to map the configuration information in the target space to the server memory, so that an open operating system can obtain relevant information of the virtual NVME hard disk; the relevant information includes the slot information, the board card information, and the hard disk information.
[0073] Optionally, the hard disk information includes space information of the PCI bridge corresponding to the virtual NVME hard disk; the partitioning module 202 includes:
[0074] A first sub-partitioning module, configured to partition a target space corresponding to the space information of the PCI bridge from the resource space of the PCI bridge.
[0075] Optionally, the slot information includes a slot number and a function number; the board card information includes device information and a device address; the partitioning module 202 includes:
[0076] A storage sub-module, configured to bind the slot number and the function number of the target slot, the device information and the device address of the target external adapter card, and the hard disk information of the virtual NVME hard disk, and store the slot number, the function number, the device information, the device address, and the hard disk information in the target space.
[0077] Optionally, the partitioning module 202 includes:
[0078] A second sub-partitioning module, configured to partition the target space from the resource space of the PCI bridge according to the configuration information when the server is in the power self-check stage.
[0079] Optionally, the mapping module 203 includes:
[0080] A first mapping sub-module, configured to map the configuration information in the target space to the server memory, so that when the open operating system starts the server and the server starts without connecting an NVME hard disk, relevant information about the virtual NVME hard disk can be obtained.
[0081] Optionally, the mapping module 203 includes:
[0082] A second mapping sub-module, configured to map the configuration information in the target space to the server memory, so that when the open operating system starts the server and the target external adapter card does not recognize the NVME hard disk, relevant information about the virtual NVME hard disk can be obtained.
[0083] Optionally, the external adapter card is an adapter that does not support the hot-plug function.
[0084] In this embodiment, a obtaining module is used to obtain the configuration information of the server; the configuration information includes slot information of the target slot, board information of the target external adapter card corresponding to the target slot, and hard disk information of the virtual non-volatile memory express (NVME) hard disk corresponding to the target slot; a partitioning module is used to partition the target space from the resource space of the PCI bridge according to the configuration information and store the configuration information in the target space; a mapping module is used to map the configuration information in the target space to the server memory, so that the open operating system can obtain relevant information about the virtual NVME hard disk; the relevant information includes slot information, board information, and hard disk information. Thus, when the server starts without an NVME hard disk plugged in and the target external adapter card does not support hot-plugging, the open system can still obtain relevant information about the virtual NVME hard disk, and PCI bridge resource space has been allocated to the virtual NVME hard disk through the relevant information of the virtual NVME hard disk. When an NVME hard disk is plugged in after the server starts and enters the open system, the relevant information of the virtual NVME hard disk can be used as the relevant information of the NVME hard disk, so as to identify the NVME hard disk and implement the hot-plug function, avoiding the phenomenon of reporting an error due to the inability to recognize the relevant information of the NVME hard disk.
[0085] For the apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant parts, please refer to the partial description of the method embodiment.
[0086] As shown Figure 3 , a structural block diagram of an electronic device provided by an embodiment of the present invention is shown, including:
[0087] It includes a processor, a memory, and a computer program stored on the memory and capable of running on the processor. When the computer program is executed by the processor, it implements each process of the above-described embodiment of the method for obtaining hard disk information and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0088] As shown Figure 4 , a structural block diagram of a computer-readable storage medium provided by an embodiment of the present invention is shown. A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements each process of the above-described embodiment of the method for obtaining hard disk information and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0089] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0090] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present invention can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.
[0091] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the processes and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0092] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufacture including an instruction device that implements the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 specified in one block or multiple blocks.
[0093] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operational steps are performed on the computer or other programmable terminal device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 specified in one block or multiple blocks.
[0094] Although the preferred embodiments of the embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present invention.
[0095] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or terminal device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising the element.
[0096] The above has introduced in detail a method for obtaining hard disk information, a device for obtaining hard disk information, an electronic device and a computer-readable storage medium provided by the present invention. Specific examples are used in this text to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A method for obtaining hard disk information, characterized in that, the method is applied to a server, the server having a slot, an external adapter card, and a Peripheral Component Interconnect (PCI) bridge, and the method includes: obtaining configuration information of the server; the configuration information including slot information of a target slot, board information of a target external adapter card corresponding to the target slot, and hard disk information of a virtual Non-Volatile Memory Express (NVME) hard disk corresponding to the target slot; the hard disk information including spatial information of the PCI bridge corresponding to the virtual NVME hard disk; dividing a target space corresponding to the spatial information of the PCI bridge from the resource space of the PCI bridge; when the server is in the power-on self-test stage, dividing the target space from the resource space of the PCI bridge according to the configuration information; mapping the configuration information in the target space to the server memory, so that an open operating system can obtain relevant information of the virtual NVME hard disk; the relevant information including the slot information, the board information, and the hard disk information; the mapping the configuration information in the target space to the server memory, so that an open operating system can obtain relevant information of the virtual NVME hard disk, includes: mapping the configuration information in the target space to the server memory, so that an open operating system can obtain relevant information of the virtual NVME hard disk when starting the server and the server is not connected to an NVME hard disk.
2. The method for obtaining hard disk information according to claim 1, characterized in that, the slot information includes a slot number and a function number; the board information includes device information and a device address; and the storing the configuration information into the target space includes: binding the slot number and the function number of the target slot, the device information and the device address of the target external adapter card, and the hard disk information of the virtual NVME hard disk, and storing the slot number, the function number, the device information, the device address, and the hard disk information into the target space.
3. The method for obtaining hard disk information according to claim 1, characterized in that, the mapping the configuration information in the target space to the server memory, so that an open operating system can obtain relevant information of the virtual NVME hard disk, includes: mapping the configuration information in the target space to the server memory, so that an open operating system can obtain relevant information of the virtual NVME hard disk when starting the server and the target external adapter card does not recognize an NVME hard disk.
4. The method for obtaining hard disk information according to claim 1, characterized in that, the external adapter card is a non-hot-pluggable adapter.
5. An apparatus for obtaining hard disk information, characterized in that, the apparatus is applied to a server, the server having a slot, an external adapter card, and a Peripheral Component Interconnect (PCI) bridge, and the apparatus includes: An acquisition module, configured to acquire configuration information of the server; the configuration information includes slot information of a target slot, board information of a target external adapter board corresponding to the target slot, and hard disk information of a virtual non-volatile memory express (NVME) hard disk corresponding to the target slot; the hard disk information includes spatial information of a PCI bridge corresponding to the virtual NVME hard disk. A partitioning module, configured to partition a target space corresponding to the spatial information of the PCI bridge from the resource space of the PCI bridge; when the server is in the power-on self-test stage, partition the target space from the resource space of the PCI bridge according to the configuration information. A mapping module, configured to map the configuration information in the target space to the server memory, so that an open operating system can acquire relevant information of the virtual NVME hard disk; the relevant information includes the slot information, the board information, and the hard disk information. The mapping module includes: A first mapping sub-module, configured to map the configuration information in the target space to the server memory, so that the open operating system can acquire relevant information of the virtual NVME hard disk when the server is started and the server is not connected to an NVME hard disk.
6. An electronic device, characterized in that it includes: A processor, a memory, and a computer program stored on the memory and capable of running on the processor, and when the computer program is executed by the processor, the steps of the method for acquiring hard disk information according to any one of claims 1-4 are implemented.
7. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for acquiring hard disk information according to any one of claims 1-4 are implemented.
Citation Information
Patent Citations
Hardware equipment configuration method and device, equipment and storage medium
CN113485756A
Hard disk hot plug method and device, terminal equipment and medium
CN113535246A