WO2023137984A1 - 一种硬盘模拟插拔方法、装置、设备及存储介质 - Google Patents

一种硬盘模拟插拔方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023137984A1
WO2023137984A1 PCT/CN2022/102538 CN2022102538W WO2023137984A1 WO 2023137984 A1 WO2023137984 A1 WO 2023137984A1 CN 2022102538 W CN2022102538 W CN 2022102538W WO 2023137984 A1 WO2023137984 A1 WO 2023137984A1
Authority
WO
WIPO (PCT)
Prior art keywords
hard disk
electrical signal
card slot
signal
management controller
Prior art date
Application number
PCT/CN2022/102538
Other languages
English (en)
French (fr)
Inventor
董彦岩
Original Assignee
苏州浪潮智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 苏州浪潮智能科技有限公司 filed Critical 苏州浪潮智能科技有限公司
Publication of WO2023137984A1 publication Critical patent/WO2023137984A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • G06F13/4081Live connection to bus, e.g. hot-plugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0026PCI express

Definitions

  • the present application relates to the field of data storage, and in particular to a method, device, equipment and storage medium for simulated plugging and unplugging of a hard disk.
  • Hot swapping is an operation that occurs frequently in daily life.
  • a U disk USB flash disk, USB flash drive
  • PC personal computer, personal computer
  • a mouse is changed from one computer to another computer.
  • replacing the hard disk is also a very frequent thing.
  • NVMe Non-Volatile Memory express, non-volatile memory host controller interface specification
  • SSD Solid State Drives, solid state drive
  • PCIe peripheral component interconnect express, a high-speed serial computer expansion bus standard
  • NVMe SSD can be directly placed on the front panel like a SATA (Serial Advanced Technology Attachment, a computer bus)/SAS (Serial Attached SCSI, a new generation of SCSI technology) hard disk.
  • SATA Serial Advanced Technology Attachment
  • SAS Serial Attached SCSI, a new generation of SCSI technology
  • NVMe SSD's support for hot swapping becomes natural and necessary.
  • the existing violent hot-swapping method lacks the judgment of whether to support plugging or not, the manual efficiency is low, and the number of tests is small, which brings catastrophic damage to the NMVE hard disk.
  • the present application discloses a method for simulating plugging and unplugging a hard disk, which is applied to a host computer, including:
  • the card slot is provided with an electrical signal for representing the state of the electrical connection, and the operating system is notified to remove the hard disk, so that the baseboard management controller obtains the electrical signal and the presence signal of the hard disk after the hard disk is removed;
  • obtaining the register information of the card slot, and then judging whether PCIE supports hot plug operation based on the register information in the operating system including:
  • judging whether PCIE supports hot plug operation based on the flag bit in the operating system includes:
  • the preset result includes hotplug+ and Surprise+.
  • the card slot is provided with an electrical signal representing the state of the electrical connection, and the operating system is notified to remove the hard disk, so that the baseboard management controller obtains the electrical signal and the presence signal of the hard disk after the hard disk is removed, including:
  • judging whether the electrical signal is an electrical signal representing a preset electrical connection state to obtain a corresponding judgment result, and then setting a corresponding electrical signal to the card slot based on the judgment result includes:
  • the electrical signal in the card slot remains unchanged.
  • judging whether the electrical signal is an electrical signal representing a preset electrical connection state to obtain a corresponding judgment result, and then setting a corresponding electrical signal to the card slot based on the judgment result includes:
  • an electrical signal corresponding to the first preset electrical connection state is set to the card slot.
  • receiving the in-position signal sent by the baseboard management controller, using the baseboard management controller to obtain the register address corresponding to the hard disk, and sending a command to change the in-position signal to the hard disk to obtain the corresponding command execution result, and returning the command execution result to the register including:
  • the current in-position signal is opposite to the in-position signal corresponding to the first preset electrical connection state
  • the baseboard management controller calculates the register address corresponding to the slot number of the hard disk, and sends a command to change the in-position signal to the hard disk to obtain the target in-position signal corresponding to the first preset electrical connection state, and returns the target in-position signal to the register.
  • the baseboard management controller is used to send the command to change the in-position signal to the hard disk again, and change the preset electrical signal in the card slot, including:
  • the present application discloses a hard disk simulation plug-in device, which is applied to a host computer, including:
  • a judging module is used to obtain the register information of the card slot, and then judge whether the PCIE supports hot plug operation based on the register information in the operating system;
  • An electrical signal setting module configured to set an electrical signal for representing an electrical connection state to the card slot in response to PCIE supporting a hot-swap operation;
  • the hard disk removal module is used to notify the operating system to remove the hard disk, so that the baseboard management controller can obtain the electrical signal and the presence signal of the hard disk after the hard disk is removed;
  • the first command sending module is used to receive the in-position signal sent by the baseboard management controller, use the baseboard management controller to obtain the register address corresponding to the hard disk, and send a command to change the in-position signal to the hard disk to obtain a corresponding command execution result, and return the command execution result to the register;
  • the second command sending module is used to use the baseboard management controller to send the command for changing the in-position signal to the hard disk again, and change the preset electrical signal in the card slot.
  • the present application discloses an electronic device, including: a memory and one or more processors, wherein computer-readable instructions are stored in the memory, and when the computer-readable instructions are executed by the one or more processors, the one or more processors execute the steps of the hard disk simulation insertion and removal method described above.
  • the present application discloses one or more non-volatile computer-readable storage media storing computer-readable instructions.
  • the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the above hard disk simulation plugging method.
  • FIG. 1 is a flowchart of a hard disk simulation plugging method disclosed in one or more embodiments of the present application
  • FIG. 2 is a flow chart of a specific hard disk simulation plugging method disclosed in one or more embodiments of the present application
  • FIG. 3 is a flowchart of a specific hard disk simulation plugging method disclosed in one or more embodiments of the present application
  • FIG. 4 is a flow chart of a specific hard disk simulation plugging method disclosed in one or more embodiments of the present application.
  • FIG. 5 is a schematic structural diagram of a hard disk simulation plug-in device provided by one or more embodiments of the present application.
  • Fig. 6 is a structural diagram of an electronic device provided by one or more embodiments of the present application.
  • NVMe SSD has entered a period of mass business deployment from the experimental stage, and hot swapping has become very critical.
  • NVMe SSDs can be placed directly on the front panel like SATA/SAS hard drives.
  • NVMe SSDs must support hot swapping.
  • the existing violent hot-swapping method greatly damages the NVME hard disk, and brings catastrophic damage to the NMVE hard disk.
  • the present application provides a method for simulating hard disk insertion and removal, which can simulate the hot-swap operation of the hard disk and reduce the damage to the hard disk caused by violent insertion and removal.
  • the embodiment of the present application discloses a method for simulating plugging and unplugging a hard disk, as shown in Figure 1, which is applied to a host, and the method includes:
  • Step S11 Acquiring the register information of the card slot, and then judging whether the PCIE supports hot plug operation based on the register information in the operating system.
  • the register information of the card slot includes a flag bit used to indicate whether the hot plug operation is supported. Simultaneously, have only just can carry out follow-up operation when being used for indicating whether to support hot-swap operation flag bit display PCIE supports hot-swap operation, if when being used for indicating whether to support hot-swap operation display PCIE does not support hot-swap operation, end all operations.
  • Step S12 When the PCIE supports hot-swapping operations, set an electrical signal for representing the electrical connection status to the card slot, and notify the operating system to remove the hard disk, so that the baseboard management controller can obtain the electrical signal and the presence signal of the hard disk after the hard disk is removed.
  • an electrical signal representing the electrical connection status is set to the card slot, and the operating system is notified to remove the hard disk, so that the baseboard management controller obtains the electrical signal and the presence signal of the hard disk after the hard disk is removed. That is, in response to the PCIE supporting the hot plug operation, an electrical signal representing an electrical connection state is set to the card slot, and the operating system is notified to remove the hard disk.
  • PCIE when PCIE supports hot-swapping operations, first obtain the presence status of the current hard disk, and then determine whether to set an electrical signal for representing the electrical connection status to the card slot based on the presence status, and then notify the operating system to remove the hard disk, so that the baseboard management controller can obtain the electrical signal and the presence signal of the hard disk after the hard disk is removed.
  • the electrical signal on the card slot used to represent the electrical connection state is set to 0.
  • the electrical signal for representing the electrical connection state on the card slot is not set, and the operating system is directly notified to remove the hard disk.
  • the result of the electrical signal used to characterize the electrical connection state is 1 or 0, 1 indicates a power-on state, and 0 indicates a power-off state.
  • Step S13 Receive the in-position signal sent by the baseboard management controller, use the baseboard management controller to obtain the register address corresponding to the hard disk, and send a command to change the in-position signal to the hard disk to obtain the corresponding command execution result, and return the command execution result to the register.
  • the baseboard management controller after receiving the in-position signal sent by the baseboard management controller, the baseboard management controller is used to obtain the register address corresponding to the hard disk, and send a command to change the in-position signal to the hard disk. It can be understood that after receiving the in-position signal sent by the baseboard management controller, judge whether the hard disk is still in place according to the in-position signal. If it is determined that the hard disk is still in place according to the in-position signal, send a command to change the in-position signal to the hard disk to change the in-position signal of the hard disk. The changed in-position signal is the command execution result, and then return the changed in-position signal to the register.
  • Step S14 Utilize the baseboard management controller to send the command to change the in-position signal to the hard disk again, and change the preset electrical signal in the card slot.
  • the baseboard management controller is used to send the command to change the in-position signal to the hard disk again, and the preset electrical signal in the card slot is changed.
  • the command to change the presence signal is sent again to simulate different operations from the previous command. For example, when the previous command is to change the presence signal from presence to absence, the command to change the presence signal is to change the presence signal from absence to presence, and at the same time change the preset electrical signal in the card slot to complete the corresponding simulation test.
  • the present application provides a hard disk simulation plugging method, including: obtaining the register information of the card slot, and then judging in the operating system whether the PCIE supports hot-swapping operation based on the register information; when the PCIE supports the hot-swapping operation, setting an electrical signal for representing the electrical connection state to the card slot, and notifying the operating system to remove the hard disk, so that the baseboard management controller obtains the electrical signal and the in-position signal of the hard disk after the hard disk is removed; The corresponding command execution result is returned to the register; the baseboard management controller is used to send the command to change the in-position signal to the hard disk again, and the preset electrical signal in the card slot is changed.
  • the present application judges whether the hot-swapping operation is currently supported through the information in the register.
  • the plugging and unplugging of the hard disk is simulated by changing the electrical signal used to represent the electrical connection state and the in-position signal of the hard disk.
  • the embodiment of the present application discloses a method for simulating hard disk insertion and removal. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
  • Step S21 Use the lspci command to obtain the register information of the card slot, so as to obtain the flag bit for judging whether the PCIE supports hot plugging.
  • the lspci command is used to obtain the register information of the card slot, read the register information, and obtain the flag bit stored in the register information for judging whether the PCIE supports hot plugging.
  • the command to obtain the register information of the card slot may also be other commands.
  • the PCIe Spec also known as CEM Spec
  • the main contents of the Spec include Auxiliary Signals, Add-in Card Hot Insertion and Removal, Power Delivery, Add-in Card Electrical Budget, Connector Specification and PCIe Card shape and size specifications (Card Form Factors and Implementation), etc.
  • HotPlug and Surprise are the most basic flags for judging hot plugging.
  • the register information is Capabilities (performance) register information.
  • Step S22 In the operating system, it is judged based on the flag bit whether the PCIE supports hot plug operation.
  • PCIE supports hot plug operation in OS (Operating System, operating system). It can be understood that whether the PCIE supports the hot-swap operation is determined based on the flag bit obtained from the register information of the card slot for determining whether the PCIE supports the hot-swap operation.
  • the flag bit is the preset result, it is determined that the PCIE supports hot plug operation; the preset result includes hotplug+ and Surprise+.
  • NVMe is directly connected to the PCIe Bus, and the U.2 interface is also directly connected to PCIe, but some PCIe card slots connected to the U.2 interface do not support hot swapping.
  • the flag bit is different from the preset result, it indicates that hot plugging is not supported at this time, and all operations are terminated.
  • Step S23 when the PCIE supports the hot plug operation, obtain an electrical signal in the card slot for representing the electrical connection state.
  • an electrical signal used to represent an electrical connection state in the card slot is acquired. It can be understood that the current power-on state is judged by the electrical signal used to represent the electrical connection state in the card slot, and the display of the electrical signal is 0 or 1, wherein, when the electrical signal is displayed as 0, it indicates that it is currently in a power-off state, and when the electrical signal is displayed as 1, it indicates that it is currently in a power-on state.
  • Step S24 Judging whether the electrical signal is an electrical signal representing the first preset electrical connection state to obtain a corresponding judgment result, and then setting a corresponding electrical signal to the card slot based on the judgment result, and notifying the operating system to remove the hard disk, so that the baseboard management controller obtains the electrical signal and the presence signal of the hard disk through a preset channel after the hard disk is removed.
  • the electrical signal is an electrical signal representing the first preset electrical connection state, so as to obtain a corresponding determination result. Responding to the electrical signal representing the first preset electrical connection state, keeping the electrical signal in the card slot unchanged, and responding to the electrical signal not representing the first preset electrical connection state, setting an electrical signal corresponding to the first preset electrical connection state to the card slot.
  • the electrical signal is an electrical signal representing a power-off state, that is, it is determined whether the electrical signal is displayed as 0.
  • the electrical signal is 0, it indicates that it is in the power-off state, and the electrical signal in the card slot remains unchanged; when the electrical signal is 1, it indicates that it is still in the power-on state, and the electrical signal is changed from 1 to 0.
  • Step S25 Receive the in-position signal sent by the baseboard management controller, use the baseboard management controller to obtain the register address corresponding to the hard disk, and send a command to change the in-position signal to the hard disk to obtain the corresponding command execution result, and return the command execution result to the register.
  • Step S26 Utilize the baseboard management controller to send the command to change the in-position signal to the hard disk again, and change the preset electrical signal in the card slot.
  • the embodiment of the present application judges whether hot swapping is supported through the flag bit used to judge whether PCIE supports hot swapping in the register information. If it supports it, the electrical signal used to represent the electrical connection state in the card slot is obtained, and then it is judged whether the electrical signal is an electrical signal representing the first preset electrical connection state. Based on the judgment result, a corresponding electrical signal is set to the card slot, and the operating system is notified to remove the hard disk. Hard disk, reducing the damage to the hard disk.
  • the embodiment of the present application discloses a method for simulating hard disk insertion and removal. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.
  • Step S31 Acquiring the register information of the card slot, and then judging whether the PCIE supports hot plug operation based on the register information in the operating system.
  • Step S32 When the PCIE supports hot-swapping operations, set an electrical signal for representing the electrical connection status to the card slot, and notify the operating system to remove the hard disk, so that the baseboard management controller can obtain the electrical signal and the presence signal of the hard disk after the hard disk is removed.
  • Step S33 Receive the current in-position signal sent by the baseboard management controller, and read the slot number of the hard disk; the current in-position signal is opposite to the in-position signal corresponding to the first preset electrical connection state.
  • the baseboard management controller after receiving the current in-position signal sent by the baseboard management controller, it is determined based on the in-position signal whether the hard disk is still in position. It can be understood that when the presence signal is 1, it indicates that the current hard disk is still in place, that is, it has not been pulled out; when the presence signal is 0, it indicates that the current hard disk is not in place, that is, it has been pulled out. Read the slot number of the hard disk, so as to obtain the corresponding register address based on the slot number.
  • Step S34 Use the baseboard management controller to calculate the register address corresponding to the slot number of the hard disk, and send a command to change the presence signal to the hard disk to obtain the target presence signal corresponding to the first preset electrical connection state, and return the target presence signal to the register.
  • the baseboard management controller is used to calculate the register address corresponding to the slot number of the hard disk, and send a command to change the in-position signal to the hard disk to obtain the target in-position signal corresponding to the first preset electrical connection state, and return the target in-position signal to the register.
  • the in-position signal does not match the in-position signal corresponding to the first preset electrical connection state, the corresponding analog unplugging operation is not completed. For example, if the current in-position signal is 1, it means that the card slot is powered off but the hard disk is still in place.
  • Send a command to change the in-position signal to the hard disk change the in-position signal from 1 to 0, and return the result 0 to the register.
  • the electrical signal shows that the card slot has been powered off, and the in-position signal shows that the hard disk has been pulled out, indicating that the analog hard drive has been pulled out.
  • Step S35 Utilize the baseboard management controller to send the command to change the in-position signal to the hard disk again, and change the preset electrical signal in the card slot.
  • the baseboard management controller wait for a preset time, and use the baseboard management controller to send the command to change the in-position signal to the hard disk again, so as to change the target in-position signal, and change the preset electrical signal in the card slot to the electrical signal corresponding to the second preset electrical connection state.
  • the operation opposite to the previous operation is simulated so as to make the test more comprehensive. For example, when the command sent to the hard disk for the first time is to change the in-position signal to display the unplugged in-position signal, then the command sent to the hard disk again is to change the in-position signal to display the unplugged in-position signal.
  • the preset electrical signal in the card slot is changed to an electrical signal corresponding to the second preset electrical connection state, for example, the electrical signal is changed to an electrical signal indicating power-on, simulating the operation of inserting a hard disk.
  • the embodiment of the present application reads the slot number of the hard disk by receiving the current in-position signal sent by the baseboard management controller, and then uses the baseboard management controller to calculate the register address corresponding to the slot number of the hard disk, and sends a command to change the in-position signal to the hard disk to simulate the hard disk unplugging operation. Then, the baseboard management controller sends the command to change the in-position signal to the hard disk again, and changes the preset electrical signal in the card slot to simulate the hard disk insertion operation. Based on the change of the signal, the plugging and unplugging status of the real simulated hard disk does not need to be pulled out, which reduces the damage to the hard disk, improves the labor efficiency and enhances the stability of the test data.
  • the embodiment of the present application also discloses a hard disk simulation plugging device, which is applied to the host computer, including:
  • Judging module 11 is used to obtain the register information of the card slot, and then judges whether PCIE supports hot plug operation based on the register information in the operating system;
  • the electrical signal setting module 12 is used to set the electrical signal for representing the electrical connection state to the card slot when the PCIE supports hot plug operation;
  • the hard disk removal module 13 is configured to notify the operating system to remove the hard disk, so that the baseboard management controller obtains an electrical signal and an in-position signal of the hard disk after the hard disk is removed;
  • the first command sending module 14 is configured to receive the in-position signal sent by the baseboard management controller, use the baseboard management controller to obtain the register address corresponding to the hard disk, and send a command to change the in-position signal to the hard disk to obtain a corresponding command execution result, and return the command execution result to the register;
  • the second command sending module 15 is configured to use the baseboard management controller to send the command for changing the in-position signal to the hard disk again, and change the preset electrical signal in the card slot.
  • the present application includes: obtaining the register information of the card slot, and then judging in the operating system whether the PCIE supports hot-swapping operation based on the register information; when the PCIE supports the hot-swapping operation, setting an electrical signal for representing the electrical connection state to the card slot, and notifying the operating system to remove the hard disk, so that the baseboard management controller obtains the electrical signal and the in-position signal of the hard disk after the hard disk is removed; Return to the register; use the baseboard management controller to send the command to change the in-position signal to the hard disk again, and change the preset electrical signal in the card slot.
  • the present application judges whether the hot-swapping operation is currently supported through the information in the register.
  • the plugging and unplugging of the hard disk is simulated by changing the electrical signal used to represent the electrical connection state and the in-position signal of the hard disk.
  • the judging module 11 specifically includes:
  • the information acquisition unit is used to acquire the register information of the card slot by using the lspci command;
  • a flag bit acquisition unit is used to acquire a flag bit for judging whether PCIE supports hot plugging
  • the hot-swap judging unit is used to judge whether the PCIE supports hot-swap operation based on flag bits in the operating system.
  • the electrical signal setting module 12 specifically includes:
  • the electrical signal acquisition unit is used to acquire the electrical signal used to represent the electrical connection state in the card slot when the PCIE supports hot plug operation;
  • An electrical signal judging unit configured to judge whether the electrical signal is an electrical signal representing a first preset electrical connection state, so as to obtain a corresponding judgment result
  • the electric signal setting unit is used for setting a corresponding electric signal to the card slot based on the judgment result.
  • the first command sending module 14 specifically includes:
  • the in-position signal receiving unit is configured to receive the current in-position signal sent by the baseboard management controller
  • the slot number reading unit is used to read the slot number of the hard disk
  • the address calculation unit is used to calculate the register address corresponding to the slot number of the hard disk by using the baseboard management controller;
  • the first command sending unit is used to send a command to change the in-position signal to the hard disk to obtain a target in-position signal corresponding to the first preset electrical connection state, and return the target in-position signal to the register.
  • FIG. 6 is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram should not be regarded as any limitation on the application scope of the present application.
  • FIG. 6 is a schematic structural diagram of an electronic device 20 provided by an embodiment of the present application.
  • the electronic device 20 may specifically include: at least one processor 21 , at least one memory 22 , a power supply 23 , a communication interface 24 , an input/output interface 25 and a communication bus 26 .
  • the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement relevant steps in the hard disk simulation insertion and removal method disclosed in any of the foregoing embodiments.
  • the electronic device 20 in this embodiment may specifically be an electronic computer.
  • the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20;
  • the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of the present application, which is not specifically limited here;
  • the input and output interface 25 is used to obtain external input data or output data to the external world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
  • the memory 22, as a resource storage carrier can be a read-only memory, random access memory, magnetic disk or optical disk, etc., and the resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
  • the operating system 221 is used to manage and control each hardware device on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc.
  • the computer program 222 may further include a computer program capable of completing other specific tasks in addition to the computer program capable of completing the hard disk simulation plugging method performed by the electronic device 20 disclosed in any of the foregoing embodiments.
  • the embodiment of the present application also discloses a storage medium, in which a computer program is stored.
  • a computer program is stored.
  • the steps of the hard disk simulation insertion and removal method disclosed in any of the foregoing embodiments are implemented.
  • each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other.
  • the description is relatively simple, and for relevant details, please refer to the description of the method part.

