Hard disk plugging and unplugging method and system and server
By creating record files in the server to automatically control the hot-swap operation of the hard disk, the problem of manual operation is solved, and more efficient and accurate functional testing is achieved.
Patent Information
- Application Number
- CN202311055414.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-21
- Publication Date
- 2025-02-21
Smart Images

Figure CN119493694A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a hard disk plugging and unplugging method and system, and a server. Background Art
[0002] Before a server leaves the factory, it is necessary to perform a functional test on the firmware of the storage controller in the server. When performing a functional test, it is often necessary to build a test case based on the functional test and perform a hot-plugging operation on the hard disk in the server according to the test case. Since multiple functional tests need to be performed, and each functional test requires multiple manual hot-plugging operations, the completion of the functional test of the storage controller firmware is time-consuming and labor-intensive. Manual participation also increases the error rate during testing and reduces efficiency. Summary of the invention
[0003] In view of this, the present application provides a hard disk plugging and unplugging method and system, and a server to improve the efficiency of hot plugging operations on the hard disk of the server.
[0004] The first aspect of the present application provides a hard disk plugging and unplugging method, which is applied to a server, wherein the server includes a backplane, and the server performs a hot-plugging operation on the hard disk of the backplane or plugs and unplugs the hard disk of a spare hard disk rack through an execution unit. The hard disk plugging and unplugging method includes: creating a first record file and a second record file; using the first record file to record the first hot-plugging operation performed by the execution unit on the hard disk of the backplane when the server tests a first test case, and using the second record file to record the first plugging and unplugging operation performed by the execution unit on the hard disk of the spare hard disk rack when the server tests the first test case; determining whether the backplane is in a first preset state according to the first record file; and determining whether the backplane is in a first preset state according to the second record file. The component determines whether the spare hard disk rack is in the second preset state; if the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, the control execution unit performs a second hot-swap operation on the hard disk of the backplane and / or the control execution unit performs a second plug-in operation on the hard disk of the spare hard disk rack according to the first record file and the second record file, so that the backplane is restored to the first preset state and the spare hard disk rack is restored to the second preset state; if the backplane is in the first preset state and the spare hard disk rack is in the second preset state, the control execution unit performs a third hot-swap operation on the hard disk of the backplane according to the second test case, and performs a third plug-in operation on the hard disk of the spare hard disk rack.
[0005] In the above technical solution, the server first creates a first record file and a second record file. When the server tests the first test case, the first record file is used to record the first hot-swap operation performed by the execution unit on the hard disk of the backplane, and the second record file is used to record the first plug-in and pull-out operation performed by the execution unit on the hard disk of the spare hard disk rack. Then, the server determines whether the backplane is in the first preset state according to the first record file, and determines whether the spare hard disk rack is in the second preset state according to the second record file.
[0006] If the spare hard disk rack is in the first preset state and the spare hard disk rack is in the second preset state, the control execution unit performs a third hot plug operation on the hard disk of the backplane and / or a third plug operation on the hard disk of the spare hard disk rack according to the second test case to improve the hot plug efficiency of completing a test case.
[0007] If the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, the execution unit is controlled to perform a second hot-swap operation on the hard disk of the backplane and / or a second plug-in operation on the hard disk of the spare hard disk rack according to the first record file and the second record file, so that the backplane is restored to the first preset state and the spare hard disk rack is restored to the second preset state, so as to prepare for the next test case. Improve the efficiency of hot-swap operations for multiple test cases and reduce the error rate of hot-swap operations
[0008] In some embodiments of the first aspect, after the backplane is restored to the first preset state and the spare hard disk rack is restored to the second preset state, the hard disk plugging and unplugging method further includes: clearing the first record file; clearing the second record file.
[0009] In some embodiments of the first aspect, after clearing the first record file and the second record file, controlling the execution unit to perform a third hot-swap operation on the hard disk of the backplane according to the second test case, and performing a third plug-in operation on the hard disk of the spare hard disk rack includes: when using the first record file to record the second test case of the server test, the execution unit performs a third hot-swap operation on the hard disk of the backplane; when using the second record file to record the second test case of the server test, the execution unit performs a third plug-in operation on the hard disk of the spare hard disk rack; changing the third hot-swap operation according to the first record file; determining the target slot of the spare hard disk rack according to the second record file; controlling the execution unit to perform the third hot-swap operation and the changed third hot-swap operation on the hard disk of the first slot of the backplane, and performing the third plug-in operation on the hard disk of the target slot, so as to complete the test of the second test case.
[0010] In some embodiments of the first aspect, the third hot plug operation includes a third hot insertion operation, a third hot half-plug operation, a third hot unplug operation and a third hot insertion operation, and changing the third hot plug operation according to the first record file includes: determining the third hot insertion operation of the hard disk corresponding to the hard disk identifier according to the second test case; changing the third hot plug operation to the third hot half-plug operation according to the current hot half-plug record of the hard disk identifier in the first record file; and / or determining the third hot unplug operation corresponding to the hard disk identifier according to the second test case; not performing the third hot unplug operation according to the current hot unplug record of the hard disk identifier in the first record file; determining the target slot of the spare hard disk rack according to the second record file includes: determining the second slot corresponding to the current unplug record as the target slot according to the current unplug record of the second record file; and / or determining the second slot corresponding to the current insert record as the target slot according to the current insertion record of the second record file.
[0011] In some embodiments of the first aspect, determining whether the backplane is in the first preset state according to the first record file includes: if the first record file does not have a hard disk identifier, determining that the backplane is in the first preset state; if the first record file has a hard disk identifier, comparing the first hot unplugging number record and the first hot plugging number record corresponding to the hard disk identifier; if the first hot plugging number record is less than the first hot unplugging number record, determining that the backplane is not in the first preset state; determining whether the spare hard disk rack is in the second preset state according to the second record file includes: if it is determined that the second record file does not have a spare hard disk identifier, determining that the spare hard disk rack is in the second preset state; if it is determined that the second record file has a spare hard disk identifier, determining the initial state of the second slot corresponding to the spare hard disk identifier, and comparing the first unplugging number record and the first inserting number record of the hard disk corresponding to the spare hard disk identifier; if the initial state of the second slot corresponding to the spare hard disk identifier is that no hard disk is plugged in, and the first inserting number record is greater than the first unplugging number record; or if the initial state of the second slot corresponding to the spare hard disk identifier is that a hard disk is plugged in, and the first inserting number record is less than the first unplugging number record, determining that the spare hard disk rack is not in the second preset state.
[0012] In some embodiments of the first aspect, if the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, controlling the execution unit to perform a second hot plug operation on the hard disk of the backplane and / or a second plug and unplug operation on the hard disk of the spare hard disk rack according to the first record file and the second record file includes: if the backplane is not in the first preset state and the spare hard disk rack is not in the second preset state; according to the hot half-plug record without the hard disk identifier in the first record file, determining that the first slot corresponding to the hard disk identifier on the server is the first executed slot; according to the first insertion number record of the spare hard disk identifier in the second record file being greater than the first unplugging number record, determining that the hard disk corresponding to the spare hard disk identifier on the spare hard disk rack is the executed hard disk, and determining that the second slot corresponding to the spare hard disk identifier is the second executed slot; controlling the execution unit to perform a second unplug operation on the executed hard disk, and performing a second hot plug operation on the executed hard disk, so as to unplug the executed hard disk from the second executed slot and insert it into the first executed slot.
[0013] In some embodiments of the first aspect, if the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, controlling the execution unit to perform a second hot plug operation on the hard disk of the backplane and / or a second plug and unplug operation on the hard disk of the spare hard disk rack according to the first record file and the second record file includes: if the backplane is not in the first preset state and the spare hard disk rack is in the second preset state, not querying the second record file, and determining, based on the hot half-plug record of the hard disk identifier in the first record file, that the first slot corresponding to the hard disk identifier on the server is the first executed slot, and the hard disk corresponding to the hard disk identifier is the executed hard disk; controlling the execution unit to perform a second hot half-plug operation on the executed hard disk located in the first executed slot part to insert the executed hard disk into the first executed slot; or if the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, controlling the execution unit to perform a second hot plug operation and / or performing a second plugging and unplugging operation on the hard disk of the spare hard disk rack includes: if the backplane is in the first preset state and the spare hard disk rack is not in the second preset state, not querying the first record file, and determining that the second slot corresponding to the first spare hard disk identifier on the spare hard disk rack is the second executed slot, and the hard disk corresponding to the first spare hard disk identifier is the executed hard disk based on the fact that the first insertion count record of the first spare hard disk identifier in the second record file is less than the first unplugging count record; determining that the second slot corresponding to the second spare hard disk identifier is the second executed slot based on the fact that the first insertion count record of the second spare hard disk identifier in the second record file is greater than the first unplugging count record; controlling the execution unit to perform a second unplugging operation on the executed hard disk located in the second executed slot corresponding to the first spare hard disk identifier, and performing a second inserting operation on the executed hard disk, so as to unplug the executed hard disk from the second executed slot corresponding to the first spare hard disk identifier, and insert it into the second executed slot corresponding to the second spare hard disk identifier.
[0014] In some embodiments of the first aspect, after the execution unit restores the backplane to the first preset state and the spare hard disk rack to the second preset state, the hard disk plugging and unplugging method also includes: detecting the presence information of the hard disk on the backplane; if the first slots of the backplane all have the presence information of the hard disk, determining that the backplane is restored to the first preset state and the spare hard disk rack is restored to the second preset state; if the backplane has the first slots that do not have the presence information of the hard disk, controlling the execution unit to restore the backplane to the first preset state and the spare hard disk rack to the second preset state.
[0015] A second aspect of the present application provides a hard disk plug-in and pull-out system, the hard disk plug-in and pull-out system comprising a server, an execution unit and a spare hard disk bracket, the server comprising a backplane, the server performs a hot-plug operation on the hard disk of the backplane or a plug-in and pull-out operation on the hard disk of the spare hard disk bracket through the execution unit; the server is used to: create a first record file and a second record file; use the first record file to record the first hot-plug operation performed by the execution unit on the hard disk of the backplane when the server tests a first test case; use the second record file to record the first plug-in and pull-out operation performed by the execution unit on the hard disk of the spare hard disk bracket when the server tests the first test case; determine whether the backplane is in a first preset state according to the first record file; Determine whether the spare hard disk rack is in the second preset state according to the second record file; if the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, control the execution unit to perform a second hot-swap operation on the hard disk of the backplane and / or control the execution unit to perform a second plug-in and pull-out operation on the hard disk of the spare hard disk rack according to the first record file and the second record file, so as to restore the backplane to the first preset state and the spare hard disk rack to the second preset state; if the backplane is in the first preset state and the spare hard disk rack is in the second preset state, control the execution unit to perform a third hot-swap operation on the hard disk of the backplane according to the second test case, and perform a third plug-in and pull-out operation on the hard disk of the spare hard disk rack.
[0016] The third aspect of the present application provides a server, comprising: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, the processor is used to execute the above-mentioned hard disk plugging and unplugging method. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A structural schematic diagram of a hard disk plug-in and unplug system according to an embodiment of the present application.
[0018] Figure 2 It is a flowchart of the hard disk plugging and unplugging method according to an embodiment of the present application.
[0019] Figure 3 A schematic diagram of a scenario of a hard disk plugging and unplugging method according to an embodiment of the present application.
[0020] Figure 4 A schematic diagram of another scenario of the hard disk plugging and unplugging method according to an embodiment of the present application.
[0021] Figure 5 A schematic diagram of the structure of a server according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In the present application, the term "plurality" refers to two or more. In addition, it should be understood that in the description of the present application, the terms "first", "second", etc. are only used for the purpose of distinguishing descriptions, and cannot be understood as controlling or implying relative importance, nor can they be understood as controlling or implying an order.
[0023] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0024] The following is a brief description of the relevant technology.
[0025] The server is equipped with a storage controller, which is a conversion device between the hard disk and other access storage devices. Before the server leaves the factory, the storage controller firmware needs to be functionally tested. For example, verifying the redundancy characteristics of the storage controller and verifying the storage controller's reconstruction function for failed hard disks. When performing functional testing, it is often necessary to hot-plug the hard disk in the server.
[0026] The specific process of functional testing includes building test cases (TestCase) for different functional tests in advance, and then the tester performs hot-swap operations on the server's hard disk according to the content of the test case. Since multiple functional tests need to be performed, and each functional test requires multiple hot-swap operations, the completion of the functional test of the storage controller's firmware has a large manual time cost and is time-consuming and labor-intensive. Manual participation also increases the error rate of the test, resulting in inaccurate verification and an increased chance of retesting. During the execution of the entire line test script, the system needs to pause continuously and wait for manual assistance to perform hot-swap operations before starting to run the next script, which has poor continuity, delays test progress and low efficiency.
[0027] The storage controller can be a host bus adapter (HBA) or a disk array (RAID). When the storage controller is RAID, if the tester is not familiar with the properties of RAID, the error rate of functional testing will increase.
[0028] In view of this, the present application provides a hard disk plugging and unplugging method, a hard disk plugging and unplugging system and a server to improve the efficiency of hot plugging operations of hard disks.
[0029] See also Figure 1 , Figure 1 It is a structural diagram of a hard disk plug-in system 100, and the hard disk plug-in system 100 includes a server 10, an execution unit 20, and a spare hard disk rack 30. The server 10 is electrically connected to the execution unit 20. A backplane 11 is provided in the server 10, and the backplane 11 is provided with a plurality of first slots 12, and each first slot 12 is plugged with a hard disk. The spare hard disk rack 30 is provided with a plurality of second slots 31, and each second slot 31 is plugged with a hard disk. The server 10 is used to execute a hard disk plug-in method to generate control instructions, and the execution unit 20 is used to execute the control instructions of the server 10, and perform hot-swap operations on the hard disk of the backplane 11, and plug and unplug operations on the hard disk of the spare hard disk rack 30, so as to perform multiple test case tests, thereby completing the functional test of the firmware of the storage controller.
[0030] In some embodiments, the execution unit 20 includes a motor 21, a mechanical arm 22, and a mechanical clamp 23. The motor 21 is connected to the mechanical arm 22, and the mechanical arm 22 is connected to the mechanical clamp 23. The motor 21 is used to drive the mechanical arm 22 to move in a first direction (eg, Figure 1 along the Z-axis direction), along the second direction (such as Figure 1 -Z axis direction), along the third direction (such as Figure 1 Along the X-axis direction), along the fourth direction (such as Figure 1 -X axis direction), along the fifth direction (such as Figure 1 along the Y-axis direction) and along the sixth direction (such as Figure 1 The mechanical arm 22 is used to perform an extension or contraction action to move the mechanical clamp 23. The mechanical arm 22 can be a two-degree-of-freedom mechanical arm. The mechanical clamp 23 is used to grab or release the hard disk. The mechanical clamp 23 can be provided with one or more cylinders to achieve the grabbing or releasing action. The execution unit 20 completes the hot-swap operation on the server 10 or the plug-in and unplug operation of the spare hard disk rack 30 through the motor 21, the mechanical arm 22 and the mechanical clamp 23.
[0031] exist Figure 1In an application scenario of the hard disk plug-in and unplug-in system 100, the server 10 executes the hard disk plug-in and unplug-in method based on the Linux operating system using software tools such as scripts for creating record files. The server 10 first creates a first record file and a second record file. When testing the test case of the redundancy feature, the server 10 uses the first record file to record the first hot-plug operation performed by the execution unit 20 on the hard disk of the backplane 11, and uses the second record file to record the first plug-in and unplug operation performed by the execution unit 20 on the hard disk of the spare hard disk rack 30. Next, the server 10 determines whether the first slots 12 of the backplane 11 are all plugged in with hard disks according to the first record file, that is, whether the first slots 12 are in the first preset state, and determines whether the preset number of second slots 31 of the spare hard disk rack 30 are plugged in with hard disks according to the second record file, that is, whether the spare hard disk rack 30 is in the second preset state. If there is a first slot 12 in the backplane 11 without a hard disk or the spare hard disk rack 30 has less than a preset number of second slots 31 with hard disks, the execution unit 20 is controlled to perform a second hot plug operation and / or a second plug operation on the hard disk according to the first record file and the second file, so as to restore the backplane 11 to the first preset state and the spare hard disk rack 30 to the second preset state.
[0032] If the spare hard disk rack 30 is in the first preset state and the spare hard disk rack 30 is in the second preset state, the control execution unit 20 performs the third hot plug operation and the third plug operation on the hard disk according to the test case of failed hard disk reconstruction, so as to improve the hot plug efficiency of the test case of completing the failed hard disk reconstruction.
[0033] The server 10 of this application scenario can use the execution unit 20 to remove the hard disks not exceeding the maximum number of redundant disks from the member disks plugged into the server during the test case of testing the redundancy feature, so as to verify whether the logical volume composed of the current remaining member disks can normally save data. It is also possible to use the execution unit 20 to replace a hard disk in the member disk with another hard disk in the test case of testing the failed hard disk reconstruction function, and test whether the data of the replaced hard disk can be restored on the hard disk, so as to verify the failed hard disk reconstruction function of the plug-in controller.
[0034] It can be understood that the hard disk plugging and unplugging method of the present application can improve the hot plugging efficiency of one or more test cases, reduce the error rate of hot plugging operations, and complete the functional detection of the storage controller at the same time.
[0035] See also Figure 2 , is a flowchart of the hard disk plugging and unplugging method of the present application, the hard disk plugging and unplugging method is applied to the server 10, and the hard disk plugging and unplugging method includes the following steps:
[0036] Step S101: creating a first record file and a second record file.
[0037] The server 10 creates the first record file and the second record file based on the Linux operating system by using software tools such as scripts for creating record files.
[0038] Step S102: using a first recording file to record a first hot-swap operation performed by the execution unit on the hard disk of the backplane when the server tests a first test case.
[0039] Step S103: using the second recording file to record the first plugging and unplugging operation performed by the execution unit on the hard disk of the spare hard disk rack when the server tests the first test case.
[0040] When testing the first test case (the first test case is a test case for the functional detection of the storage controller), the server 10 generates multiple control instructions according to the test content of the first test case. After receiving the multiple control instructions, the execution unit 20 performs the first hot-swap operation on the hard disk plugged into the first slot 12 on the backplane 11 and the first plug-in and pull-out operation on the hard disk plugged into the second slot 31 on the spare hard disk rack 30 according to different control instructions, so as to complete the test of the first test case. Among them, the first record file is used to record the first hot-swap operation performed by the execution unit 20 on the hard disk of the backplane 11. The second record file is used to record the first plug-in and pull-out operation performed by the execution unit 20 on the hard disk of the spare hard disk rack 30.
[0041] Step S104: determining whether the back panel is in a first preset state according to the first record file.
[0042] The first record file may include the hard disk identification of the hard disk that has been subjected to the first hot plug operation, the subdivided actions of the first hot plug operation corresponding to the hard disk identification, and the number of the first hot plug operation, etc. The first preset state is that all first slots 12 of the backplane 11 are plugged with hard disks.
[0043] Step S105: determining whether the spare hard disk rack is in a second preset state according to the second record file.
[0044] The record content of the second record file may include the spare hard disk identification of the hard disk on which the first plug-in operation was performed, the subdivided actions of the first plug-in operation corresponding to the spare hard disk identification, and the number of the first plug-in operation. The second preset state is that the spare hard disk rack 30 has a preset number of second slots 31 for plugging hard disks. The preset number can be set based on the test cases performed during the functional test. For example, the preset number is 1 / 2. It can be understood that when the preset number is 1 / 2, the test of most test cases can be satisfied.
[0045] Specifically, the server 10 stores the first preset state of the backplane 11 and the second preset state of the spare hard disk rack 30. After testing the first test case, since the server 10 performs the first hot-swap operation on the hard disk of the backplane 11 and the first plug-in operation on the hard disk of the spare hard disk rack 30, some of the first slots 12 in the backplane 11 may not be plugged with hard disks, and the spare hard disk rack 30 may have less than the preset number of second slots 31 plugged with hard disks, that is, the backplane 11 may not be in the first preset state, and the spare hard disk rack 30 may not be in the second preset state. At the same time, when testing the first test case, the first record file records the first hot-swap operation performed by the execution unit 20 on the hard disk of the backplane 11, and the second record file records the first plug-in operation performed by the execution unit 20 on the hard disk of the spare hard disk rack 30. Therefore, after the first test case is tested, the server 10 can infer whether the current backplane 11 is still in the first preset state based on the first preset state and the first record file, and can also infer whether the current spare hard disk rack 30 is still in the second preset state based on the second preset state and the second record file. The specific calculation method is not limited.
[0046] Step S106: If the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, the execution unit is controlled to perform a second hot-swap operation on the hard disk of the backplane and / or a second hot-swap operation on the hard disk of the spare hard disk rack according to the first record file and the second record file, so as to restore the backplane to the first preset state and the spare hard disk rack to the second preset state.
[0047] The second hot-swap operation is a hot-swap operation for restoring the backplane 11 to the first preset state, and the second plug-in operation is a plug-in operation for restoring the spare hard disk rack 30 to the second preset state.
[0048] Specifically, after the server 10 determines that some of the first slots 12 are not plugged in with a hard disk, and determines that more than 1 / 2 of the second slots 31 are not plugged in with a hard disk, the server 10 generates a recovery instruction based on the first record file and the second record file. After receiving the recovery instruction, the execution unit 20 performs a second hot-swap operation on the hard disk of the backplane 11 and / or a second plug-in and pull-out operation on the hard disk of the spare hard disk rack 30, so that the backplane 11 is restored to the first preset state and the spare hard disk rack 30 is restored to the second preset state. Step S107: If the backplane is in the first preset state and the spare hard disk rack is in the second preset state, the control execution unit performs a third hot-swap operation on the hard disk of the backplane according to the second test case, and performs a third plug-in and pull-out operation on the hard disk of the spare hard disk rack.
[0049] The second test case refers to the next test case of the first test case. For example, when testing the functionality of the plug-in controller, the test case of the redundancy feature is tested first, and then the test case of the failed hard disk reconstruction function is tested. In this case, the first test case is the test case of the redundancy feature, and the second test case is the test case of the failed hard disk reconstruction function. The third hot-swap operation refers to the hot-swap operation performed by the execution unit 20 on the hard disk of the backplane 11 when testing the second test case. The third plug-in operation refers to the plug-in operation performed by the execution unit 20 on the hard disk of the spare hard disk rack 30 when testing the second test case.
[0050] It can be understood that when all the first slots 12 of the backplane 11 are plugged with hard disks, it indicates that the number of hard disks in the server 10 meets the factory standard. When at least a preset number of second slots 31 in the spare hard disk rack 30 are plugged with hard disks, it indicates that the hard disk plug-in system 100 is ready to meet the hard disks of most test cases, and can start functional testing of the storage controller of the server 10 with the number of hard disks that meet the factory standard. The execution unit 20 executes the third hot-swap operation and the third plug-in operation required for the second test case to assist the server in testing the second test case and improve the test efficiency of the second test case.
[0051] It can be understood that there is no restriction on the execution order between step S104 and step S105, and there is no restriction on the execution order between step S106 and step S107.
[0052] It can be understood that in the above technical solution, the server 10 first creates a first record file and a second record file. When testing the first test case, the first record file is used to record the first hot-swap operation performed by the execution unit 20 on the hard disk of the backplane 11, and the second record file is used to record the first plug-in and pull-out operation performed by the execution unit 20 on the hard disk of the spare hard disk rack 30. Then, the server 10 determines whether the backplane 11 is in the first preset state according to the first record file of the first record file, and determines whether the spare hard disk rack 30 is in the second preset state according to the second record file of the second record file.
[0053] If the backplane 11 is not in the first preset state and / or the spare hard disk rack 30 is not in the second preset state, the execution unit 20 is controlled to perform a second hot plug operation on the hard disk of the backplane 11 and / or a second plug and unplug operation on the hard disk of the spare hard disk rack 30 according to the first record file and the second record file, so as to restore the backplane 11 to the first preset state and the spare hard disk rack 30 to the second preset state, so as to prepare for the next test case.
[0054] If the spare hard disk rack 30 is in the first preset state and the spare hard disk rack 30 is in the second preset state, the server 10 can control the execution unit 20 to perform a third hot-swap operation on the hard disk of the backplane 11 and a third plug-in operation on the hard disk of the spare hard disk rack 30 according to the second test case, so as to improve the hot-swap efficiency of completing a test case. The above scheme can improve the hot-swap efficiency of the test of one or more test cases when testing the functionality of the storage controller and reduce the error rate of the hot-swap operation.
[0055] In some embodiments, step S104 includes the following steps:
[0056] Step S201: Determine whether the first record file has a hard disk identifier.
[0057] like Figure 3 As shown, the record content of the first record file includes the hard disk identifier of the hard disk on which the first hot plug operation has been performed. <num>.
[0058] Step S202: If it is determined that the first record file has no hard disk identification, it is determined that the backplane is in a first preset state.
[0059] It can be understood that when the content of the first recording file does not record the hard disk identifier <num>, indicating that the execution unit 20 has not yet performed the first hot plug operation on the hard disk in any first slot 12 on the backplane 11, and the backplane 11 is still in the first preset state.
[0060] Step S203: If the first record file has a hard disk identifier, compare the first hot-plugging number record and the first hot-plugging number record of the hard disk corresponding to the hard disk identifier.
[0061] It can be understood that when the record content of the first record file has a hard disk mark <num>, indicating that the execution unit 20 has performed the first hot-swap operation on the hard disk in the first slot 12 of the backplane 11 .
[0062] The first hot plug operation may include a first hot unplug operation, a first hot plug operation, a first hot half-plug operation, a first hot half-plug operation, and a first hot swap operation. The first hot unplug operation refers to an operation of completely unplugging a hard disk from the first slot 12. The first hot plug operation refers to an operation of completely inserting a hard disk into the first slot 12. The first hot half-plug operation refers to an operation of unplugging a hard disk halfway from the first slot 12. The first hot half-plug operation refers to an operation of inserting a hard disk located at half of the first slot 12 into the first slot 12. The first hot swap operation refers to unplugging a hard disk from one first slot 12 of the server 10 and inserting it into another first slot 12.
[0063] In one example, the server 10 generates five control instructions according to the test content of the first test case, namely, IN: <num>NEW、IN: <num>、OUT: <num1>TO <num2>、OUT: <num>and OUT: <num>BOX. Execution unit 20 receives IN: <num>After the NEW instruction, the first hot-insert operation is performed on the hard disk with hard disk identification num, and IN is received: <num>After the instruction, the first hot half-insertion operation is performed on the hard disk with hard disk identification num, and OUT is received: <num>TO <num>After the instruction, the first hot swap operation is performed between the hard disk identified as num1 and the hard disk identified as num2, and OUT is received: <num>After the instruction, the first hot half-unplug operation is performed on the hard disk with hard disk identification num, and OUT is received: <num>After the BOX instruction, the first hot unplug operation is performed on the hard disk with the hard disk identifier num.
[0064] At the same time, the server 10 records in the first record file the subdivision actions of the first hot-plug operation of the hard disk corresponding to the hard disk identifier by the execution unit 20 and the number of the first hot-plug operation. Figure 3 As shown, the record content of the first record file also includes OUT: <num>、IN: <num>、OUT: <num>HALF and other subdivision actions of the first hot plug operation. OUT: <num>Indicates that the execution unit 20 performs the first hot-plug operation on the hard disk with hard disk identifier num or performs the hot-plug operation on the hard disk with hard disk identifier num1 in the first hot-swap operation (i.e., hot-plug record), IN: <num>Indicates that the execution unit 20 performs the first hot-insertion operation (i.e., hot-insertion record) on the hard disk with hard disk identifier num or performs the hot-insertion operation on the hard disk num1 in the first hot-swap operation. OUT: <num>HALF indicates that the execution unit 20 performs the first hot half-unplug operation (i.e., hot half-unplug record) on the hard disk with hard disk identifier num. For example, the server 10 reads the first record file containing OUT: <1> When the first test case is tested, it can be determined that the execution unit 20 completely removes the hard disk with the hard disk identifier 1 from the first slot 12. The record content also includes the first hot removal number record OUT <num>= b, the first hot-insertion times record IN: <num>=a and hot half-pull times record OUT: <num>HALF=b times of the first hot plug operation. For example, the execution unit 20 performs a first hot plug operation and b first hot unplug operation on the hard disk with hard disk identification 1, and the server 10 records the first hot plug number IN in the first record file: <1> =a and the first hot pull-out times record OUT <1> =b.
[0065] Step 204: If the first hot-plugging number record is less than the first hot-plugging number record, determine that the backplane is not in the first preset state.
[0066] If the first hot insertion count record is less than the first hot removal count record, that is, a is less than b, it means that the hard disk identified as num is not completely inserted into the first slot 12 by the execution unit 20, and the current state of the backplane 11 is inconsistent with the first preset state.
[0067] In some embodiments, step S105 includes:
[0068] Step S301: If it is determined that the second record file does not have a spare hard disk identifier, it is determined that the spare hard disk rack is in a second preset state.
[0069] like Figure 4 As shown, the second record file includes the corresponding spare hard disk identification of the hard disk that has been subjected to the first plug-in operation <num>And the subdivision action OUT of the first plug and unplug operation: <num>And IN: <num>。OUT: <num>It indicates that the execution unit 20 pulls out the hard disk with the spare hard disk identifier num from the second slot 31, that is, the first pull-out operation (that is, the pull-out record), IN: <num>Indicates that the execution unit 20 inserts the hard disk with the spare hard disk identifier num into the second slot 31, that is, the first insertion operation (that is, the insertion record). For example, the server 10 reads the second record file containing OUT: <5> When , it can be determined that the execution unit 20 identifies the spare hard disk as <5> The hard disk is completely pulled out from the second slot 31.
[0070] When the second operation record does not record the spare hard disk identification <num>, indicating that the execution unit 20 has not yet performed the first plugging and unplugging operation on the hard disk in any second slot 31 on the spare hard disk rack 30, and the spare hard disk rack 30 is still in the second preset state.
[0071] Step S302: If it is determined that the second record file has a spare hard disk identifier, determine the initial state of the second slot corresponding to the spare hard disk identifier, and compare the first removal count record and the first insertion count record of the hard disk corresponding to the spare hard disk identifier.
[0072] The initial state of the second slot 31 refers to the corresponding state of the second slot 31 when the spare hard disk rack 30 is in the second preset state. The initial state of the second slot 31 includes plugging in a hard disk or not plugging in a hard disk. Figure 4 As shown, the second record file also includes the first pull-out times record OUT <num>= b and the first insertion count record IN: <num>=a. Figure 1 As shown, the execution unit 20 performs a first insertion operation and b first removal operations on the hard disk with the spare hard disk identifier 1, and the server 10 records the first insertion times IN in the second record file: <1> = a and the first number of pull-outs recorded OUT <1> =b.
[0073] It can be understood that when the second record file records the spare hard disk identification <num>, indicating that the execution unit 20 has performed the first plugging and unplugging operation on the hard disk in the second slot 31 of the spare hard disk rack 30. Since the second preset state of the spare hard disk rack 30 is that the spare hard disk rack 30 has a preset number of second slots 31 plugged in with hard disks. Therefore, when the spare hard disk rack 30 is in the second preset state, the initial state of a second slot 31 on the spare hard disk rack 30 may be plugged in with a hard disk or may not be plugged in with a hard disk. Therefore, it is possible to determine whether the current spare hard disk rack 30 is in the second preset state by combining the first unplugging number record, the first plugging number record of the hard disk corresponding to the spare identifier and the initial state of the second slot 31 corresponding to the spare identifier.
[0074] In some embodiments, if the initial state of the second slot 31 is that the hard disk is not plugged in, and the first insertion count record is less than or equal to the first removal count record; or if the initial state of the second slot 31 is that the hard disk is plugged in, and the first insertion count record is greater than or equal to the first removal count record, then it is determined that the spare hard disk rack 30 is in the second preset state.
[0075] If the initial state of the second slot 31 is that the hard disk is not plugged in, and a is less than or equal to b, it means that the current state of the second slot 31 is that the hard disk is plugged in, which is consistent with the initial state, and the spare hard disk rack 30 is in the second preset state. Or if the initial state of the second slot 31 is that the hard disk is plugged in, and a is greater than or equal to b, it means that the current state of the second slot 31 is that the hard disk is plugged in, which is consistent with the initial state, and the spare hard disk rack 31 is in the second preset state.
[0076] Step S303: If the initial state of the second slot corresponding to the spare hard disk identifier is that no hard disk is plugged in, and the first insertion count record is greater than the first removal count record; or if the initial state of the second slot is that a hard disk is plugged in, and the first insertion count record is less than the first removal count record, it is determined that the spare hard disk rack is not in the second preset state.
[0077] If the initial state of the second slot 31 is that the hard disk is not plugged in, and a is greater than b, it means that the current state of the second slot 31 is that the hard disk is plugged in, which is inconsistent with the initial state, and the hard disk rack is not in the second preset state. Or if the initial state of the second slot 31 is that the hard disk is plugged in, and a is less than b, it means that the current state of the second slot 31 is that the hard disk is plugged in, which is inconsistent with the initial state, and the spare hard disk rack 30 is not in the second preset state.
[0078] In some embodiments, step S106 includes:
[0079] Step S401: if the backplane is not in the first preset state and the standby hard disk rack is not in the second preset state, according to the hot-unplug record without hard disk identification in the first record file, determine that the first slot corresponding to the hard disk identification on the server is the first executed slot.
[0080] The first executed slot refers to the first slot 12 where the execution unit performs the operation. It can be understood that in step S204, it is determined that the current state of the first slot 12 corresponding to the hard disk identifier num is inconsistent with the initial state. The reason for the inconsistency may be that the hard disk is finally completely pulled out, or half pulled out. Therefore, it is necessary to further determine whether the hard disk corresponding to the hard disk identifier num has a hot half-pulling record OUT: <num>HALF. When the hard disk corresponding to hard disk ID num has no hot half-removal record OUT: <num>When HALF, it indicates that the hard disk is completely pulled out, and currently a hard disk needs to be pulled out from the spare hard disk rack 30 and inserted into the first slot 12 corresponding to the hard disk identifier num.
[0081] Step S402: According to the first insertion count record of the spare hard disk identifier in the second record file being greater than the first removal count record, determining that the hard disk corresponding to the spare hard disk identifier on the spare hard disk rack is the executed hard disk, and determining that the second slot corresponding to the spare hard disk identifier is the second executed slot.
[0082] The executed hard disk refers to the hard disk on which the execution unit performs operations. The second executed slot refers to the second slot 31 on which the execution unit 10 performs operations.
[0083] It can be understood that to unplug a hard disk from the spare hard disk rack 30 and insert it into the first slot 12 corresponding to the hard disk identifier num, it is necessary to consider which hard disk to unplug from the spare hard disk rack 30. In one embodiment, in step S303, the server 10 can determine that the current state of the second slot 31 corresponding to the spare hard disk identifier num is different from the initial state based on the initial state of the second slot 31 corresponding to the spare hard disk identifier num being no hard disk plugged in, and the first insertion count record corresponding to the spare hard disk identifier being greater than the first unplugging count record. That is, the hard disk in the second slot 31 needs to be unplugged.
[0084] Step S403: controlling the execution unit to perform a second unplugging operation on the executed hard disk and a second hot plugging operation on the executed hard disk, so as to unplug the executed hard disk from the second executed slot and insert it into the first executed slot.
[0085] The second hot plug operation may include a second hot insertion operation, which is to fully insert the hard disk into the first slot 12 , and a second hot half insertion operation, which is to insert the hard disk located at half of the first slot 12 into the first slot 12 .
[0086] The second plugging and unplugging operation may include a second unplugging operation and a second plugging operation. The second unplugging operation refers to unplugging the hard disk from the second slot 31 of the spare hard disk rack 30 , and the second plugging operation refers to plugging the hard disk into the second slot 31 of the spare hard disk rack 30 .
[0087] In one example, the server 10 identifies the hard disk as <1> The hard disk has no hot-swap record. Make sure the hard disk on the server is marked as <1> The corresponding first slot 12 is the first executed slot. Next, the server 10 identifies the spare hard disk as <5> The first insertion number record a is greater than the first removal number record b, and the spare hard disk on the spare hard disk rack 30 is determined to be <5> The hard disk identified as the executed hard disk and the spare hard disk identified as <5> The corresponding second slot 31 is the second executed slot. The server 10 issues a recovery instruction, and the execution unit 20 performs a second pull-out operation, that is, the motor 21 drives the mechanical arm 22 to move to the spare hard disk marked as <5> The mechanical arm 22 extends to move the mechanical clamp 23 to the second executed slot 31 to which the spare hard disk marked as <5> The mechanical clamp 23 grabs the executed hard disk, and the mechanical arm 22 shrinks. The mechanical clamp 23 completely pulls the executed hard disk out of the second executed slot 31. Then, the execution unit 20 performs a second hot insertion operation, that is, the motor 21 drives the mechanical arm 22 to move to the hard disk of the server 10 marked as <1> The mechanical arm 22 extends to move the mechanical clamp 23 to a position where the executed hard disk can be released, and the mechanical clamp 23 completely inserts the executed hard disk into the first executed slot 12.
[0088] In some embodiments, if the initial state of the second slot 31 is not to store a hard disk, and the first insertion count record is less than or equal to the first removal count record; or if the initial state of the second slot 31 is to store a hard disk, and the first insertion count record is greater than or equal to the first removal count record, the control execution unit 20 does not perform the second plug-in and unplug operation on the second slot 31.
[0089] In some embodiments, step S106 further includes:
[0090] Step S501: If the backplane is not in the first preset state and the spare hard disk rack is in the second preset state, the second record file is not queried, and based on the hot-unplug record of the hard disk identifier in the record content, it is determined that the first slot corresponding to the hard disk identifier on the server is the first executed slot, and the hard disk corresponding to the hard disk identifier is the executed hard disk.
[0091] After the first test case is tested, it may happen that the backplane 11 is not in the first preset state, and the spare hard disk rack 30 is in the second preset state. At this time, the second hot plug operation required by the execution unit 20 can be inferred based on the first record file. Specifically, in step S204, it is determined that the current state of the first slot 12 corresponding to the hard disk identifier num is inconsistent with the initial state. The reason for the inconsistency may be that the hard disk in the first slot 12 is finally completely pulled out, or half pulled out. Therefore, it is necessary to further determine whether the hard disk corresponding to the hard disk identifier num has a hot half-pull record OUT: <num>HALF.
[0092] When the hard disk corresponding to hard disk ID num has a hot half-removal record OUT: <num>When it is HALF, it indicates that the hard disk is not completely pulled out and is located at a partial position of the first slot 12, for example, half.
[0093] Step S502: controlling the execution unit to perform a second hot semi-insertion operation on the executed hard disk located in the first executed slot portion, so as to insert the executed hard disk into the first executed slot.
[0094] In one example, the server 10 determines that there is a half-unplugged record OUT: <5> HALF, hard disk identification <5> The corresponding first slot 12 is the first executed slot, and the hard disk identifier <5> The corresponding hard disk is the executed hard disk. The server 10 issues a recovery instruction. After receiving the recovery instruction, the execution unit 20 performs a second hot half-plug operation, that is, the motor 21 drives the mechanical arm 22 to move to the hard disk marked as <5> The mechanical arm 22 extends to move the mechanical clamp 23 to a position where the hard disk can be grabbed. The mechanical clamp 23 grabs the hard disk located in the first slot 12. <5> The hard disk is fully inserted into the first slot 12.
[0095] In some embodiments, step S106 further includes:
[0096] Step S601: If the backplane is in the first preset state and the spare hard disk rack is not in the second preset state, the first record file is not queried, and based on the fact that the first insertion count record of the first spare hard disk identifier in the second record file is less than the first removal count record, it is determined that the second slot corresponding to the first spare hard disk identifier on the spare hard disk rack is the second executed slot, and the hard disk corresponding to the first spare hard disk identifier is the executed hard disk.
[0097] The first spare hard disk identifier refers to a spare hard disk identifier of a hard disk in the second record file.
[0098] After the first test case is tested, it may happen that the backplane 11 is in the first preset state and the spare hard disk rack 30 is not in the second preset state. At this time, the second plug-in and unplug operation required by the execution unit 20 can be inferred based on the second record file. Specifically, in step S303, the server 10 infers that the current second slot 31 is plugged in with a hard disk based on the fact that the initial state of the second slot 31 corresponding to the spare hard disk identifier in the second record file is that the hard disk is not plugged in, and the first insertion count record is greater than the first unplugging count record. This is different from the initial state, and the hard disk needs to be unplugged from the second slot 31.
[0099] S602: According to the first insertion count record of the second spare hard disk identifier in the second record file being greater than the first removal count record, determine that the second slot corresponding to the second spare hard disk identifier is the second executed slot.
[0100] The second spare hard disk identifier refers to the spare hard disk identifier of another hard disk in the second record file.
[0101] At the same time, in step S303, the server 10 calculates that the current second slot 31 is not plugged in with a hard disk, which is different from the initial state. The second slot 31 needs to be inserted with a hard disk, because the initial state of the second slot 31 corresponding to the spare hard disk identifier in the second record file is that the hard disk is plugged in, and the first insertion count record is less than the first removal count record.
[0102] Step S603: The control execution unit performs a second unplugging operation on the executed hard disk located in the second executed slot corresponding to the first spare hard disk identifier, and performs a second insertion operation on the executed hard disk, so as to unplug the executed hard disk from the second executed slot corresponding to the first spare hard disk identifier, and insert it into the second executed slot corresponding to the second spare hard disk identifier.
[0103] In one example, the server 10 generates a first spare hard disk identifier in the second record file according to the second record file. <4> The first insertion number record a is less than the first removal number record b, and the first spare hard disk identifier on the spare hard disk rack 30 is determined. <4> The corresponding second slot 31 is the second executed slot, and the first spare hard disk identifier <4> The corresponding hard disk is the executed hard disk. The server 10 also generates a second spare hard disk identifier according to the second record file. <6> The first insertion count record a is greater than the first removal count record b, and the second spare hard disk identifier is determined. <6> The corresponding second slot 31 is the second executed slot. Next, the server 10 generates a recovery instruction, and after receiving the recovery instruction, the execution unit 20 executes the second pull-out operation, that is, the motor 21 drives the mechanical arm 22 to move to the first spare hard disk mark <4> Corresponding to the second executed slot 31, the mechanical arm 22 extends to move the mechanical clamp 23 to the point where it can grab the spare hard disk marked as <4> The mechanical clamp 23 grabs the executed hard disk, and the mechanical arm 22 shrinks, and the mechanical clamp 23 completely pulls out the executed hard disk from the first spare hard disk mark. <4> The corresponding second executed slot 31. Then, the execution unit 20 performs a second insertion operation, that is, the motor 21 drives the mechanical arm 22 to move to the second spare hard disk identification <6> The mechanical arm 22 extends to move the mechanical clamp 23 to a position where the executed hard disk can be released, and the mechanical clamp 23 completely inserts the executed hard disk into the second spare hard disk mark. <6> The corresponding second executed slot 31.
[0104] It can be understood that although there are a preset number of second slots 31 on the spare hard disk rack 30 for plugging in hard disks, a second slot 31 may be inconsistent with the initial state. Therefore, through the second plug-in operation, the current state of each second slot 31 can be restored to the initial state.
[0105] In some embodiments, step S106 further includes:
[0106] Step S701: Detecting the presence information of the hard disk of the backplane.
[0107] After the backplane 11 is restored to the first preset state and the spare hard disk rack 30 is restored to the second preset state, the hard disk presence information of the first slot 12 on the backplane 11 can be detected again using a hard disk presence detection tool. For example, the detection tool includes an Odyssey tool under the Linux operating system, and the server 10 uses the Odyssey tool to detect the presence information of the hard disk in the first slot 12. When the presence information of the first slot 12 is 1, it can be determined that the first slot 12 is plugged with a hard disk, and when the presence information is 0, it can be determined that the first slot 12 is not plugged with a hard disk.
[0108] Step S702: If the first slots of the backplane all have the hard disk in-situ information, it is determined that the backplane is restored to the first preset state and the spare hard disk rack is restored to the second preset state.
[0109] Step S703: If the backplane has the information that there is no hard disk in the first slot, the control execution unit restores the backplane to the first preset state and restores the spare hard disk rack to the second preset state.
[0110] In some embodiments, after step S106, the hard disk plugging and unplugging method further includes:
[0111] Step S801: Clear the first record file.
[0112] Step S802: Clear the second record file.
[0113] It can be understood that the record contents of the first file and the second record file are cleared so that when the next test case is tested, the first hot plug operation performed by the execution unit 20 on the backplane 11 and the first plug operation performed by the execution unit 20 on the spare hard disk rack 30 are re-recorded.
[0114] In some embodiments, after steps S801 and S802, step S107 includes:
[0115] Step S901: using a first recording file to record a third hot-swap operation performed by an execution unit on a hard disk of a backplane when the server tests a second test case.
[0116] Step S902: using the second record file to record the third plugging and unplugging operation performed by the execution unit on the hard disk of the spare hard disk rack when the server tests the second test case.
[0117] It can be understood that after the contents of the first record file and the second record file are cleared, the first record file and the second record file will continue to record the third hot plug operation and the third plug operation of the second test case, respectively. The server 10 can analyze the real-time trajectory and current state of the hard disk during the second test case process in combination with the contents of the first record file and the second record file. For example, the real-time trajectory refers to the trajectory of the hard disk moving from the first slot 12 No. 1 to the second slot 31 No. 5. The current state can be that the hard disk with the hard disk identifier 1 is in a state where it is fully inserted into the first slot 12 No. 1.
[0118] In this way, in combination with the real-time recorded contents of the first record file and the second record file, the subsequent operation guidance is provided for the next plug-in or hot-plug operation of the hard disk during the test case. That is, the server 10 can control the execution unit 20 to perform the second hot-plug operation on the hard disk of the backplane 11 and / or the second plug-in operation on the hard disk of the spare hard disk rack 30 according to the first record file and the second record file.
[0119] Step S903: modifying the third hot plug operation according to the first record file.
[0120] It can be understood that, as mentioned above, the server 10 generates multiple control instructions according to the test content of the first test case (the second test case in this embodiment). These control instructions are generated according to the second test case, without considering the state of the first slot 12 of the server 10 and the second slot 31 of the spare hard disk rack 30. Therefore, there may be a phenomenon that the control instructions conflict with the state of the server 10 or the spare hard disk rack 30. For example, the server 10 sends IN to the execution unit 20: <2> NEW instruction, the execution unit 20 needs to move to the spare hard disk rack 30 to grab the hard disk and insert the hard disk into the first slot 12 corresponding to the hard disk identifier 2. However, there is a hard disk half-inserted into the first slot 12. IN of the server 10: <2> The NEW instruction conflicts with the current state of the first slot 12 corresponding to the hard disk identifier 2.
[0121] Therefore, the server 10 can calculate the current state of each first slot 12 of the server 10 according to the content of the first record file. When it is found that the current state of the first slot 12 conflicts with the control instruction of the server 10, the server 10 can correct the control instruction, that is, change the third hot plug operation according to the first record file. Thus, the operation of the execution unit 20 conforms to the actual status of the server 10.
[0122] Step S904: Determine the target slot of the spare hard disk rack according to the second record file.
[0123] When the execution unit 20 performs the third hot-insertion operation or the third hot-unplugging operation on the server 10, a hard disk needs to be unplugged from or inserted into the second slot 31 of the spare hard disk rack 30. Therefore, it is necessary to find the second slot 31 (i.e., the target slot) for unplugging or inserting the hard disk. Similarly, the server 10 can calculate the current state of each second slot 31 of the spare disk rack 30 according to the content of the second record file.
[0124] It can be understood that after the server 10 determines the target slot through the second record file, the control instruction can save the step of specifying a certain second slot 31 as the operation object.
[0125] Step S905: Control the execution unit to perform the third hot plug operation and the modified third hot plug operation on the hard disk in the first slot of the backplane, and perform the third plug operation on the hard disks in the second slot and the target slot to complete the test of the second test case.
[0126] It can be understood that some control instructions do not need to be changed. Therefore, the execution unit performs the third hot plug operation and the changed third hot plug operation on the hard disk in the first slot of the backplane, and performs the third plug operation on the hard disk in the second slot and the target slot, thereby completing the test of the second test case.
[0127] In some embodiments, step S903 includes the following steps:
[0128] Step S1001: determining a third hot-plug operation of a hard disk identified by a hard disk according to a second test case.
[0129] The specific actions of the third hot plug operation refer to the first hot plug operation, and the specific actions of the third plug operation refer to the first plug operation. That is, the third hot plug operation includes a third hot pull operation, a third hot plug operation, a third hot half pull operation, a third hot half plug operation and a third hot swap operation, and the third plug operation includes a third pull operation and a third plug operation.
[0130] The server 10 may generate a control instruction IN according to the second test case: <num>, execution unit 20 receives IN: <num>Then perform the third hot-plug operation.
[0131] Step S1002: according to the current hot half-unplug record of the hard disk identifier of the first record file, the third hot plug operation is changed into a third hot half-plug operation.
[0132] If the first slot 12 corresponding to the hard disk identifier recorded in the first record file has a current hot half-plug record, it means that the first slot 12 has just been subjected to the third hot half-plug operation, and the first slot 12 has a hard disk located in one half. Therefore, the third hot plug operation corresponding to the control instruction conflicts with the current state of the first slot 12. The server 10 changes the third hot plug operation to the third hot half-plug operation, and the execution unit 20 executes the third hot plug operation to fully insert the hard disk into the first slot 12.
[0133] In some embodiments, step S903 further includes:
[0134] Step S1101: determining a third hot unplug operation of a hard disk corresponding to the hard disk identifier according to a second test case.
[0135] The server 10 may generate a control instruction OUT according to the second test case: <num>, execution unit 20 receives OUT: <num>Then perform the third hot unplug operation.
[0136] Step S1102: according to the current hot unplug record of the hard disk identifier of the first record file, the third hot unplug operation is not performed.
[0137] If the first slot 12 corresponding to the hard disk identifier recorded in the first record file has a current hot unplug record, it means that the third hot unplug operation has just been executed on the first slot 12, and there is no hard disk in the first slot 12. Therefore, the third hot unplug operation corresponding to the control instruction conflicts with the current state of the first slot 12. The server 10 changes the third hot unplug operation to not executing the third hot semi-plug operation, and the execution unit 20 does not execute the third hot unplug operation, so as to comply with the state that there is no hard disk in the first slot 12.
[0138] In some embodiments, step S904 includes the following steps:
[0139] Step S1201: According to the current unplugging record of the second record file, determine that the second slot corresponding to the current unplugging record is the target slot.
[0140] Similarly, if the second slot 31 corresponding to the spare hard disk identifier of the second record file has a current unplugging record, it means that the second slot 31 has just been subjected to the third unplugging operation, and there is no hard disk in the second slot 31. Therefore, the second slot 31 can be determined as the target slot for inserting the hard disk from the first slot 12.
[0141] In some embodiments, step S904 further includes the following steps:
[0142] Step S1202: According to the current insertion record of the second record file, determine that the second slot corresponding to the current insertion record is the target slot.
[0143] Similarly, if the second slot 31 corresponding to the spare hard disk identifier of the second record file has a current insertion record, it means that the third insertion operation has just been performed on the second slot 31, and the hard disk is plugged into the second slot 31. Therefore, the second slot 31 can also be determined as the target slot for pulling out the hard disk so that the hard disk can be inserted into the first slot 12.
[0144] In one example, the server 10 generates a control instruction according to the corresponding program of the test case of the redundant feature. After receiving the control instruction, the execution unit 20 executes the third hot unplug operation of the test case of the redundant feature. The server 10 changes the third hot unplug operation into the third hot half unplug operation according to the first record file, and determines the target slot of the spare hard disk rack according to the second record file. That is, the motor 21 drives the mechanical arm 22 to move to the first slot 12 of the backplane 11, the mechanical arm 22 stretches to move the mechanical clamp 23 to a position where the hard disk located in the half of the first slot 12 can be grasped, the mechanical clamp 23 grasps the hard disk, and the mechanical arm 22 shrinks. Then, the execution unit 20 executes the third insertion operation of the test case of the redundant feature, that is, the motor 21 drives the mechanical arm 22 to move to the second slot 31 of the spare hard disk rack 30, the mechanical arm 22 stretches to move the mechanical clamp 23 to a position where the hard disk can be released, and the mechanical clamp 23 releases the hard disk. And so on, to complete the third hot plug operation and the third plug operation required for the test case of the redundant feature.
[0145] The embodiment of the present application further provides a hard disk plugging and unplugging system 100, which includes a server 10, an execution unit 20 and a spare hard disk bracket. The server 10 includes a backplane 11. The server 10 performs a hot-plug operation on a hard disk of the backplane 11 or a plug-in and unplug operation on a hard disk of a spare hard disk bracket 30 through the execution unit 20.
[0146] Server 10 is used for:
[0147] Creating a first record file and a second record file;
[0148] Using the first recording file to record the first hot-swap operation performed by the execution unit 20 on the hard disk of the backplane 11 when the server 10 tests the first test case;
[0149] Using the second record file to record the first plugging and unplugging operation performed by the execution unit 20 on the hard disk of the spare hard disk rack 30 when the server 10 tests the first test case;
[0150] Determining whether the back panel 11 is in a first preset state according to the first record file;
[0151] Determine whether the spare hard disk rack 30 is in a second preset state according to the second record file;
[0152] If the backplane 11 is not in the first preset state and / or the spare hard disk rack 30 is not in the second preset state, the execution unit 20 is controlled to perform a second hot-swap operation on the hard disk of the backplane 11 and / or the execution unit 20 is controlled to perform a second plug-in operation on the hard disk of the spare hard disk rack 30 according to the first record file and the second record file, so that the backplane 11 is restored to the first preset state and the spare hard disk rack 30 is restored to the second preset state;
[0153] If the backplane 11 is in the first preset state and the spare hard disk rack 30 is in the second preset state, the control execution unit 20 performs a third hot-swap operation on the hard disk of the backplane 11 and a third plug-in operation on the hard disk of the spare hard disk rack 30 according to the second test case.
[0154] In some embodiments, the server is also used to execute the above steps S201 to S204, steps S301 to S303, steps S401 to S403, steps S501 to S502, steps S601 to S603, steps S701 to S703, steps S801 to S802, steps S901 to S905, steps S1001 to S1002 and steps S1101 to S1102.
[0155] Those skilled in the art should understand that Figure 5 The structure of the server 10 shown does not constitute a limitation of the embodiment of the present application. The server 10 may also include more or less other hard disks or software than shown in the figure, or a different component arrangement.
[0156] As an embodiment, the server 10 includes a terminal that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hard disk includes but is not limited to a microprocessor, an application-specific integrated circuit, a programmable gate array, a digital processor, and an embedded device. As an embodiment, the memory 82 is used to store program codes and various data. The memory 82 may include a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0157] As an embodiment, at least one processor 81 may include an integrated circuit, for example, a single packaged integrated circuit, or a plurality of integrated circuits with the same or different functions, including a microprocessor, a digital processing chip, an image processor, and a combination of various control chips. At least one processor 81 is a control core (Control Unit) of the control terminal, which executes various functions and processes data of the server 100 by running or executing a program or module stored in the memory 82, and calling data stored in the memory 82. The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including several instructions for a computer device (which may be a personal computer, a terminal, or a network device, etc.) or a processor (processor) to execute parts of the methods of various embodiments of the present application. The memory 82 stores program code, and at least one processor 81 can call the program code stored in the memory 82 to perform related functions. In one embodiment of the present application, the memory 82 stores multiple instructions, and the multiple instructions are executed by at least one processor 81 to implement the above-mentioned hard disk plugging and unplugging method. Specifically, the specific implementation method of the at least one processor 81 for the above instructions corresponds to the description of the relevant steps in the embodiment, which is not repeated here.
[0158] The embodiment of the present application further provides a storage medium, wherein the storage medium stores computer instructions, and when the instructions are executed on a computing device, the computing device can execute the method for plugging and unplugging the hard disk of the server 10 provided in the above embodiment.
[0159] Those skilled in the art will understand that the present application is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, all of which belong to the protection scope of the present application.< / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num> < / num>
Claims
1. A hard disk plugging and unplugging method, applied to a server, wherein the server includes a backplane, and the server performs a hot plugging operation on a hard disk of the backplane or a plugging and unplugging operation on a hard disk of a spare hard disk rack through an execution unit, characterized in that: The hard disk plugging and unplugging method comprises: Creating a first record file and a second record file; Using the first record file to record a first hot-swap operation performed by the execution unit on the hard disk of the backplane when the server tests a first test case; Using the second record file to record the first plugging and unplugging operation performed by the execution unit on the hard disk of the spare hard disk rack when the server tests the first test case; Determining whether the backplane is in a first preset state according to the first record file; Determining whether the spare hard disk rack is in a second preset state according to the second record file; If the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, controlling the execution unit to perform a second hot-swap operation on the hard disk of the backplane and / or controlling the execution unit to perform a second plug-in operation on the hard disk of the spare hard disk rack according to the first record file and the second record file, so as to restore the backplane to the first preset state and the spare hard disk rack to the second preset state; If the backplane is in the first preset state and the spare hard disk rack is in the second preset state, control the execution unit to perform a third hot-swap operation on the hard disk of the backplane according to a second test case, and perform a third plug-in operation on the hard disk of the spare hard disk rack.
2. The hard disk plugging and unplugging method according to claim 1, characterized in that: After the backplane is restored to the first preset state and the spare hard disk rack is restored to the second preset state, the hard disk plugging and unplugging method further includes: Clear the first record file; Clear the second record file.
3. The hard disk plugging and unplugging method according to claim 2, characterized in that: After clearing the first record file and the second record file, controlling the execution unit to perform a third hot-swap operation on the hard disk of the backplane according to the second test case, and performing a third plug-in operation on the hard disk of the spare hard disk rack includes: Using the first record file to record a third hot-swap operation performed by the execution unit on the hard disk of the backplane when the server tests a second test case; using the second record file to record a third plugging and unplugging operation performed by the execution unit on the hard disk of the spare hard disk rack when the server tests the second test case; Modify the third hot-swap operation according to the first record file; Determine the target slot of the spare hard disk rack according to the second record file; Control the execution unit to perform the third hot plug operation and the modified third hot plug operation on the hard disk in the first slot of the backplane, and perform the third plug operation on the hard disk in the target slot to complete the test of the second test case.
4. The hard disk plugging and unplugging method according to claim 3, characterized in that: The third hot plug operation includes a third hot insert operation, a third hot half-plug operation, a third hot pull-out operation and a third hot plug operation, and changing the third hot plug operation according to the first record file includes: Determine the third hot-plug operation of the hard disk corresponding to the hard disk identifier according to the second test case; According to the current hot half-unplug record of the hard disk identifier of the first record file, changing the third hot plug operation to the third hot half-plug operation; and / or Determine the third hot unplug operation corresponding to the hard disk identifier according to the second test case; According to the current hot unplug record of the hard disk identifier of the first record file, not performing the third hot unplug operation; Determining the target slot of the spare hard disk rack according to the second record file comprises: According to the current unplugging record of the second record file, determining that the second slot corresponding to the current unplugging record is the target slot; and / or According to the current insertion record of the second record file, it is determined that the second slot corresponding to the current insertion record is the target slot.
5. The hard disk plugging and unplugging method according to claim 1, characterized in that: The determining whether the backplane is in a first preset state according to the first record file includes: If the first record file does not have a hard disk identifier, determining that the backplane is in the first preset state; If the first record file has a hard disk identifier, compare the first hot unplugging number record and the first hot plugging number record corresponding to the hard disk identifier; If the first hot-plugging number record is less than the first hot-plugging number record, it is determined that the backplane is not in the first preset state; Determining whether the standby hard disk rack is in the second preset state according to the second record file includes: If it is determined that the second record file does not have a spare hard disk identifier, determining that the spare hard disk rack is in a second preset state; If it is determined that the second record file has a spare hard disk identifier, determine the initial state of the second slot corresponding to the spare hard disk identifier, and compare the first removal count record and the first insertion count record of the hard disk corresponding to the spare hard disk identifier; If the initial state of the second slot corresponding to the spare hard disk identifier is that no hard disk is plugged in, and the first insertion count record is greater than the first removal count record; or if the initial state of the second slot corresponding to the spare hard disk identifier is that a hard disk is plugged in, and the first insertion count record is less than the first removal count record, it is determined that the spare hard disk rack is not in the second preset state.
6. The hard disk plugging and unplugging method according to claim 1, characterized in that: If the backplane is not in the first preset state and / or the standby hard disk rack is not in the second preset state, controlling the execution unit to perform a second hot-swap operation on the hard disk of the backplane and / or a second plug-in operation on the hard disk of the standby hard disk rack according to the first record file and the second record file includes: If the backplane is not in the first preset state and the spare hard disk rack is not in the second preset state; According to the hot-strip record without a hard disk identifier in the first record file, determining that a first slot corresponding to the hard disk identifier on the server is a first executed slot; According to the first insertion count record of the spare hard disk identifier in the second record file being greater than the first removal count record, determining that the hard disk corresponding to the spare hard disk identifier on the spare hard disk rack is the executed hard disk, and determining that the second slot corresponding to the spare hard disk identifier is the second executed slot; The execution unit is controlled to perform a second unplugging operation on the executed hard disk, and to perform a second hot plugging operation on the executed hard disk, so as to unplug the executed hard disk from the second executed slot and insert it into the first executed slot.
7. The hard disk plugging and unplugging method according to claim 1, characterized in that: If the backplane is not in the first preset state and / or the standby hard disk rack is not in the second preset state, controlling the execution unit to perform a second hot-swap operation on the hard disk of the backplane and / or a second plug-in operation on the hard disk of the standby hard disk rack according to the first record file and the second record file includes: If the backplane is not in the first preset state and the standby hard disk rack is in the second preset state, the second record file is not queried, and according to the hot-strip record of the hard disk identifier in the first record file, it is determined that the first slot corresponding to the hard disk identifier on the server is the first executed slot, and the hard disk corresponding to the hard disk identifier is the executed hard disk; Controlling the execution unit to perform the second hot semi-insertion operation on the executed hard disk located in the first executed slot portion, so as to insert the executed hard disk into the first executed slot; or If the backplane is in the first preset state and the spare hard disk rack is not in the second preset state, the first record file is not queried, and according to the first insertion count record of the first spare hard disk identifier in the second record file being less than the first removal count record, it is determined that the second slot corresponding to the first spare hard disk identifier on the spare hard disk rack is the second executed slot, and the hard disk corresponding to the first spare hard disk identifier is the executed hard disk; According to the first insertion count record of the second standby hard disk identifier in the second record file being greater than the first removal count record, determining that the second slot corresponding to the second standby hard disk identifier is the second executed slot; The control execution unit performs a second unplugging operation on the executed hard disk located in the second executed slot corresponding to the first spare hard disk identifier, and performs a second insertion operation on the executed hard disk, so as to unplug the executed hard disk from the second executed slot corresponding to the first spare hard disk identifier, and insert the executed hard disk into the second executed slot corresponding to the second spare hard disk identifier.
8. The hard disk plugging and unplugging method according to claim 1, characterized in that: After the execution unit restores the backplane to the first preset state and the spare hard disk rack to the second preset state, the hard disk plugging and unplugging method further includes: Detecting the presence information of the hard disk of the backplane; If the first slots of the backplane all have the hard disk in-position information, determining that the backplane is restored to the first preset state and the spare hard disk rack is restored to the second preset state; If the backplane has a first slot without the hard disk presence information, the execution unit is controlled to restore the backplane to the first preset state and restore the spare hard disk rack to the second preset state.
9. A hard disk plug-in and pull-out system, characterized in that: The hard disk plug-in and pull-out system comprises a server, an execution unit and a spare hard disk bracket, wherein the server comprises a backplane, and the server performs a hot-plug operation on the hard disk of the backplane or a plug-in and pull-out operation on the hard disk of the spare hard disk bracket through the execution unit. The server is used to: Creating a first record file and a second record file; The first record file is used to record the first hot-swap operation performed by the execution unit on the hard disk of the backplane when the server tests the first test case. The second record file is used to record a first plugging and unplugging operation performed by the execution unit on the hard disk of the spare hard disk rack when the server tests a first test case; Determining whether the backplane is in a first preset state according to the first record file; Determining whether the spare hard disk rack is in a second preset state according to the second record file; If the backplane is not in the first preset state and / or the spare hard disk rack is not in the second preset state, controlling the execution unit to perform a second hot-swap operation on the hard disk of the backplane and / or controlling the execution unit to perform a second plug-in operation on the hard disk of the spare hard disk rack according to the first record file and the second record file, so as to restore the backplane to the first preset state and the spare hard disk rack to the second preset state; If the backplane is in the first preset state and the spare hard disk rack is in the second preset state, control the execution unit to perform a third hot-swap operation on the hard disk of the backplane according to a second test case, and perform a third plug-in operation on the hard disk of the spare hard disk rack.
10. A server, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program stored in the memory. When the computer program is executed, the processor is used to execute the hard disk plugging and unplugging method as described in any one of claims 1 to 8.