Hard disk hot-swap test method, device, equipment and storage medium
By determining the test model and business scenarios in hard disk testing, simulating hot-swap operations and analyzing log information, the problem of insufficient efficiency and effectiveness of hard disk hot-swap testing in the existing technology is solved, and more comprehensive testing and improvement are achieved Efficient cost savings.
Patent Information
- Application Number
- CN202211313522.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-25
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2042-10-25
AI Technical Summary
The existing technology is difficult to implement automated and comprehensive hot-swap tests on hard disks, resulting in wasted time for testers, high costs and insufficient test effectiveness.
By determining the test model of the hard disk, the hard disk is controlled to be in different operating states, and simulate hot-swap operations are performed in these states, using log information to generate test results, refine business scenarios to generate corresponding read and write instructions, and monitor data differences to evaluate Test results.
It realizes a more comprehensive hard disk hot-swap test, saves labor costs, improves testing efficiency and effectiveness, generates accurate test results, and ensures the safety and stability of the system after hot-swap.
Smart Images

Figure CN115547403B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a hard disk hot-swap test method, device, equipment and storage medium. Background Art
[0002] At present, hot-swap testing of hardware components configured in server systems is a common application scenario, especially hot-swap testing of solid-state drives on the system, which can ensure the system's reliability, rapid maintainability, and timely recovery capabilities from disasters.
[0003] Therefore, how to perform more comprehensive automated hot-swap testing on hard disks, save testers' time, reduce labor costs, and improve the effectiveness of hot-swap testing is a problem that needs to be solved urgently. Summary of the invention
[0004] The present invention provides a hard disk hot-swap test method, device, equipment and storage medium, which can perform hot-swap test on the hard disk more comprehensively and effectively.
[0005] According to one aspect of the present invention, a hard disk hot-swap test method is provided, the method comprising:
[0006] Determine the hard disk to be tested associated with the local device and the test model corresponding to the hard disk to be tested;
[0007] According to the test model corresponding to the hard disk to be tested, the hard disk to be tested is controlled to be in a corresponding operating state, and in the operating state, a simulated hot-swap operation is performed on the hard disk to be tested;
[0008] The hot-swap test result of the hard disk is generated according to the log information of the local device within a preset time period after the simulated hot-swap operation is performed.
[0009] Optionally, controlling the hard disk to be tested to be in a corresponding operating state according to a test model corresponding to the hard disk to be tested includes:
[0010] If the test model corresponding to the hard disk to be tested is a read-write state test model, then determine the corresponding service scenario to be tested;
[0011] According to the business scenario to be tested, using a preset test tool, generate corresponding read and write instructions;
[0012] Based on the read and write instructions, read and write operations are performed on the hard disk to be tested, and the hard disk to be tested is controlled to be in a corresponding read and write operation state.
[0013] The above technical solution, by determining that the test model is a read-write state test model, further determines the corresponding business scenario to be tested, uses a preset test tool to generate corresponding read-write instructions, and performs read-write operations on the hard disk to be tested based on the read-write instructions, thereby controlling the hard disk to be tested to perform read-write operations in the corresponding business scenario, so that it is in the corresponding read-write operating state, which is helpful for subsequent hot-swap testing in the read-write state of the corresponding business scenario, thereby improving the richness of the test.
[0014] Optionally, generating corresponding read and write instructions by using a preset test tool according to the service scenario to be tested includes:
[0015] If the business scenario to be tested is an online transaction processing (OLTP) business scenario, a preset test tool is used to generate read and write instructions for mixed random read and write of small data blocks on the hard disk to be tested;
[0016] If the business scenario to be tested is an OLAP business scenario, a preset test tool is used to generate read and write instructions for mixed random read and write of large data blocks on the hard disk to be tested;
[0017] If the business scenario to be tested is a high-bandwidth business scenario, a preset test tool is used to generate read and write instructions for sequentially reading and writing large data blocks for a long time on the hard disk to be tested;
[0018] If the business scenario to be tested is a high read-write business scenario, a preset test tool is used to generate read and write instructions for long-term random reading and writing of small data blocks on the hard disk to be tested.
[0019] The above technical solution refines the business scenarios to be tested, including online transaction processing (OLTP) business scenarios, online analytical processing (OLAP) business scenarios, high-bandwidth business scenarios and high-read / write business scenarios, and provides an implementable method for generating corresponding read / write instructions in different business scenarios, thereby realizing the determination of read / write instructions in different business scenarios, which will help to subsequently improve the comprehensiveness and richness of hot-swap testing in the read / write state, and realize more effective hot-swap testing.
[0020] Optionally, after controlling the hard disk to be tested to be in a corresponding reading and writing operation state, the method further includes:
[0021] In the read-write operation state, using a preset monitoring tool to obtain first read-write data;
[0022] After performing a simulated hot-swap operation on the hard disk to be tested, sending a corresponding read-write instruction to the hard disk to be tested, and obtaining second read-write data using a preset monitoring tool;
[0023] A test result of hot plugging in a hard disk read-write state is generated according to a data difference between the first read-write data and the second read-write data.
[0024] The above technical solution uses a preset monitoring tool to obtain the read and write data before and after the simulated hot-swap operation of the hard disk to be tested and compare them, and determine the data difference between the two sets of read and write data, so as to determine the test results of the hot-swap under the hard disk read and write state. It provides an implementable method for analyzing the impact of hard disk hot-swap on the local device under the read and write state, which can determine more accurate test results and help the subsequent analysis of hard disk performance.
[0025] Optionally, controlling the hard disk to be tested to be in a corresponding operating state according to a test model corresponding to the hard disk to be tested includes:
[0026] If the model corresponding to the hard disk to be tested is a mounted state test model, a mount command is sent to the hard disk to be tested to instruct the hard disk to be tested to be mounted, so that the hard disk to be tested is in a mounted running state.
[0027] The above technical solution sends a mount command to the hard disk to be tested when it is determined that the model corresponding to the hard disk to be tested is a mounted state test model, thereby controlling the hard disk to be tested to be in a mounted operating state, which is helpful for subsequent hot-swap testing of the hard disk in the mounted state. By hot-plugging the hard disk when it is in different operating states, a more comprehensive hot-plug test can be achieved to ensure the safety and stability of the system after the hard disk is hot-plugged.
[0028] Optionally, simulating a hot-swap operation on the hard disk to be tested includes:
[0029] According to the property information of the hard disk to be tested, a control instruction for simulating the insertion or removal of the hard disk to be tested is generated, and the control instruction is sent to a module related to the local device to realize the simulated hot plugging of the hard disk to be tested.
[0030] The above technical solution generates a control instruction for simulating hot plugging according to the attribute information of the hard disk to be tested, so that the relevant modules of the local device receive the simulation signal corresponding to the insertion or removal of the hard disk to be tested, thereby realizing the simulated hot plugging of the hard disk to be tested, avoiding the actual manual plugging and unplugging, and saving labor costs. At the same time, the simulated hot plugging method is also helpful for subsequent hot plugging stress testing and reduces hardware loss.
[0031] Optionally, determining the hard disk to be tested associated with the local device includes:
[0032] According to the attribute information of the candidate hard disk associated with the local device, the candidate hard disk is visualized, and a designated candidate hard disk is obtained as the hard disk to be tested associated with the local device; the attribute information includes at least one of the following: hard disk drive letter, capacity, serial number and model.
[0033] The above technical solution visualizes the attribute information of the candidate hard disks associated with the local machine, thereby obtaining the hard disk to be tested specified by relevant personnel from the candidate hard disks, and provides a human-computer interaction method, which is helpful for subsequent targeted hot-swap testing of only the specified hard disks, avoiding the local device from hot-swapping all associated hard disks, thereby improving the working efficiency of the local device.
[0034] According to another aspect of the present invention, a hard disk hot-swap test device is provided, the device comprising:
[0035] A determination module, used to determine the hard disk to be tested associated with the local device and the test model corresponding to the hard disk to be tested;
[0036] An operation module, used for controlling the hard disk to be tested to be in a corresponding operation state according to a test model corresponding to the hard disk to be tested, and performing a simulated hot-swap operation on the hard disk to be tested in the operation state;
[0037] The generation module is used to generate a hot-swap test result of the hard disk according to the log information of the local device within a preset time period after the simulated hot-swap operation is performed.
[0038] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:
[0039] at least one processor; and
[0040] a memory communicatively connected to the at least one processor; wherein,
[0041] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the hard disk hot-swap test method described in any embodiment of the present invention.
[0042] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the hard disk hot-swap test method described in any embodiment of the present invention when executed.
[0043] The technical solution of the embodiment of the present invention determines the hard disk to be tested associated with the local device and the test model corresponding to the hard disk to be tested, controls the hard disk to be tested to be in the corresponding operating state according to the test model corresponding to the hard disk to be tested, and performs a simulated hot-swap operation on the hard disk to be tested in the operating state, and generates a hot-swap test result of the hard disk according to the log information of the local device in a preset time period after the simulated hot-swap operation. Taking into account the phenomenon that the hard disk may be plugged in and out under different operating states in actual scenarios, by using different test models, the hard disk to be tested is controlled to be in different operating states and hot-swap tests are performed, thereby achieving a more comprehensive hard disk hot-swap test; by analyzing the log information of the local device in a preset time period after the simulated hot-swap operation, thereby generating test results, the impact of the hard disk hot-swap on the local device can be effectively analyzed, and accurate test results can be generated.
[0044] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 This is a flow chart of a hard disk hot-swap test method provided according to Embodiment 1 of the present invention;
[0047] Figure 2 is a flow chart of a hard disk hot-swap test method provided according to Embodiment 2 of the present invention;
[0048] Figure 3 is a flow chart of a hard disk hot-swap test method provided according to Embodiment 3 of the present invention;
[0049] Figure 4 It is a structural schematic diagram of a hard disk hot-swap test device provided according to a fourth embodiment of the present invention;
[0050] Figure 5 It is a structural schematic diagram of an electronic device for implementing the hard disk hot-swap test method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0052] It should be noted that the terms "first", "second", "target", "candidate", "alternative", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0053] Embodiment 1
[0054] Figure 1 This is a flowchart of a hard disk hot-swap test method provided according to the first embodiment of the present invention. This embodiment is applicable to the case of performing a simulated hot-swap test when the hard disk is in operation. The method can be executed by a hard disk hot-swap test device. The hard disk hot-swap test device can be implemented in the form of hardware and / or software. The hard disk hot-swap test device can be configured in an electronic device. Figure 1 As shown, the method includes:
[0055] S101, determining a hard disk to be tested associated with a local device and a test model corresponding to the hard disk to be tested.
[0056] Among them, the local device refers to a computer device that can be configured with a hard disk. The hard disk to be tested may refer to a solid-state hard disk (Solid State Disk or Solid State Drive, referred to as SSD), preferably a new solid-state hard disk based on the NVME (Non Volatile Memory Express) standard. The test model refers to a preset model that characterizes the hot-swap test method for the hard disk to be tested. The test model may include at least one of the following: a static state test model, a mounting state test model, and a read-write state test model (also called an IO (Input / Output) test model). The number of hard disks to be tested may be at least one. The number of test models corresponding to the hard disk to be tested may be at least one.
[0057] Optionally, all candidate hard disks associated with the local device can be directly determined as hard disks to be tested based on the attribute information of the candidate hard disks associated with the local device; or the candidate hard disks can be first visualized based on the attribute information of the candidate hard disks associated with the local device. If it is detected that relevant personnel have not designated the candidate hard disks within a preset time, all candidate hard disks associated with the local device will be set as hard disks to be tested by default, that is, the hard disks to be tested associated with the local device are determined.
[0058] Optionally, determining the hard disk to be tested associated with the local device includes: visually displaying the candidate hard disks associated with the local device according to the attribute information of the candidate hard disks, and obtaining a designated candidate hard disk as the hard disk to be tested associated with the local device.
[0059] The attribute information includes at least one of the following: hard disk drive letter, storage path, capacity, serial number (SerialNumber) and model (Model Name). The hard disk drive letter, serial number or model refers to an identification number that can uniquely represent the identity of the hard disk.
[0060] For example, the property information of all candidate hard disks associated with the local device can be determined, and based on a preset display method, all hard disks in the system where the local device is located are listed on the visualization device, such as hard disks nvme0, nvme1, nvme2, and nvme3. This allows relevant personnel to specify a target hard disk for hot-swap testing from the candidate hard disks according to actual test needs, thereby obtaining the specified candidate hard disk as the hard disk to be tested associated with the local device.
[0061] This optional embodiment visualizes the attribute information of the candidate hard disks associated with the local machine, thereby obtaining the hard disk to be tested specified by relevant personnel from the candidate hard disks, and provides a human-computer interaction method, which is helpful for subsequent targeted hot-swap testing of only the specified hard disks. Therefore, the method of determining the hard disk to be tested in this optional embodiment can avoid the local device from hot-swapping all associated hard disks, thereby improving the working efficiency of the local device.
[0062] Optionally, at least one corresponding test model can be determined for the hard disk to be tested based on the actual usage scenario of the hard disk to be tested; or the corresponding test models for the hard disk to be tested can be directly determined as all alternative test models, namely, a static state test model, a mounted state test model, and a read-write state test model, that is, hot-swap tests are performed on the hard disk to be tested under different test models, thereby achieving a more comprehensive hot-swap test.
[0063] S102 . According to the test model corresponding to the hard disk under test, the hard disk under test is controlled to be in a corresponding operating state, and in the operating state, a simulated hot-swap operation is performed on the hard disk under test.
[0064] The operating state refers to the operating state that can characterize the interaction between the local device and the hard disk under test. The operating state can be a static, read-write, or mounted operating state. Simulated hot plugging refers to simulating the local device as a whole to be in a relative hard disk insertion or unplugging state.
[0065] Optionally, if the test model corresponding to the hard disk to be tested is a static state test model, no operation is performed on the hard disk to be tested, so that the hard disk to be tested is in a static operating state, that is, a state where there is no data interaction between the local device and the hard disk to be tested, and in the static operating state, a simulated hot-swap operation is performed on the hard disk to be tested, so as to test the impact of hard disk hot-swap on the local device in the static operating state.
[0066] Optionally, according to the test model corresponding to the hard disk under test, the hard disk under test is controlled to be in a corresponding operating state, including: if the model corresponding to the hard disk under test is a mounting state test model, a mount command is sent to the hard disk under test to instruct the hard disk under test to mount, so that the hard disk under test is in a mounted operating state.
[0067] Mounting refers to a process in which the local device makes computer files and directories on the hard disk available for users to access through the file system of the local device based on the operating system. The operating system may be, for example, a Linux operating system.
[0068] For example, if the model corresponding to the hard disk to be tested is a mounted status test model, a mount command (i.e., Mount command) can be generated to control the hard disk to be tested to be mounted, and then the mount command is sent to the hard disk to be tested to instruct the hard disk to be tested to be mounted, thereby achieving the purpose of controlling the hard disk to be tested to be in a mounted operating state.
[0069] This optional embodiment sends a mount command to the hard disk to be tested when it is determined that the model corresponding to the hard disk to be tested is a mounted state test model, thereby controlling the hard disk to be tested to be in a mounted operating state, which facilitates subsequent hot-swap testing of the hard disk in the mounted state. By hot-plugging the hard disk when it is in different operating states, a more comprehensive hot-plug test can be implemented to ensure the safety and stability of the system after the hard disk is hot-plugged.
[0070] Optionally, a simulated hot-swap operation is performed on the hard disk under test, including: generating a control instruction for simulating the insertion or removal of the hard disk under test according to the attribute information of the hard disk under test, and sending the control instruction to a module related to the local device to realize the simulated hot-swap of the hard disk under test.
[0071] The attribute information may include at least one of the following: hard disk drive letter, storage path, capacity, serial number and model name. The module related to the local device may refer to a common module in the local device that will be affected by the hot plug operation of the hard disk, or may refer to all software and / or hardware modules associated with the local device. The control instruction may be a command line instruction based on the Linux system.
[0072] Optionally, the control instruction may be sent to all relevant modules of the local device through the processing unit of the local device to implement simulated hot plugging of the hard disk to be tested.
[0073] For example, the control instruction for simulating the removal of the hard disk nvme0 under test may be: echo 1> / sys / bus / pci / devices / RootportBusID / remove. The control instruction for simulating the insertion of the hard disk nvme0 under test may be: echo 1> / sys / bus / pci / devices / RootportBusID / rescan, where RootportBusID is the storage path where the hard disk under test is located.
[0074] Optionally, after sending the control instruction to the module related to the local device, you can also obtain the preset return value based on the preset check instruction to determine whether the simulated hot-swap operation of the hard disk to be tested is successful. For example, after issuing a control instruction to simulate the unplugging of the hard disk nvme0 to be tested, the lsblk return value can be detected. If it is detected that the drive letter of the nvme0 disk disappears, it indicates that the nvme0 disk has been unplugged. For another example, after issuing a control instruction to simulate the plugging back of the hard disk nvme0 to be tested, the lsblk return value can be detected. If it is detected that the drive letter of the nvme0 disk is restored, it indicates that the nvme0 disk has been plugged back.
[0075] This optional embodiment generates a control instruction for simulating hot plugging according to the attribute information of the hard disk to be tested, so that the relevant modules of the local device all receive the simulation signal corresponding to the insertion or removal of the hard disk to be tested, thereby realizing the simulated hot plugging of the hard disk to be tested. It can effectively avoid the actual manual plugging and unplugging, thus saving manpower costs. At the same time, the simulated hot plugging method is also helpful for subsequent hot plugging stress testing and reduces hardware loss.
[0076] S103: Generate a hot-swap test result of the hard disk according to the log information of the local device within a preset time period after the simulated hot-swap operation is performed.
[0077] The log information refers to log information recording the operation status of the relevant modules of the local device after the hard disk is hot-swapped, etc. The hot-swap test result may include the test results of the hard disk being hot-swapped under different operation states.
[0078] For example, if the test model of the hard disk to be tested is a static state test model, a mounted state test model or a read-write state test model, the log information of the local device within a preset time period after the simulated hot-swap operation can be analyzed to determine whether an error occurs in the relevant module. If so, it is considered that the hot-swap operation has affected the local device and the test result fails. Otherwise, the test result is considered to pass.
[0079] Optionally, the test result after controlling the hard disk to be tested in the corresponding operating state and simulating hot plugging can be generated according to the test model of the hard disk to be tested and the log information of the local device within a preset time period after the simulated hot plugging operation. Specifically, if the test model of the hard disk to be tested is a read-write state test model, the data before and after the hard disk to be tested is controlled in the read-write state can be analyzed, and combined with the log information of the local device within a preset time period after the simulated hot plugging operation, it can be determined whether the hot plugging operation has an impact on the local device. If the data change before and after the read-write state is greater than a certain threshold, and / or there is an error message in the log information of the local device within the preset time period after the simulated hot plugging operation, the test result is considered to be failed. Otherwise, the test result is considered to be passed.
[0080] Optionally, based on a preset test duration and / or test number, repeated hot-swap operations can be performed on the hard disk to be tested, that is, the above steps S102-103 are repeatedly executed to generate hot-swap test results for multiple groups of hard disks, and the multiple test results are sorted out based on preset evaluation rules to evaluate the stability and reliability of the hot-swap characteristics of the hard disk.
[0081] The technical solution of the embodiment of the present invention determines the hard disk to be tested and the test model corresponding to the hard disk to be tested associated with the local device, controls the hard disk to be tested to be in the corresponding operating state according to the test model corresponding to the hard disk to be tested, and performs a simulated hot-swap operation on the hard disk to be tested in the operating state, and generates a hot-swap test result of the hard disk according to the log information of the local device in a preset time period after the simulated hot-swap operation. Considering the phenomenon that the hard disk may be plugged in and out under different operating states in actual scenarios, by using different test models, the hard disk to be tested is controlled to be in different operating states and hot-swap tests are performed, so as to achieve a more comprehensive hard disk simulation hot-swap test, thereby ensuring that in actual use, the device hard disk is unplugged or plugged in under different operating states, and will not have a significant impact on the work or state of the device itself; by analyzing the log information of the local device in the preset time period after the simulated hot-swap operation, the test result is generated, and the impact of the hard disk hot-swap on the local device can be effectively analyzed to generate accurate test results; finally, the simulated hot-swap method can effectively avoid the process of manual plugging and unplugging, thereby effectively saving manpower, and also helping to perform stress testing and evaluate the stability of the device.
[0082] Embodiment 2
[0083] Figure 2 It is a flow chart of a hard disk hot-swap test method provided according to the second embodiment of the present invention. This embodiment is optimized and improved on the basis of the above technical solutions.
[0084] Furthermore, “according to the test model corresponding to the hard disk under test, controlling the hard disk under test to be in a corresponding operating state” is refined into “if the test model corresponding to the hard disk under test is a read-write state test model, determining the corresponding business scenario to be tested; according to the business scenario to be tested, using a preset test tool, generating corresponding read-write instructions; based on the read-write instructions, performing read and write operations on the hard disk under test, and controlling the hard disk under test to be in a corresponding read-write operating state” to improve the specific method of controlling the hard disk under test to be in a corresponding operating state.
[0085] Further, “according to the business scenario to be tested, using the preset test tool to generate corresponding read and write instructions” is refined into “if the business scenario to be tested is an online transaction processing (OLTP) business scenario, then using the preset test tool to generate read and write instructions for mixed random reading and writing of small data blocks for the hard disk to be tested; if the business scenario to be tested is an online analytical processing (OLAP) business scenario, then using the preset test tool to generate read and write instructions for mixed random reading and writing of large data blocks for the hard disk to be tested; if the business scenario to be tested is a high-bandwidth business scenario, then using the preset test tool to generate read and write instructions for long-term sequential reading and writing of large data blocks for the hard disk to be tested; if the business scenario to be tested is a high-read and high-write business scenario, then using the preset test tool to generate read and write instructions for long-term random reading and writing of small data blocks for the hard disk to be tested”, so as to improve the method of determining corresponding read and write instructions for different business scenarios.
[0086] Furthermore, the process after the step "controlling the hard disk to be tested to be in a corresponding read-write operating state" is further refined into "in the read-write operating state, using a preset monitoring tool to obtain first read-write data; after simulating a hot-swap operation on the hard disk to be tested, sending corresponding read-write instructions to the hard disk to be tested, and using a preset monitoring tool to obtain second read-write data; based on the data difference between the first read-write data and the second read-write data, generating a hot-swap test result of the hard disk in the read-write state", so as to improve the method of performing hot-swap testing on the hard disk in the read-write state and generating test results.
[0087] like Figure 2 As shown, the method comprises the following specific steps:
[0088] S201, determining a hard disk to be tested associated with the local device and a test model corresponding to the hard disk to be tested.
[0089] S202: If the test model corresponding to the hard disk to be tested is a read-write state test model, determine the corresponding service scenario to be tested.
[0090] The business scenario to be tested refers to the business scenario to which the read and write conditions between the local device and the hard disk to be tested belong. The business scenario to be tested may include at least one of the following: an online transaction processing (OLTP) business scenario, an online analytical processing (OLAP) business scenario, a high-bandwidth business scenario, and a high-read-write business scenario. A high-read-write business scenario refers to a hard disk whose IOPs (Input / Output Operations Per Second, the number of read and write operations per second) is higher than a certain threshold. The number of business scenarios to be tested is at least one.
[0091] Optionally, if the test model corresponding to the hard disk to be tested is a read-write status test model, it is possible to further determine its commonly used business scenarios based on preset rules, such as based on the attribute information of the hard disk to be tested or relevant experience, thereby determining the business scenarios to be tested corresponding to the hard disk to be tested from the online transaction processing business scenarios, online analytical processing business scenarios, high-bandwidth business scenarios and high-read-write business scenarios; it is also possible to determine that the online transaction processing business scenarios, online analytical processing business scenarios, high-bandwidth business scenarios and high-read-write business scenarios are all business scenarios to be tested for all hard disks to be tested, so as to facilitate the subsequent simulation of hot-plugging of the hard disk to be tested in different business scenarios, so as to achieve a more comprehensive hot-plug test.
[0092] S203: Generate corresponding read and write instructions according to the business scenario to be tested using a preset test tool.
[0093] The preset test tool may be, for example, a FIO test tool (flexible I / O tester, flexible I / O (Input / Output) test tool).
[0094] Exemplarily, the FIO test tool can be used to query and determine the read and write instructions corresponding to the business scenario to be tested from a pre-stored table of business scenarios and read and write instructions according to the business scenario to be tested. That is, according to the business scenario to be tested, the preset test tool is used to generate corresponding read and write instructions.
[0095] Optionally, according to the business scenario to be tested, a preset test tool is used to generate corresponding read and write instructions, including: if the business scenario to be tested is an online transaction processing (OLTP) business scenario, then the preset test tool is used to generate read and write instructions for mixed random reading and writing of small data blocks for the hard disk to be tested; if the business scenario to be tested is an online analytical processing (OLAP) business scenario, then the preset test tool is used to generate read and write instructions for mixed random reading and writing of large data blocks for the hard disk to be tested; if the business scenario to be tested is a high-bandwidth business scenario, then the preset test tool is used to generate read and write instructions for long-term sequential reading and writing of large data blocks for the hard disk to be tested; if the business scenario to be tested is a high-read and high-write business scenario, then the preset test tool is used to generate read and write instructions for long-term random reading and writing of small data blocks for the hard disk to be tested.
[0096] This optional embodiment refines the business scenarios to be tested, including online transaction processing (OLTP) business scenarios, online analytical processing (OLAP) business scenarios, high-bandwidth business scenarios, and high-read / write business scenarios, and provides an implementable method for generating corresponding read / write instructions in different business scenarios, thereby realizing the determination of read / write instructions in different business scenarios, which helps to subsequently improve the comprehensiveness and richness of hot-swap testing in the read / write state, and realize more effective hot-swap testing.
[0097] S204 , performing read and write operations on the hard disk to be tested based on the read and write instructions, controlling the hard disk to be tested to be in a corresponding read and write operation state, and performing a simulated hot-swap operation on the hard disk to be tested in the operation state.
[0098] Exemplarily, the local device can send read and write instructions corresponding to each business scenario to be tested to the corresponding hard disk to be tested, thereby interacting with the hard disk to be tested to implement read and write operations on the hard disk to be tested, so that the hard disk to be tested is in a corresponding read and write operating state.
[0099] It should be noted that the process of simulating hot-plugging operation on the hard disk to be tested in the running state described in this embodiment is the same as the process described in S102 above, and will not be repeated here.
[0100] S205 , generating a hot-swap test result of the hard disk according to the log information of the local device within a preset time period after the simulated hot-swap operation is performed.
[0101] The technical solution of the embodiment of the present invention, by further determining the corresponding business scenario to be tested when determining that the test model is a read-write state test model, using a preset test tool to generate corresponding read-write instructions, and performing read-write operations on the hard disk to be tested based on the read-write instructions, thereby controlling the hard disk to be tested to perform read-write operations in the corresponding business scenario, thereby being in the corresponding read-write operating state, which is helpful for subsequent hot-swap testing in the read-write state of the corresponding business scenario and improving the richness of the test.
[0102] Optionally, after controlling the hard disk to be tested to be in a corresponding read-write operating state, it also includes: in the read-write operating state, using a preset monitoring tool to obtain first read-write data; after simulating a hot-swap operation on the hard disk to be tested, sending corresponding read-write instructions to the hard disk to be tested, and using a preset monitoring tool to obtain second read-write data; generating a hot-swap test result of the hard disk in the read-write state based on the data difference between the first read-write data and the second read-write data.
[0103] The first read / write data refers to the read / write data before the hard disk under test is simulated hot-swapped. The second read / write data refers to the read / write data after the hard disk under test is simulated hot-swapped. The preset monitoring tool may be, for example, the iostat (I / O statistics) tool under the Linux system.
[0104] Exemplarily, if the read-write instructions that control the hard disk under test to be in a corresponding read-write operating state are read-write instructions for mixed random reads and writes of small data blocks, read-write instructions for mixed random reads and writes of large data blocks, or read-write instructions for long-term random reads and writes of small data blocks, that is, random read-write read-write instructions, then in the read-write operating state, a preset monitoring tool can be used to use the IOPs of the hard disk as the first read-write data. After simulating a hot-swap operation on the hard disk under test, a read-write instruction that is consistent with controlling the hard disk under test to be in a corresponding read-write operating state is sent to the hard disk under test, and the preset monitoring tool can be used to use the IOPs of the hard disk as the second read-write data.
[0105] Exemplarily, if the read-write instructions that control the hard disk under test to be in a corresponding read-write operating state are read-write instructions for long-term sequential reading and writing of large data blocks, then in the read-write operating state, a preset monitoring tool can be used to use the hard disk throughput (BW) as the first read-write data. After simulating a hot-swap operation on the hard disk under test, read-write instructions that are consistent with controlling the hard disk under test to be in a corresponding read-write operating state are sent to the hard disk under test, and the preset monitoring tool can be used to use the hard disk throughput as the second read-write data.
[0106] Exemplarily, after determining the first read-write data and the second read-write data, the data difference between the first read-write data and the second read-write data can be determined, and the relationship between the data difference and a preset data difference threshold can be determined. If the data difference is less than the preset data difference threshold (such as 10%), it is considered that the hot plug test in the hard disk read-write state has passed; if the data difference is greater than the preset data difference threshold, it is considered that the hot plug test in the hard disk read-write state has failed, thereby generating a hot plug test result in the hard disk read-write state.
[0107] This optional embodiment utilizes a preset monitoring tool to obtain the read and write data before and after the simulated hot-swap operation on the hard disk to be tested and compare them, and determine the data difference between the two groups of read and write data, so as to determine the test result of the hot-swap under the hard disk read and write state. It provides an implementable method for analyzing the impact of hard disk hot-swap on the local device under the read and write state, which can determine more accurate test results and help with subsequent analysis of hard disk performance.
[0108] Embodiment 3
[0109] Figure 3 It is a flow chart of a hard disk hot-swap test method provided according to Embodiment 3 of the present invention. This embodiment provides a preferred example based on the above embodiments.
[0110] like Figure 3 As shown, the method comprises the following specific steps:
[0111] S301 . Visually display the candidate hard disks according to the attribute information of the candidate hard disks associated with the local device, and obtain a designated candidate hard disk as the hard disk to be tested associated with the local device.
[0112] S302: Determine a test model corresponding to the hard disk to be tested.
[0113] Specifically, if the test model is a read-write state test model, execute S303-308; if the test model is a mount state test model, execute S309.
[0114] S303: If the test model corresponding to the hard disk to be tested is a read-write state test model, determine the corresponding service scenario to be tested.
[0115] S304: If the business scenario to be tested is an online transaction processing (OLTP) business scenario, a preset test tool is used to generate read and write instructions for performing mixed random read and write of small data blocks on the hard disk to be tested.
[0116] S305: If the business scenario to be tested is an OLAP business scenario, a preset test tool is used to generate read and write instructions for mixed random read and write of large data blocks on the hard disk to be tested.
[0117] S306: If the service scenario to be tested is a high-bandwidth service scenario, a preset test tool is used to generate read and write instructions for sequentially reading and writing large data blocks for a long time on the hard disk to be tested.
[0118] S307: If the business scenario to be tested is a high read / write business scenario, a preset test tool is used to generate read / write instructions for performing long-term random read / write of small data blocks on the hard disk to be tested.
[0119] S308 , performing read and write operations on the hard disk to be tested based on the read and write instructions, and controlling the hard disk to be tested to be in a corresponding read and write operation state.
[0120] S309: If the model corresponding to the hard disk to be tested is a mounted state test model, a mount command is sent to the hard disk to be tested to instruct the hard disk to be tested to be mounted, so that the hard disk to be tested is in a mounted running state.
[0121] S310. In a corresponding operating state, a control instruction for simulating the insertion or removal of the hard disk to be tested is generated according to the attribute information of the hard disk to be tested, and the control instruction is sent to a module related to the local device to realize the simulated hot plugging of the hard disk to be tested.
[0122] S311, generating a hot-swap test result of a hard disk according to log information of the local device within a preset time period after the simulated hot-swap operation is performed.
[0123] It should be noted that, in the read-write operation state, the first read-write data can be obtained by using a preset monitoring tool. After the hard disk to be tested is simulated for hot-plugging, the corresponding read-write instructions are sent to the hard disk to be tested, and the second read-write data is obtained by using a preset monitoring tool. Based on the data difference between the first read-write data and the second read-write data, the hot-plug test result of the hard disk in the read-write state is generated, and then combined with the log information of the local device in the preset time period after the simulated hot-plugging operation, the final hot-plugging test result of the hard disk is generated.
[0124] Embodiment 4
[0125] Figure 4 1 is a schematic diagram of the structure of a hard disk hot-swap test device provided according to a fourth embodiment of the present invention. The hard disk hot-swap test device provided in the embodiment of the present invention can be applied to the case of performing a simulated hot-swap test when the hard disk is in operation. The hard disk hot-swap test device can be implemented in the form of hardware and / or software, such as Figure 4 As shown, the device specifically includes: a determination module 401, an operation module 402 and a generation module 403. Among them,
[0126] The determination module 401 is used to determine the hard disk to be tested associated with the local device and the test model corresponding to the hard disk to be tested;
[0127] The operation module 402 is used to control the hard disk to be tested to be in a corresponding operating state according to the test model corresponding to the hard disk to be tested, and to simulate a hot-swap operation on the hard disk to be tested in the operating state;
[0128] The generating module 403 is used to generate a hot-swap test result of the hard disk according to the log information of the local device within a preset time period after the simulated hot-swap operation is performed.
[0129] The embodiment of the present invention takes into account the phenomenon that a hard disk may be plugged in and out under different operating conditions in actual scenarios. By utilizing different test models, the hard disk to be tested is controlled to be in different operating conditions and a hot-swap test is performed, thereby achieving a more comprehensive hard disk hot-swap test. By analyzing the log information of the local device within a preset time period after the simulated hot-swap operation, the test result is generated, and the impact of the hard disk hot-swap on the local device can be effectively analyzed to generate accurate test results.
[0130] Furthermore, the operation module 402 includes:
[0131] A scenario determination unit, configured to determine a corresponding service scenario to be tested if the test model corresponding to the hard disk to be tested is a read-write state test model;
[0132] An instruction generation unit, used to generate corresponding read and write instructions according to the business scenario to be tested using a preset test tool;
[0133] The control unit is used to perform read and write operations on the hard disk to be tested based on the read and write instructions, and control the hard disk to be tested to be in a corresponding read and write operation state.
[0134] Furthermore, the instruction generation unit is specifically used for:
[0135] If the business scenario to be tested is an online transaction processing (OLTP) business scenario, a preset test tool is used to generate read and write instructions for mixed random read and write of small data blocks on the hard disk to be tested;
[0136] If the business scenario to be tested is an OLAP business scenario, a preset test tool is used to generate read and write instructions for mixed random read and write of large data blocks on the hard disk to be tested;
[0137] If the business scenario to be tested is a high-bandwidth business scenario, a preset test tool is used to generate read and write instructions for sequentially reading and writing large data blocks for a long time on the hard disk to be tested;
[0138] If the business scenario to be tested is a high read-write business scenario, a preset test tool is used to generate read and write instructions for long-term random reading and writing of small data blocks on the hard disk to be tested.
[0139] Furthermore, the operation module 402 is also used for:
[0140] In the read-write operation state, using a preset monitoring tool to obtain first read-write data;
[0141] After performing a simulated hot-swap operation on the hard disk to be tested, sending a corresponding read-write instruction to the hard disk to be tested, and obtaining second read-write data using a preset monitoring tool;
[0142] A test result of hot plugging in a hard disk read-write state is generated according to a data difference between the first read-write data and the second read-write data.
[0143] Furthermore, the operation module 402 is also used for:
[0144] If the model corresponding to the hard disk to be tested is a mounted state test model, a mount command is sent to the hard disk to be tested to instruct the hard disk to be tested to be mounted, so that the hard disk to be tested is in a mounted running state.
[0145] Furthermore, the operation module 402 is also used for:
[0146] According to the property information of the hard disk to be tested, a control instruction for simulating the insertion or removal of the hard disk to be tested is generated, and the control instruction is sent to a module related to the local device to realize the simulated hot plugging of the hard disk to be tested.
[0147] Furthermore, the determining module 401 is specifically used for:
[0148] According to the attribute information of the candidate hard disk associated with the local device, the candidate hard disk is visualized, and a designated candidate hard disk is obtained as the hard disk to be tested associated with the local device; the attribute information includes at least one of the following: hard disk drive letter, capacity, serial number and model.
[0149] The hard disk hot-swap test device provided in the embodiment of the present invention can execute the hard disk hot-swap test method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0150] Embodiment 5
[0151] Figure 5 It is a structural schematic diagram of an electronic device for implementing the hard disk hot-swap test method according to an embodiment of the present invention. Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0152] like Figure 5 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0153] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0154] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a hard disk hot-swap test method.
[0155] In some embodiments, the hard disk hot-swap test method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the hard disk hot-swap test method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the hard disk hot-swap test method in any other appropriate manner (e.g., by means of firmware).
[0156] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0157] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0158] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0159] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0160] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0161] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0162] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0163] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A hard disk hot-swap test method, characterized in that: include: Determine the hard disk to be tested associated with the local device and the test model corresponding to the hard disk to be tested; the test model includes at least one of the following: a static state test model, a mounted state test model, and a read-write state test model; According to the test model corresponding to the hard disk to be tested, the hard disk to be tested is controlled to be in a corresponding operating state, and in the operating state, a simulated hot-swap operation is performed on the hard disk to be tested; the operating state is a static, read-write or mounted operating state; Generate a hot-swap test result of the hard disk according to the log information of the local device within a preset time period after the simulated hot-swap operation is performed; The method further comprises: if the test model corresponding to the hard disk to be tested is a static state test model, no operation is performed on the hard disk to be tested, so that the hard disk to be tested is in a static running state; Wherein, the controlling the hard disk to be tested to be in a corresponding operating state according to the test model corresponding to the hard disk to be tested comprises: if the test model corresponding to the hard disk to be tested is a read-write state test model, then determining the corresponding business scenario to be tested; the business scenario to be tested comprises at least one of the following: an online transaction processing business scenario, an online analytical processing business scenario, a high-bandwidth business scenario, and a high-read-write business scenario; according to the business scenario to be tested, using a preset test tool, generating corresponding read-write instructions; the preset test tool is a flexible input-output FIO test tool; based on the read-write instructions, performing read-write operations on the hard disk to be tested, and controlling the hard disk to be tested to be in a corresponding read-write operating state; Wherein, the corresponding read and write instructions are generated according to the business scenario to be tested using a preset test tool, including: if the business scenario to be tested is an online transaction processing (OLTP) business scenario, the preset test tool is used to generate read and write instructions for mixed random reading and writing of small data blocks for the hard disk to be tested; if the business scenario to be tested is an online analytical processing (OLAP) business scenario, the preset test tool is used to generate read and write instructions for mixed random reading and writing of large data blocks for the hard disk to be tested; if the business scenario to be tested is a high-bandwidth business scenario, the preset test tool is used to generate read and write instructions for long-term sequential reading and writing of large data blocks for the hard disk to be tested; if the business scenario to be tested is a high-read and high-write business scenario, the preset test tool is used to generate read and write instructions for long-term random reading and writing of small data blocks for the hard disk to be tested.
2. The method according to claim 1, characterized in that After controlling the hard disk to be tested to be in a corresponding reading and writing operation state, the method further includes: In the read-write operation state, the first read-write data is obtained by using a preset monitoring tool; the preset monitoring tool is an iostat tool under the Linux system; After performing a simulated hot-swap operation on the hard disk to be tested, sending a corresponding read-write instruction to the hard disk to be tested, and obtaining second read-write data using a preset monitoring tool; A test result of hot plugging in a hard disk read-write state is generated according to a data difference between the first read-write data and the second read-write data.
3. The method according to claim 1, characterized in that: According to the test model corresponding to the hard disk under test, controlling the hard disk under test to be in a corresponding operating state includes: If the model corresponding to the hard disk to be tested is a mounted state test model, a mount command is sent to the hard disk to be tested to instruct the hard disk to be tested to be mounted, so that the hard disk to be tested is in a mounted running state.
4. The method according to claim 1, characterized in that: Performing a simulated hot-swap operation on the hard disk to be tested includes: According to the property information of the hard disk to be tested, a control instruction for simulating the insertion or removal of the hard disk to be tested is generated, and the control instruction is sent to a module related to the local device to realize the simulated hot plugging of the hard disk to be tested.
5. The method according to claim 1, characterized in that The step of determining the hard disk to be tested associated with the local device includes: According to the attribute information of the candidate hard disk associated with the local device, the candidate hard disk is visualized, and a designated candidate hard disk is obtained as the hard disk to be tested associated with the local device; the attribute information includes at least one of the following: hard disk drive letter, capacity, serial number and model.
6. A hard disk hot-swap test device, characterized in that: include: A determination module, used to determine the hard disk to be tested associated with the local device and the test model corresponding to the hard disk to be tested; the test model includes at least one of the following: a static state test model, a mounted state test model, and a read-write state test model; An operation module, used for controlling the hard disk to be tested to be in a corresponding operation state according to the test model corresponding to the hard disk to be tested, and performing a simulated hot-swap operation on the hard disk to be tested in the operation state; the operation state is a static, read-write or mounted operation state; A generation module, used to generate a hot-swap test result of a hard disk according to log information of the local device within a preset time period after a simulated hot-swap operation is performed; The device is further used for: if the test model corresponding to the hard disk to be tested is a static state test model, then no operation is performed on the hard disk to be tested, so that the hard disk to be tested is in a static running state; The operation module includes: a scenario determination unit, which is used to determine the corresponding business scenario to be tested if the test model corresponding to the hard disk to be tested is a read-write state test model; an instruction generation unit, which is used to generate corresponding read-write instructions according to the business scenario to be tested using a preset test tool; a control unit, which is used to perform read-write operations on the hard disk to be tested based on the read-write instructions, and control the hard disk to be tested to be in a corresponding read-write operation state; Wherein, the instruction generation unit is specifically used for: If the business scenario to be tested is an online transaction processing (OLTP) business scenario, a preset test tool is used to generate read and write instructions for mixed random read and write of small data blocks on the hard disk to be tested; If the business scenario to be tested is an OLAP business scenario, a preset test tool is used to generate read and write instructions for mixed random read and write of large data blocks on the hard disk to be tested; If the business scenario to be tested is a high-bandwidth business scenario, a preset test tool is used to generate read and write instructions for sequentially reading and writing large data blocks for a long time on the hard disk to be tested; If the business scenario to be tested is a high read-write business scenario, a preset test tool is used to generate read and write instructions for long-term random reading and writing of small data blocks on the hard disk to be tested.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the hard disk hot-swap test method described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the hard disk hot-swap test method according to any one of claims 1 to 5 when executed.