Abstract

一种硬盘模拟插拔方法、装置、设备及存储介质,包括:获取卡槽的寄存器信息,基于寄存器信息判断PCIE是否支持热插拔操作(S11);当支持时,则对卡槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号(S12);接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,向硬盘发送更改在位信号的命令,得到相应的命令执行结果并将命令执行结果返回至寄存器(S13);利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号(S14)。通过更改寄存器信息中的电信号与在位信号,模拟硬盘的热插拔操作,减少暴力插拔给硬盘带来的损害。

Description

一种硬盘模拟插拔方法、装置、设备及存储介质
相关申请的交叉引用
本申请要求于2022年01月18日提交中国专利局,申请号为202210051776.0,申请名称为“一种硬盘模拟插拔方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据存储领域,特别涉及一种硬盘模拟插拔方法、装置、设备及存储介质。
背景技术
热插拔是日常生活中发生次数较多的操作。例如,将一块U盘(USB flash disk,USB闪存驱动器)从PC(personal computer,个人计算机)中拔出,将一个鼠标从一台电脑换到另一台电脑。对于数据中心的运维人员来说,更换硬盘也是一件很频繁的事情。
NVMe(Non-Volatile Memory express,非易失性内存主机控制器接口规范)SSD(Solid State Drives,固态硬盘)已经从实验阶段进入到大量业务部署时期,热插拔变得非常关键。最开始NVMe SSD只是以PCIe(peripheral component interconnect express,一种高速串行计算机扩展总线标准)接口的形式出现,跟网卡一样放在背板的卡槽上固定,这种形态的NVMe不适合热插拔。随着U.2接口的推出,NVMe SSD可以直接如SATA(Serial Advanced Technology Attachment,一种计算机总线)/SAS(Serial Attached SCSI,新一代的SCSI技术)硬盘一样放置在前面板,此时的NVMe SSD对热插拔的支持变得理所当然而且必须。但是现有暴力热插拔方式缺少是否支持插拔的判断,人工效率低,测试次数少,对NMVE硬盘带来了灾难性的损害。
发明内容
第一方面,本申请公开了一种硬盘模拟插拔方法,应用于主机,包括:
获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作;
响应于PCIE支持热插拔操作,对卡槽设置用于表征电连接状态的电信号,并通知操作 系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号;
接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将命令执行结果返回至寄存器;和
利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。
在一个实施例中,获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作,包括:
利用lspci命令获取卡槽的寄存器信息,以便获取用于判断PCIE是否支持热插拔的标志位;和
在操作系统中基于标志位判断PCIE是否支持热插拔操作。
在一个实施例中,在操作系统中基于标志位判断PCIE是否支持热插拔操作,包括:
响应于标志位为预设结果,判定PCIE支持热插拔操作;预设结果包含hotplug+以及Surprise+。
在一个实施例中,PCIE支持热插拔操作时,对卡槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号,包括:
响应于PCIE支持热插拔操作,获取卡槽中用于表征电连接状态的电信号;和
判断电信号是否为表征第一预设电连接状态的电信号,以得到相应的判断结果,然后基于判断结果对卡槽设置相应的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后通过预设通道获取电信号以及硬盘的在位信号。
在一个实施例中,判断电信号是否为表征预设电连接状态的电信号,以得到相应的判断结果,然后基于判断结果对卡槽设置相应的电信号,包括:
响应于电信号为表征第一预设电连接状态的电信号,保持卡槽中的电信号不变。
在一个实施例中,判断电信号是否为表征预设电连接状态的电信号,以得到相应的判断结果,然后基于判断结果对卡槽设置相应的电信号,包括:
响应于电信号不是表征第一预设电连接状态的电信号,对卡槽设置与第一预设电连接状态对应的电信号。
在一个实施例中,接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将 命令执行结果返回至寄存器,包括:
接收基板管理控制器发送的当前在位信号,并读取硬盘的槽位号;当前在位信号与第一预设电连接状态对应的在位信号呈相反状态;和
利用基板管理控制器计算硬盘的槽位号对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到与第一预设电连接状态对应的目标在位信号,并将目标在位信号返回至寄存器。
在一个实施例中,利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号,包括:
等待预设时间,利用基板管理控制器向硬盘再次发送更改在位信号的命令,以便更改目标在位信号,并将卡槽中预设的电信号更改为与第二预设电连接状态对应的电信号。
第二方面,本申请公开了一种硬盘模拟插拔装置,应用于主机,包括:
判断模块,用于获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作;
电信号设置模块,用于响应于PCIE支持热插拔操作,对卡槽设置用于表征电连接状态的电信号;
硬盘移除模块,用于通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号;
第一命令发送模块,用于接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将命令执行结果返回至寄存器;
第二命令发送模块,用于利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。
第三方面,本申请公开了一种电子设备,包括:存储器及一个或多个处理器,存储器中储存有计算机可读指令,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述硬盘模拟插拔方法的步骤。
第四方面,本申请公开了一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述硬盘模拟插拔方法的步骤。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。
图1为本申请一个或多个实施例公开的一种硬盘模拟插拔方法流程图;
图2为本申请一个或多个实施例公开的一种具体的硬盘模拟插拔方法流程图;
图3为本申请一个或多个实施例公开的一种具体的硬盘模拟插拔方法流程图;
图4为本申请一个或多个实施例公开的一种具体的硬盘模拟插拔方法流程图;
图5为本申请一个或多个实施例提供的硬盘模拟插拔装置结构示意图;
图6为本申请一个或多个实施例提供的一种电子设备结构图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
目前NVMe SSD已经从实验阶段进入到大量业务部署时期,热插拔变得非常关键。随着U.2接口的推出,NVMe SSD可以直接如SATA/SAS硬盘一样放置在前面板,此时的NVMe SSD必须支持热插拔。但是现有暴力热插拔方式极大的损害NVME硬盘,对NMVE硬盘带来了灾难性的损害。为此,本申请提供了一种硬盘模拟插拔方法,能够模拟硬盘的热插拔操作,减少暴力插拔给硬盘带来的损害。
本申请实施例公开了一种硬盘模拟插拔方法,参见图1所示,应用于主机,该方法包括:
步骤S11:获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作。
本实施例中,首先获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作。可以理解的是,卡槽的寄存器信息包含用于表征是否支持热插拔操作的标志位。同时,只有当用于表征是否支持热插拔操作的标志位显示PCIE支持热插拔操作时才可以进行后续操作,若用于表征是否支持热插拔操作的标志位显示PCIE不支持热插拔操作时,结束所有操作。
步骤S12:当PCIE支持热插拔操作时,对卡槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号。
本实施例中,当PCIE支持热插拔操作时,对卡槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号。也即是,响应于PCIE支持热插拔操作,对卡槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘。可以理解的是,当PCIE支持热插拔操作时,首先获取当前硬盘的在位情况,再基于在位情况判断是否对卡槽设置用于表征电连接状态的电信号,然后通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号。例如当前硬盘的在位情况为在位时,则将卡槽上用于表征电连接状态的电信号设置为0。当前硬盘的在位情况为不在位时,则不对卡槽上用于表征电连接状态的电信号进行设置,直接通知操作系统移除硬盘。需要指出的是,用于表征电连接状态的电信号结果为1或0,1表示上电状态,0表示下电状态。
步骤S13:接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将命令执行结果返回至寄存器。
本实施例中,接收基板管理控制器发送的在位信号之后,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令。可以理解的是,接收基板管理控制器发送的在位信号之后,根据在位信号判断硬盘当前是否仍旧在位,若根据在位信号确定硬盘当前仍旧在位,则向硬盘发送更改在位信号的命令,改变硬盘的在位信号,得到的改变后在位信号即为命令执行结果,然后将改变后在位信号返回至寄存器,寄存器中改变用于表征在位信号的标志,完成相应的模拟操作。
步骤S14:利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。
本实施例中,利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。可以理解的是,再次发送更改在位信号的命令用来模拟与前一命令不同的操作,例如当前一命令为将在位信号由在位更改为不在位时,再次发送的更改在位信号的命令则是将在位信号由不在位更改为在位,同时更改卡槽中预设的电信号,完成相应的模拟测试。
可见,本申请提供了一种硬盘模拟插拔方法,包括:获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作;当PCIE支持热插拔操作时,对卡 槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号;接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将命令执行结果返回至寄存器;利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。由此可见,本申请通过寄存器中的信息判断当前是否支持热插拔操作,当寄存器中的信息显示支持热插拔操作时,通过更改用于表征电连接状态的电信号与硬盘的在位信号来模拟硬盘的插拔,基于信号的改变真实模拟硬盘的插拔状态,无需真实拔出硬盘,减少了对硬盘的损害,提高了人工效率且增强了测试数据稳定性。
参见图2所示,本申请实施例公开了一种硬盘模拟插拔方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。
步骤S21:利用lspci命令获取卡槽的寄存器信息,以便获取用于判断PCIE是否支持热插拔的标志位。
本实施例中,利用lspci命令获取卡槽的寄存器信息,读取寄存器信息,获取存储于寄存器信息中的用于判断PCIE是否支持热插拔的标志位。可以理解的是,获取卡槽的寄存器信息的命令也可以为其他命令。需要指出的是,PCIe Spec(又称为CEM Spec)规定了热插拔寄存器,该Spec主要内容包括辅助信号(Auxiliary Signals)、热插拔(Add-in Card Hot Insertion and Removal)、电源传递(Power Delivery)、PCIe卡电气规范(Add-in Card Electrical Budget)、连接器规范(Connector Specification)和PCIe卡的外形与尺寸规范(Card Form Factors and Implementation)等。其中HotPlug和Surprise是最基础的判断热插拔的标志位。寄存器信息中的SltSta上有一个PresDet位用于指示当前是否有PCIe设备插入卡槽。例如,寄存器信息为Capabilities(性能)寄存器信息。
步骤S22:在操作系统中基于标志位判断PCIE是否支持热插拔操作。
本实施例中,在OS(Operating System,操作系统)中确认PCIE是否支持热插拔操作。可以理解的是,基于从卡槽的寄存器信息中获取的用于判断PCIE是否支持热插拔的标志位判断PCIE是否支持热插拔操作。当标志位为预设结果时,则判定PCIE支持热插拔操作;预设结果包含hotplug+以及Surprise+。需要指出的是,NVMe是直接连接到PCIe Bus上的,U.2接口也是直接跟PCIe相连,但是某些U.2接口内部连接的PCIe卡槽并不支持热插拔。当标志位与预设结果不同时,即表明此时不支持热插拔,则结束所有操作。
步骤S23:当PCIE支持热插拔操作时,获取卡槽中用于表征电连接状态的电信号。
本实施例中,响应于PCIE支持热插拔操作,获取卡槽中用于表征电连接状态的电信号。可以理解的是,通过卡槽中用于表征电连接状态的电信号判断当前的上电状态,电信号的显示为0或1,其中,当电信号显示为0时,表明当前处于下电状态,当电信号显示为1时,表明当前处于上电状态。
步骤S24:判断电信号是否为表征第一预设电连接状态的电信号,以得到相应的判断结果,然后基于判断结果对卡槽设置相应的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后通过预设通道获取电信号以及硬盘的在位信号。
本实施例中,判断电信号是否为表征第一预设电连接状态的电信号,以得到相应的判断结果。响应于电信号为表征第一预设电连接状态的电信号,保持卡槽中的电信号不变,响应于电信号不是表征第一预设电连接状态的电信号,对卡槽设置与第一预设电连接状态对应的电信号。可以理解的是,如图3所示,若当前操作为模拟硬盘拔出的操作时,则判断电信号是否为表征下电状态的电信号,也即,判断电信号是否显示为0。当电信号为0时,则表明已处于下电状态,保持卡槽中的电信号不变,当电信号为1时,则表明当前仍处于上电状态,将设置电信号从1变为0。
需要指出的是,当PCIE支持热插拔操作时,带有I/O(Input/Output,输入/输出)的设备在进行热插拔时,Linux Block(块)层与PCIe热插拔的配合问题会导致系统中某些进程block,或者系统crash(崩溃),所以需要进行设置卡槽中用于表征第一预设电连接状态的电信号,并在拔出硬盘之前通知操作系统先移除设备。移除设备之后,BMC(Baseboard Manager Controller,基板管理控制器)通过I2C(一种串行通讯总线)通道,获取硬盘卡槽的电信号以及在位信号。
步骤S25:接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将命令执行结果返回至寄存器。
步骤S26:利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。
关于上述步骤S25、S26的具体内容可以参考前述实施例中公开的相应内容,在此不再进行赘述。
可见,本申请实施例通过寄存器信息中用于判断PCIE是否支持热插拔的标志位来判断是否支持热插拔,若支持则获取卡槽中用于表征电连接状态的电信号,然后判断电信号是否为表征第一预设电连接状态的电信号,基于判断结果对卡槽设置相应的电信号,并通知操作 系统移除硬盘,最后利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,基于信号的改变真实模拟硬盘的插拔状态,无需真实拔出硬盘,减少了对硬盘的损害。
参见图4所示,本申请实施例公开了一种硬盘模拟插拔方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。
步骤S31:获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作。
步骤S32:当PCIE支持热插拔操作时,对卡槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号。
步骤S33:接收基板管理控制器发送的当前在位信号,并读取硬盘的槽位号;当前在位信号与第一预设电连接状态对应的在位信号呈相反状态。
本实施例中,接收基板管理控制器发送的当前在位信号之后,基于在位信号判断硬盘是否仍旧在位。可以理解的是,当在位信号为1时则表明当前硬盘仍在位,即未拔出;当在位信号为0则表明当前硬盘不在位,即已拔出。读取硬盘的槽位号,以便基于槽位号获取对应的寄存器地址。
步骤S34:利用基板管理控制器计算硬盘的槽位号对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到与第一预设电连接状态对应的目标在位信号,并将目标在位信号返回至寄存器。
本实施例中,利用基板管理控制器计算硬盘的槽位号对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到与第一预设电连接状态对应的目标在位信号,并将目标在位信号返回至寄存器。可以理解的是,由于此时在位信号与第一预设电连接状态对应的在位信号不符,因此没有完成相应的模拟拔出操作。例如,若当前在位信号为1,则表明此时卡槽已下电但是硬盘仍在位,向硬盘发送更改在位信号的命令,将在位信号由1改为0,并返回结果0至寄存器,此时电信号显示卡槽已下电,在位信号显示硬盘已拔出,表明模拟硬盘拔出操作已完成。
步骤S35:利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。
本实施例中,等待预设时间,利用基板管理控制器向硬盘再次发送更改在位信号的命令,以便更改目标在位信号,并将卡槽中预设的电信号更改为与第二预设电连接状态对应的电信号。可以理解的是,通过向硬盘再次发送更改在位信号的命令,模拟与前一次操作相反 的操作,以便使得测试更加全面。例如,当第一次向硬盘发送的命令为将在位信号改为显示拔出的在位信号时,则再次向硬盘发送的命令则为将在位信号改为显示未拔出的在位信号。同时将卡槽中预设的电信号更改为与第二预设电连接状态对应的电信号,例如将电信号改为显示上电的电信号,模拟硬盘插入的操作。
关于上述步骤S31、S32的具体内容可以参考前述实施例中公开的相应内容,在此不再进行赘述。
可见,本申请实施例通过接收基板管理控制器发送的当前在位信号,读取硬盘的槽位号,然后利用基板管理控制器计算硬盘的槽位号对应的寄存器地址,向硬盘发送更改在位信号的命令模拟硬盘拔出操作。然后利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号来模拟硬盘插入操作。基于信号的改变真实模拟硬盘的插拔状态,无需真实拔出硬盘,减少了对硬盘的损害,提高了人工效率且增强了测试数据稳定性。
参见图5所示,本申请实施例还相应公开了一种硬盘模拟插拔装置,应用于主机,包括:
判断模块11,用于获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作;
电信号设置模块12,用于当PCIE支持热插拔操作时,对卡槽设置用于表征电连接状态的电信号;
硬盘移除模块13,用于通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号;
第一命令发送模块14,用于接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将命令执行结果返回至寄存器;
第二命令发送模块15,用于利用基板管理控制器向硬盘再次发送更改在位信号的命令,并更改卡槽中预设的电信号。可见,本申请包括:获取卡槽的寄存器信息,然后在操作系统中基于寄存器信息判断PCIE是否支持热插拔操作;当PCIE支持热插拔操作时,对卡槽设置用于表征电连接状态的电信号,并通知操作系统移除硬盘,以便基板管理控制器在硬盘移除后获取电信号以及硬盘的在位信号;接收基板管理控制器发送的在位信号,利用基板管理控制器获取硬盘对应的寄存器地址,并向硬盘发送更改在位信号的命令,以得到相应的命令执行结果,并将命令执行结果返回至寄存器;利用基板管理控制器向硬盘再次发送更改 在位信号的命令,并更改卡槽中预设的电信号。由此可见,本申请通过寄存器中的信息判断当前是否支持热插拔操作,当寄存器中的信息显示支持热插拔操作时,通过更改用于表征电连接状态的电信号与硬盘的在位信号来模拟硬盘的插拔,基于信号的改变真实模拟硬盘的插拔状态,无需真实拔出硬盘,减少了对硬盘的损害,提高了人工效率且增强了测试数据稳定性。
在一些具体实施例中,判断模块11,具体包括:
信息获取单元,用于利用lspci命令获取卡槽的寄存器信息;
标志位获取单元,用于获取用于判断PCIE是否支持热插拔的标志位;
热插拔判断单元,用于在操作系统中基于标志位判断PCIE是否支持热插拔操作。
在一些具体实施例中,电信号设置模块12,具体包括:
电信号获取单元,用于当PCIE支持热插拔操作时,获取卡槽中用于表征电连接状态的电信号;
电信号判断单元,用于判断电信号是否为表征第一预设电连接状态的电信号,以得到相应的判断结果;
电信号设置单元,用于基于判断结果对卡槽设置相应的电信号。
在一些具体实施例中,第一命令发送模块14,具体包括:
在位信号接收单元,用于接收基板管理控制器发送的当前在位信号;
槽位号读取单元,用于读取硬盘的槽位号;
地址计算单元,用于利用基板管理控制器计算硬盘的槽位号对应的寄存器地址;
第一命令发送单元,用于向硬盘发送更改在位信号的命令,以得到与第一预设电连接状态对应的目标在位信号,并将目标在位信号返回至寄存器。
进一步的,本申请实施例还提供了一种电子设备。图6是根据一示例性实施例示出的电子设备20结构图,图中的内容不能认为是对本申请的使用范围的任何限制。
图6为本申请实施例提供的一种电子设备20的结构示意图。该电子设备20,具体可以包括:至少一个处理器21、至少一个存储器22、电源23、通信接口24、输入输出接口25和通信总线26。其中,存储器22用于存储计算机程序,计算机程序由处理器21加载并执行,以实现前述任一实施例公开的硬盘模拟插拔方法中的相关步骤。另外,本实施例中的电子设备20具体可以为电子计算机。
本实施例中,电源23用于为电子设备20上的各硬件设备提供工作电压;通信接口24能够为电子设备20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申 请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。
另外,存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,其上所存储的资源可以包括操作系统221、计算机程序222等,存储方式可以是短暂存储或者永久存储。
其中,操作系统221用于管理与控制电子设备20上的各硬件设备以及计算机程序222,其可以是Windows Server、Netware、Unix、Linux等。计算机程序222除了包括能够用于完成前述任一实施例公开的由电子设备20执行的硬盘模拟插拔方法的计算机程序之外,还可以进一步包括能够用于完成其他特定工作的计算机程序。
进一步的,本申请实施例还公开了一种存储介质,存储介质中存储有计算机程序,计算机程序被处理器加载并执行时,实现前述任一实施例公开的硬盘模拟插拔方法步骤。
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上对本申请所提供的一种硬盘模拟插拔方法、装置、设备及存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为对本申请的限制。

Claims (11)

  1. 一种硬盘模拟插拔方法,其特征在于,应用于主机,包括:
    获取卡槽的寄存器信息,然后在操作系统中基于所述寄存器信息判断PCIE是否支持热插拔操作;
    响应于所述PCIE支持所述热插拔操作,对所述卡槽设置用于表征电连接状态的电信号,并通知所述操作系统移除硬盘,以便基板管理控制器在所述硬盘移除后获取所述电信号以及所述硬盘的在位信号;
    接收所述基板管理控制器发送的所述在位信号,利用所述基板管理控制器获取所述硬盘对应的寄存器地址,并向所述硬盘发送更改所述在位信号的命令,以得到相应的命令执行结果,并将所述命令执行结果返回至寄存器;和
    利用所述基板管理控制器向所述硬盘再次发送更改所述在位信号的命令,并更改所述卡槽中预设的所述电信号。
  2. 根据权利要求1所述的硬盘模拟插拔方法,其特征在于,所述获取卡槽的寄存器信息,然后在操作系统中基于所述寄存器信息判断PCIE是否支持热插拔操作,包括:
    利用lspci命令获取卡槽的寄存器信息,以便获取用于判断所述PCIE是否支持热插拔的标志位;和
    在操作系统中基于所述标志位判断所述PCIE是否支持热插拔操作。
  3. 根据权利要求2所述的硬盘模拟插拔方法,其特征在于,所述在操作系统中基于所述标志位判断所述PCIE是否支持热插拔操作,包括:
    响应于所述标志位为预设结果,判定所述PCIE支持热插拔操作;所述预设结果包含hotplug+以及Surprise+。
  4. 根据权利要求1-3中任一项所述的硬盘模拟插拔方法,其特征在于,所述响应于所述PCIE支持所述热插拔操作,对所述卡槽设置用于表征电连接状态的电信号,并通知所述操作系统移除硬盘,以便基板管理控制器在所述硬盘移除后获取所述电信号以及所述硬盘的在位信号,包括:
    响应于所述PCIE支持所述热插拔操作,获取所述卡槽中用于表征电连接状态的电信号;和
    判断所述电信号是否为表征第一预设电连接状态的电信号,以得到相应的判断结果,然后基于所述判断结果对所述卡槽设置相应的电信号,并通知所述操作系统移除硬盘,以便基板管理控制器在所述硬盘移除后通过预设通道获取所述电信号以及所述硬盘的在位信号。
  5. 根据权利要求4所述的硬盘模拟插拔方法,其特征在于,所述判断所述电信号是否为表征预设电连接状态的电信号,以得到相应的判断结果,然后基于所述判断结果对所述卡槽设置相应的电信号,包括:
    响应于所述电信号为表征第一预设电连接状态的电信号,保持所述卡槽中的所述电信号不变。
  6. 根据权利要求4所述的硬盘模拟插拔方法,其特征在于,所述判断所述电信号是否为表征预设电连接状态的电信号,以得到相应的判断结果,然后基于所述判断结果对所述卡槽设置相应的电信号,包括:
    响应于所述电信号不是表征第一预设电连接状态的电信号,对所述卡槽设置与所述第一预设电连接状态对应的电信号。
  7. 根据权利要求4或5或6任一项所述的硬盘模拟插拔方法,其特征在于,所述接收所述基板管理控制器发送的所述在位信号,利用所述基板管理控制器获取所述硬盘对应的寄存器地址,并向所述硬盘发送更改所述在位信号的命令,以得到相应的命令执行结果,并将所述命令执行结果返回至寄存器,包括:
    接收所述基板管理控制器发送的当前所述在位信号,并读取所述硬盘的槽位号;当前所述在位信号与所述第一预设电连接状态对应的在位信号呈相反状态;和
    利用所述基板管理控制器计算所述硬盘的槽位号对应的寄存器地址,并向所述硬盘发送更改所述在位信号的命令,以得到与所述第一预设电连接状态对应的目标在位信号,并将所述目标在位信号返回至寄存器。
  8. 根据权利要求7所述的硬盘模拟插拔方法,其特征在于,所述利用所述基板管理控制器向所述硬盘再次发送更改所述在位信号的命令,并更改所述卡槽中预设的所述电信号,包括:
    等待预设时间,利用所述基板管理控制器向所述硬盘再次发送更改所述在位信号的命令,以便更改所述目标在位信号,并将所述卡槽中预设的所述电信号更改为与第二预设电连接状态对应的电信号。
  9. 一种硬盘模拟插拔装置,其特征在于,应用于主机,包括:
    判断模块,用于获取卡槽的寄存器信息,然后在操作系统中基于所述寄存器信息判断PCIE是否支持热插拔操作;
    电信号设置模块,用于响应于所述PCIE支持所述热插拔操作,对所述卡槽设置用于表征电连接状态的电信号;
    硬盘移除模块,用于通知所述操作系统移除硬盘,以便基板管理控制器在所述硬盘移除后获取所述电信号以及所述硬盘的在位信号;
    第一命令发送模块,用于接收所述基板管理控制器发送的所述在位信号,利用所述基板管理控制器获取所述硬盘对应的寄存器地址,并向所述硬盘发送更改所述在位信号的命令,以得到相应的命令执行结果,并将所述命令执行结果返回至寄存器;和
    第二命令发送模块,用于利用所述基板管理控制器向所述硬盘再次发送更改所述在位信号的命令,并更改所述卡槽中预设的所述电信号。
  10. 一种电子设备,其特征在于,包括:存储器及一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-8任意一项所述的方法的步骤。
  11. 一个或多个存储有计算机可读指令的非易失性计算机可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-8任意一项所述的方法的步骤。
PCT/CN2022/102538 2022-01-18 2022-06-29 一种硬盘模拟插拔方法、装置、设备及存储介质 WO2023137984A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210051776.0 2022-01-18
CN202210051776.0A CN114064541B (zh) 2022-01-18 2022-01-18 一种硬盘模拟插拔方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2023137984A1 true WO2023137984A1 (zh) 2023-07-27

Family

ID=80231265

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/102538 WO2023137984A1 (zh) 2022-01-18 2022-06-29 一种硬盘模拟插拔方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN114064541B (zh)
WO (1) WO2023137984A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114064541B (zh) * 2022-01-18 2022-04-22 苏州浪潮智能科技有限公司 一种硬盘模拟插拔方法、装置、设备及存储介质
CN114356677B (zh) * 2022-03-16 2022-06-07 北京得瑞领新科技有限公司 NVMe SSD热插拔测试方法、装置、设备及存储介质
CN114385537A (zh) * 2022-03-24 2022-04-22 浪潮(山东)计算机科技有限公司 一种页槽号动态分配方法、装置、设备及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6363452B1 (en) * 1999-03-29 2002-03-26 Sun Microsystems, Inc. Method and apparatus for adding and removing components without powering down computer system
CN101008911A (zh) * 2007-02-06 2007-08-01 杭州华为三康技术有限公司 实现虚拟热插拔的方法及实现虚拟热插拔的主机设备
CN102508755A (zh) * 2011-09-26 2012-06-20 迈普通信技术股份有限公司 一种模拟接口卡热插拔的装置和方法
CN114064541A (zh) * 2022-01-18 2022-02-18 苏州浪潮智能科技有限公司 一种硬盘模拟插拔方法、装置、设备及存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893293B (zh) * 2014-12-18 2019-10-29 伊姆西公司 用于管理外部组件快速互连设备热插拔的系统和方法
CN107203448B (zh) * 2017-05-24 2020-02-07 苏州浪潮智能科技有限公司 一种测试PCIe switch芯片暴力热插拔功能的方法及系统
CN107678997B (zh) * 2017-09-27 2021-06-29 郑州云海信息技术有限公司 Pcie插卡的热插拔方法、系统、装置和可读存储介质
CN110134447A (zh) * 2019-04-24 2019-08-16 深圳市国鑫恒宇科技有限公司 基于操作系统的bmc即时更新硬盘信息的系统及方法
CN111209151A (zh) * 2019-12-31 2020-05-29 苏州浪潮智能科技有限公司 基于linux的NVME SSD热拔插测试方法、系统、终端及存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6363452B1 (en) * 1999-03-29 2002-03-26 Sun Microsystems, Inc. Method and apparatus for adding and removing components without powering down computer system
CN101008911A (zh) * 2007-02-06 2007-08-01 杭州华为三康技术有限公司 实现虚拟热插拔的方法及实现虚拟热插拔的主机设备
CN102508755A (zh) * 2011-09-26 2012-06-20 迈普通信技术股份有限公司 一种模拟接口卡热插拔的装置和方法
CN114064541A (zh) * 2022-01-18 2022-02-18 苏州浪潮智能科技有限公司 一种硬盘模拟插拔方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN114064541B (zh) 2022-04-22
CN114064541A (zh) 2022-02-18

Similar Documents

Publication Publication Date Title
WO2023137984A1 (zh) 一种硬盘模拟插拔方法、装置、设备及存储介质
TW201931117A (zh) 遠端系統復原之方法
US8266359B2 (en) Method of connecting mass storage device
CN102567171B (zh) 一种测试刀片服务器主板的方法
CN111831345B (zh) 服务器硬盘背板的管理方法、装置、存储介质和设备
CN102541711A (zh) 一种测试x86架构服务器主板的方法
CN115480971A (zh) 一种NVMe硬盘背板的测试卡、测试方法、装置及介质
CN111224694A (zh) 基于nfc更换交换机设备的方法、装置、存储介质及设备
CN114185826A (zh) 一种用于外接存储设备的接口适配器
CN111930647B (zh) Usb接口工作模式选择装置、方法及安卓设备
CN116539992A (zh) 存储设备在位稳定状态检测装置、方法、逻辑模块及介质
CN116701285A (zh) 远程访问控制装置、方法、设备及计算机可读介质
CN102236594A (zh) Sas接口测试装置及测试方法
CN111143898B (zh) 可插拔存储器装置数据保护方法
US6976145B1 (en) Method and apparatus for automatically configuring data storage subsystems
CN110175146A (zh) 硬盘信息获取方法和获取硬盘信息的装置
CN217426108U (zh) 一种固态硬盘物理拔插式耐久性测试装置
JP2008077359A (ja) アダプタ装置、データ伝送システム
CN111459863B (zh) 一种基于nvme-mi的机箱管理系统及方法
CN113946530A (zh) 扩展卡的控制方法及装置、非易失性存储介质
CN113656224A (zh) 一种NVMe SSD热插拔测试方法、系统、装置及可读存储介质
US8832341B2 (en) Dynamically determining a primary or slave assignment based on receiving a power signal from the cable at the port of a device
CN201984468U (zh) 基本输入输出系统烧录装置与应用其的烧录系统
CN114153388B (zh) 一种硬盘系统和硬盘配置信息刷新方法、装置及介质
CN111831502A (zh) 一种企业级硬盘能效比测试方法和系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22921415

Country of ref document: EP

Kind code of ref document: A1