Flash detection method, device, computer equipment and storage medium
By periodically mounting the partition of the backup Flash and restarting the service to be detected, the status of the BMC backup Flash is detected, which solves the problem of missing status detection of the backup Flash in the existing technology and realizes the alarm repair of the backup Flash when the main Flash fails. , to prevent the server from going out of control.
Patent Information
- Application Number
- CN202211685593.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2042-12-27
AI Technical Summary
The prior art lacks a detection scheme for BMC's Flash status, which leads to the abnormality of the Flash status when the BMC switches to Flash, the BMC cannot start and the alarm cannot be called, resulting in the server being completely out of control.
Provide a Flash detection method that periodically mounts the executable program partition and configuration partition of the backup Flash during the BMC operation based on the main Flash, determines the service to be detected, closes and restarts the service to be detected, and obtains its running status. Thereby judging the detection result of the prepared Flash.
It implements periodic detection of the status of the standby Flash and prompts alarm repairs to ensure that the BMC switches to the standby Flash when the main Flash fails and the standby Flash is available, preventing the BMC from entering an out-of-control state where it cannot be started at all and cannot alarm.
Smart Images

Figure CN118260136B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a Flash detection method, device, computer equipment and storage medium. Background Art
[0002] In current servers, BMC (Baseboard Management Controller) generally uses a dual Flash redundancy mechanism, that is, when an abnormality occurs in the main Flash, the BMC can automatically switch to the backup Flash and run based on the firmware of the backup Flash. At the same time, an alarm is sent to the data center management platform to start operation and maintenance to repair the main Flash, so as to avoid BMC downtime when an abnormality occurs in the main Flash, which will damage the normal operation of the server.
[0003] In the prior art, there is no solution for detecting the status of the standby Flash. If the standby Flash is abnormal when the BMC switches to the standby Flash, the BMC will not be able to start and alarm, and the server will be completely out of control. Therefore, a method for detecting the status of the standby Flash is urgently needed. Summary of the invention
[0004] Based on this, it is necessary to provide a Flash detection method, device, computer equipment and storage medium to address the above technical problems.
[0005] In a first aspect, the present application provides a Flash detection method. The method comprises:
[0006] During the operation of the BMC based on the main Flash, the executable program partition and the configuration partition of the standby Flash are periodically mounted to the target directory, wherein the executable program partition stores the executable program files of the BMC service;
[0007] In the case that the executable program partition and the configuration partition are mounted successfully, determining a service to be detected, and shutting down the service to be detected from the services currently running by the BMC;
[0008] Based on the executable program file corresponding to the service to be detected in the executable program partition and the configuration file corresponding to the service to be detected in the configuration partition, start the service to be detected and obtain the running status of the service to be detected;
[0009] A detection result for the standby Flash is determined according to the running status of the service to be detected.
[0010] The Flash detection method provided in the embodiment of the present disclosure can periodically implement backup Flash detection so that when the backup Flash is abnormal, an alarm repair can be performed in time to ensure that when the main Flash fails and the BMC switches to the backup Flash, the backup Flash must be available, thereby avoiding the situation where the backup Flash also fails and the BMC enters an out-of-control state where it cannot be started at all and cannot alarm.
[0011] In one embodiment, the method further comprises:
[0012] In the case that the executable program partition and the configuration partition are not mounted successfully, a first detection result for the hardware of the standby Flash is obtained, and the first detection result is used to indicate that an abnormality occurs in the hardware of the standby Flash.
[0013] The Flash detection method provided by the embodiment of the present disclosure can determine whether the hardware of the standby Flash is normal according to whether the mounting is successful, so that when the hardware of the standby Flash is abnormal, an alarm can be issued in time to repair the hardware of the standby Flash, so as to ensure that when the main Flash fails and the BMC switches to the standby Flash, the standby Flash must be available, and avoid the situation in which the BMC enters an out-of-control state where it cannot be started at all and cannot issue an alarm when the standby Flash also fails.
[0014] In one of the embodiments, determining the detection result for the backup Flash according to the running status of the service to be detected includes:
[0015] When the running status of the service to be detected indicates that the service to be detected is not running successfully, a second detection result for the service to be detected is obtained, and the second detection result is used to indicate that the configuration file of the service to be detected does not match the executable program file of the service to be detected.
[0016] The Flash detection method provided by the embodiment of the present disclosure can determine whether the executable program file and the configuration file of the service to be detected match according to whether the service to be detected runs successfully, so that when the service to be detected on the standby Flash is abnormal, an alarm can be issued in time to repair the service to be detected on the standby Flash, so as to ensure that the standby Flash is available when the main Flash fails and the BMC switches to the standby Flash, so as to avoid the situation where the standby Flash also fails and the BMC enters an out-of-control state where it cannot be started at all and cannot issue an alarm.
[0017] In one embodiment, the method further comprises:
[0018] When the running status of the service to be detected indicates that the service to be detected fails to run successfully, the service to be detected is restarted based on the executable program file and configuration file corresponding to the service to be detected in the main Flash.
[0019] The Flash detection method provided in the embodiment of the present disclosure can restart the service to be detected based on the main Flash when the service to be detected fails to run successfully, so that the service to be detected will not stop running for a long time during the backup flash detection process, ensuring that the BMC can run normally during the detection.
[0020] In one embodiment, determining the service to be detected includes:
[0021] In the case that there are undetected services in the list of services to be detected, determining the service to be detected from the undetected services, wherein the list of services to be detected is used to record at least one service to be detected, the undetected service is a service in the list of services to be detected for which a detected mark is not set, and the detected mark is used to indicate that the service has completed detection;
[0022] A detected mark is set for the service to be detected in the list of services to be detected.
[0023] The Flash detection method provided by the embodiment of the present disclosure can set a service list to be detected and determine the service to be detected from the undetected services in the service list to be detected. The embodiment of the present disclosure can detect multiple services in one detection cycle through the service list to be detected, which can improve the efficiency of detecting the service to be detected.
[0024] In one embodiment, the method further comprises:
[0025] If the undetected service does not exist in the list of services to be detected, shut down the at least one service to be detected recorded in the list to be detected;
[0026] Restarting the at least one service to be detected based on the executable program file and the configuration file corresponding to the at least one service to be detected in the main Flash;
[0027] The executable program partition and the configuration partition of the standby Flash are uninstalled from the target directory.
[0028] The Flash detection method provided by the embodiment of the present disclosure can restore the system to the original state based on the main Flash after completing the detection of the backup Flash in this cycle, and prepare for the backup Flash detection in the next cycle, so as to periodically implement the backup Flash detection and avoid the BMC entering an out-of-control state where it cannot be started and cannot alarm when the backup Flash also fails.
[0029] In one embodiment, the method further comprises:
[0030] In the case that the service to be detected is a target service, the detection process of the backup Flash is interrupted, and the executable program partition and the configuration partition are uninstalled.
[0031] The Flash detection method provided in the embodiment of the present disclosure can interrupt the backup Flash detection process when an exception occurs in the target service, and instruct the operation and maintenance personnel to handle the exception of the backup Flash in a timely manner through an alarm without waiting until all services are detected, thereby improving the efficiency of detecting the backup Flash.
[0032] In one embodiment, the method further comprises:
[0033] Reading the firmware data of the backup Flash, and generating a first check code according to the firmware data;
[0034] Matching the first check code with a second check code, wherein the second check code is a check code generated according to the data to be written when the standby Flash performs firmware data refresh;
[0035] In the case that the first check code and the second check code do not match, a third detection result for the firmware data of the spare Flash is obtained, and the third detection result is used to indicate that an abnormality occurs in the firmware data of the spare Flash during flashing.
[0036] The Flash detection method provided by the embodiment of the present disclosure can generate a second check code according to the data to be written, and generate a first check code according to the firmware data, and then judge whether the firmware data is flashed normally according to whether the first check code and the second check code are the same, so that when the firmware data of the backup Flash is abnormal, an alarm can be issued in time to repair the firmware data of the backup Flash, so as to ensure that the backup Flash must be available when the main Flash fails and the BMC switches to the backup Flash, so as to avoid the situation where the backup Flash also fails and the BMC enters an out-of-control state where it cannot be started at all and cannot issue an alarm.
[0037] In one embodiment, the method further comprises:
[0038] According to the detection object corresponding to the target detection result, the bit identifier corresponding to the detection object in the detection log file is adjusted from the first identifier to the second identifier, wherein the target detection result includes the first detection result, the second detection result, and the third detection result, the detection object includes at least one of the hardware of the standby Flash, the service to be detected of the standby Flash, and the firmware data of the standby Flash, the first identifier is used to characterize that the detection object is normal, and the second identifier is used to characterize that the detection object is abnormal;
[0039] Using the detection object whose bit identifier in the detection log file is the second identifier as an alarm object;
[0040] Perform alarm processing according to the alarm object.
[0041] The Flash detection method provided by the embodiment of the present disclosure can record the abnormalities occurring during the detection process through bit identification in the detection log file, and after the backup Flash detection is completed, alarm processing is performed by reading the data in the detection log file, so that when the backup Flash is abnormal, alarm repair can be performed in time according to the detection log file, so as to ensure that when the main Flash fails and the BMC switches to the backup Flash, the backup Flash must be available, and avoid the situation where the backup Flash also fails and the BMC enters an out-of-control state where it cannot be started at all and cannot alarm.
[0042] In a second aspect, the present application also provides a Flash detection device. The device comprises:
[0043] The mounting module is used to periodically mount the executable program partition and the configuration partition of the standby Flash to the target directory during the BMC operation based on the main Flash, wherein the executable program partition stores the executable program files of the BMC service;
[0044] A first determination module is used to determine the service to be detected and close the service to be detected from the services currently running by the BMC when the executable program partition and the configuration partition are mounted successfully;
[0045] A startup module, used to start the service to be detected based on the executable program file corresponding to the service to be detected in the executable program partition and the configuration file corresponding to the service to be detected in the configuration partition, and obtain the running status of the service to be detected;
[0046] The second determining module is used to determine the detection result for the standby Flash according to the running status of the service to be detected.
[0047] In one embodiment, the device further comprises:
[0048] The first detection module is used to obtain a first detection result for the hardware of the standby Flash when the executable program partition and the configuration partition are not mounted successfully, wherein the first detection result is used to indicate that an abnormality occurs in the hardware of the standby Flash.
[0049] In one embodiment, the second determining module is further used to:
[0050] When the running status of the service to be detected indicates that the service to be detected is not running successfully, a second detection result for the service to be detected is obtained, and the second detection result is used to indicate that the configuration file of the service to be detected does not match the executable program file of the service to be detected.
[0051] In one embodiment, the device further comprises:
[0052] The first restart module is used to restart the service to be detected based on the executable program file and configuration file corresponding to the service to be detected in the main Flash when the running status of the service to be detected indicates that the service to be detected fails to run successfully.
[0053] In one embodiment, the first determining module is further used to:
[0054] In the case that there are undetected services in the list of services to be detected, determining the service to be detected from the undetected services, wherein the list of services to be detected is used to record at least one service to be detected, the undetected service is a service in the list of services to be detected for which a detected mark is not set, and the detected mark is used to indicate that the service has completed detection;
[0055] A detected mark is set for the service to be detected in the list of services to be detected.
[0056] In one embodiment, the device further comprises:
[0057] A closing module, configured to close the at least one service to be detected recorded in the list to be detected if the undetected service does not exist in the list of services to be detected;
[0058] A second restart module, configured to restart the at least one service to be detected based on an executable program file and a configuration file corresponding to the at least one service to be detected in the main Flash;
[0059] The first uninstallation module is used to uninstall the executable program partition and the configuration partition of the backup Flash from the target directory.
[0060] In one embodiment, the device further comprises:
[0061] The second uninstallation module is used to interrupt the detection process of the backup Flash and uninstall the executable program partition and the configuration partition when the service to be detected is a target service.
[0062] In one embodiment, the device further comprises:
[0063] A reading module, used for reading the firmware data of the backup Flash and generating a first check code according to the firmware data;
[0064] A matching module, used for matching the first check code with a second check code, wherein the second check code is a check code generated according to the data to be written when the standby Flash performs firmware data refresh;
[0065] The second detection module is used to obtain a third detection result for the firmware data of the backup Flash when the first verification code and the second verification code do not match, and the third detection result is used to indicate that an abnormality occurs when the firmware data of the backup Flash is flashed.
[0066] In one embodiment, the device further comprises:
[0067] an adjustment module, adjusting, according to a detection object corresponding to a target detection result, a bit identifier corresponding to the detection object in a detection log file from a first identifier to a second identifier, wherein the target detection result includes a first detection result, a second detection result, and a third detection result, the detection object includes at least one of the hardware of the standby Flash, the service to be detected of the standby Flash, and the firmware data of the standby Flash, the first identifier is used to characterize that the detection object is normal, and the second identifier is used to characterize that the detection object is abnormal;
[0068] A processing module, used for taking the detection object with the bit identifier in the detection log file as the second identifier as an alarm object;
[0069] The alarm module is used to perform alarm processing according to the alarm object.
[0070] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the above methods is implemented.
[0071] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any of the above methods is implemented.
[0072] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0073] The above-mentioned Flash detection method, device, computer equipment and storage medium can detect the service to be detected by periodically mounting the executable program partition and configuration partition of the backup Flash during the operation of the BMC based on the main Flash, and determine the detection result for the backup Flash according to the operation status of the service to be detected. That is, the backup Flash detection can be implemented periodically, so that when the backup Flash is abnormal, an alarm repair can be performed in time to ensure that the backup Flash must be available when the main Flash fails and the BMC switches to the backup Flash, avoiding the situation where the backup Flash also fails and the BMC enters a completely uncontrolled state where it cannot be started and cannot alarm. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 A schematic diagram of a Flash detection method according to an embodiment of the present invention;
[0075] Figure 2 is a flow chart of step 104 in one embodiment;
[0076] Figure 3 A schematic diagram of a Flash detection method according to an embodiment of the present invention;
[0077] Figure 4 A schematic diagram of a Flash detection method according to an embodiment of the present invention;
[0078] Figure 5 A schematic diagram of a Flash detection method according to an embodiment of the present invention;
[0079] Figure 6 A schematic diagram of a Flash detection method according to an embodiment of the present invention;
[0080] Figure 7 is a structural block diagram of a Flash detection device in one embodiment;
[0081] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0082] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0083] Figure 1 It is a flowchart of a Flash detection method according to an exemplary embodiment. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server.
[0084] In this embodiment, the method includes the following steps:
[0085] In step 102, during the operation of the BMC based on the main Flash, the executable program partition and the configuration partition of the standby Flash are periodically mounted to the target directory, and the executable program partition stores the executable program files of the BMC service.
[0086] In the disclosed embodiment, there are multiple partitions in the backup Flash, including an executable program partition storing executable program files of BMC services (such as fan speed monitoring, memory usage monitoring, etc.), and a configuration partition storing configuration files of BMC services. Since the server usually uses the Linux system, when the BMC runs in the user mode of the Linux system based on the main Flash, the executable program partition and the configuration partition of the backup Flash can be mounted to the target directory of the Linux system through the mount instruction of the Linux system at regular intervals, so that the files in the executable program partition and the configuration partition can be accessed through the target directory. The target directory can be an existing directory of the system or a newly created directory, and the disclosed embodiment does not specifically limit this.
[0087] In step 104, when the executable program partition and the configuration partition are mounted successfully, the service to be detected is determined, and the service to be detected is closed from the services currently running on the BMC.
[0088] In the embodiment of the present disclosure, the service to be detected can be determined from all services in the BMC, or from some relatively important services, which is not specifically limited in the embodiment of the present disclosure. When the executable program partition and the configuration partition are mounted successfully, the service to be detected can be determined, and the service to be detected can be closed from the services currently running on the main Flash of the BMC to perform the next step of detection.
[0089] In step 106, based on the executable program file corresponding to the service to be detected in the executable program partition and the configuration file corresponding to the service to be detected in the configuration partition, the service to be detected is started to obtain the running status of the service to be detected.
[0090] In the disclosed embodiment, the executable program file of the service to be detected can be started by the running service instruction of the Linux system based on the service name of the service to be detected. The executable program file needs to be run by reading the relevant parameters in the configuration file. The instruction to run the executable program file can be written as a script to complete the startup of the service to be detected by executing the script.
[0091] After the service to be detected is run, the running status of the service to be detected can be obtained based on the information generated by the service to be detected during the running process. The running status can be normal operation or abnormal operation. For example, if the service to be detected reports an error during the running process, it can be determined that the service to be detected is running abnormally. Furthermore, a preset time can be set. If the service to be detected reports an error within the preset time after it is started, it can be determined that the service to be detected is running abnormally. If the service to be detected does not report an error within the preset time after it is started, it can be determined that the service to be detected is running normally, so as to control the waiting time required after starting the service to be detected.
[0092] In step 108, the detection result for the backup Flash is determined according to the running status of the service to be detected.
[0093] In the disclosed embodiment, when the service to be detected is running abnormally, the detection result can be determined to be an abnormal result, and an alarm message can be issued to instruct the operation and maintenance personnel to repair the backup Flash. When the service to be detected is running normally, the detection result can be determined to be a normal result, and the next cycle of backup Flash detection can be started.
[0094] The Flash detection method provided by the embodiment of the present disclosure can detect the service to be detected by periodically mounting the executable program partition and configuration partition of the standby Flash during the operation of the BMC based on the main Flash, and determine the detection result for the standby Flash according to the operation status of the service to be detected. That is, the standby Flash detection can be implemented periodically, so that when the standby Flash is abnormal, an alarm repair can be performed in time to ensure that the standby Flash must be available when the main Flash fails and the BMC switches to the standby Flash, so as to avoid the situation where the standby Flash also fails and the BMC enters an out-of-control state where it cannot be started and cannot alarm.
[0095] In an exemplary embodiment, the method further includes:
[0096] When the executable program partition and the configuration partition are not mounted successfully, a first detection result for the hardware of the standby Flash is obtained, and the first detection result is used to indicate that an abnormality occurs in the hardware of the standby Flash.
[0097] In the embodiment of the present disclosure, if the mount instruction returns an error message when executing the mount instruction for the executable program partition and the configuration partition, the executable program partition and the configuration partition are not mounted successfully. Since the unsuccessful mounting of the partition of the backup Flash is usually caused by a hardware abnormality, the detection result of the hardware of the backup Flash can be determined as the first detection result at this time.
[0098] On the other hand, if the mount command does not return an error message, that is, the executable partition and the configuration partition are mounted successfully, it can be determined that the hardware of the standby Flash is normal. At this time, it can be determined that the detection result for the hardware of the standby Flash is a normal result, and other subsequent detections for the standby Flash can be continued.
[0099] The Flash detection method provided by the embodiment of the present disclosure can determine whether the hardware of the standby Flash is normal according to whether the mounting is successful, so that when the hardware of the standby Flash is abnormal, an alarm can be issued in time to repair the hardware of the standby Flash, so as to ensure that when the main Flash fails and the BMC switches to the standby Flash, the standby Flash must be available, and avoid the situation in which the BMC enters an out-of-control state where it cannot be started at all and cannot issue an alarm when the standby Flash also fails.
[0100] In an exemplary embodiment, in step 108, determining the detection result for the backup Flash according to the running state of the service to be detected includes:
[0101] When the running status of the service to be detected indicates that the service to be detected is not running successfully, a second detection result for the service to be detected is obtained, and the second detection result is used to indicate that the configuration file of the service to be detected does not match the executable program file of the service to be detected.
[0102] In the disclosed embodiment, since the frequency of synchronizing the configuration file of the standby Flash with the main Flash is high, while the frequency of synchronizing the executable program file is low, it may cause inconsistency between the configuration file and the executable program file in the standby Flash. When the configuration file and the executable program file versions of the service to be detected are inconsistent, the service to be detected will not be able to run. The failure of the service to be detected in the standby Flash to run successfully is usually caused by this reason.
[0103] Therefore, if the service to be detected fails to run successfully, it can be determined that the configuration file and the executable program file of the service to be detected have a high probability of not matching. At this time, the detection result for the service to be detected can be determined to be the second detection result. On the other hand, if the service to be detected runs successfully, it can be determined that the configuration file and the executable program file of the service to be detected match. At this time, it can be determined that the detection result for the service to be detected is a normal result, that is, the configuration file and the executable program file of the service to be detected match.
[0104] The Flash detection method provided by the embodiment of the present disclosure can determine whether the executable program file and the configuration file of the service to be detected match according to whether the service to be detected runs successfully, so that when the service to be detected on the standby Flash is abnormal, an alarm can be issued in time to repair the service to be detected on the standby Flash, so as to ensure that the standby Flash is available when the main Flash fails and the BMC switches to the standby Flash, so as to avoid the situation where the standby Flash also fails and the BMC enters an out-of-control state where it cannot be started at all and cannot issue an alarm.
[0105] In an exemplary embodiment, the method further includes:
[0106] When the running status of the service to be detected indicates that the service to be detected is not running successfully, the service to be detected is restarted based on the executable program file and configuration file corresponding to the service to be detected in the main Flash.
[0107] In the embodiment of the present disclosure, when it is determined that the service to be detected fails to run successfully, the service to be detected can be restarted through the executable program file and configuration file of the service to be detected in the main Flash to avoid the situation where the service to be detected stops running for a long time when the service to be detected fails to run successfully.
[0108] The Flash detection method provided in the embodiment of the present disclosure can restart the service to be detected based on the main Flash when the service to be detected fails to run successfully, so that the service to be detected will not stop running for a long time during the backup flash detection process, ensuring that the BMC can run normally during the detection.
[0109] In an exemplary embodiment, referring to Figure 2 As shown, in step 104, determining the service to be detected includes:
[0110] In step 202, when there are undetected services in the list of services to be detected, the services to be detected are determined from the undetected services. The list of services to be detected is used to record at least one service to be detected. The undetected service is a service in the list of services to be detected for which a detected mark is not set. The detected mark is used to indicate that the service has completed detection.
[0111] In step 204, a detected mark is set for the service to be detected in the list of services to be detected.
[0112] In the embodiment of the present disclosure, a list of services to be detected may be set, and the list of services to be detected stores all services that need to be detected. The services in the list of services to be detected are divided into services with detected marks and services without detected marks. The detected mark is used to indicate that the service has been detected, that is, the detection result corresponding to the service has been obtained by running the executable program file corresponding to the service.
[0113] Exemplarily, each service can be determined as a service to be detected in order according to the arrangement order of each service in the service list to be detected. That is, the first service in the service list to be detected can be determined as the service to be detected first, and after obtaining the detection result corresponding to the service, a detected mark is set for the service, and the second service in the service list to be detected is determined as the service to be detected... and so on, until the detection result corresponding to the last service in the service list to be detected is obtained, and the detected mark is set for the last service, and there is no undetected service in the service list to be detected.
[0114] The Flash detection method provided by the embodiment of the present disclosure can set a service list to be detected and determine the service to be detected from the undetected services in the service list to be detected. The embodiment of the present disclosure can detect multiple services in one detection cycle through the service list to be detected, which can improve the efficiency of detecting the service to be detected.
[0115] In an exemplary embodiment, referring to Figure 3 As shown, the above method also includes:
[0116] In step 302, when there is no undetected service in the list of services to be detected, at least one service to be detected recorded in the list to be detected is closed.
[0117] In step 304, based on the executable program file and configuration file corresponding to the at least one service to be detected in the main Flash, restart the at least one service to be detected;
[0118] In step 306, the executable program partition and the configuration partition of the standby Flash are unloaded from the target directory.
[0119] In the embodiment of the present disclosure, when the service to be detected runs successfully, the service to be detected can continue to run based on the executable program file and configuration file corresponding to the service to be detected in the standby Flash during the detection process of the standby Flash.
[0120] When all services in the list of services to be detected have been detected and there are no undetected services in the list of services to be detected, it is necessary to uninstall the executable service partition and configuration partition of the standby Flash to restore the BMC to the state of running based on the main Flash. At this time, you can shut down each service recorded in the list to be detected, and restart each service recorded in the list to be detected based on the executable program files and configuration files corresponding to each service recorded in the list to be detected in the main Flash. After each service recorded in the list to be detected has been started, you can uninstall the executable program partition and configuration partition of the standby Flash to complete the detection of the standby Flash in this cycle.
[0121] The Flash detection method provided by the embodiment of the present disclosure can restore the system to the original state based on the main Flash after completing the detection of the backup Flash in this cycle, and prepare for the backup Flash detection in the next cycle, so as to periodically implement the backup Flash detection and avoid the BMC entering an out-of-control state where it cannot be started and cannot alarm when the backup Flash also fails.
[0122] In an exemplary embodiment, the method further includes:
[0123] In the case that the service to be detected is the target service, the detection process of the backup Flash is interrupted, and the executable program partition and the configuration partition are uninstalled.
[0124] In the disclosed embodiment, the target service may be a relatively important service in the backup Flash, such as a monitoring service related to system health, etc. If the target service fails to run successfully, it indicates that a relatively serious problem has occurred in the backup Flash. At this time, there is no need to continue to detect other services. The detection process of the backup Flash may be directly interrupted, the executable program partition and the configuration partition may be uninstalled, and an alarm may be processed to instruct the operation and maintenance personnel to repair the backup Flash as soon as possible.
[0125] Exemplarily, a target service list can be set up, and the target service list can be used to store at least one important service to be tested. In the case that the movement of the service to be tested is unsuccessful, it can be determined whether there is a target service in the target service list that matches the service to be tested. When there is a target service that matches the service to be tested, the detection process of the backup Flash is interrupted, the executable program partition and the configuration partition are uninstalled, and an alarm is issued based on the detection service.
[0126] The Flash detection method provided in the embodiment of the present disclosure can interrupt the backup Flash detection process when an exception occurs in the target service, and instruct the operation and maintenance personnel to handle the exception of the backup Flash in a timely manner through an alarm without waiting until all services are detected, thereby improving the efficiency of detecting the backup Flash.
[0127] In an exemplary embodiment, referring to Figure 4 As shown, the above method also includes:
[0128] In step 402, the firmware data of the backup Flash is read, and a first verification code is generated according to the firmware data.
[0129] In step 404, the first check code and the second check code are matched, and the second check code is a check code generated according to the data to be written when the standby Flash is refreshing the firmware data.
[0130] In step 406, when the first check code and the second check code do not match, a third detection result for the firmware data of the spare Flash is obtained, and the third detection result is used to indicate that an abnormality occurs when the firmware data of the spare Flash is flashed.
[0131] In the disclosed embodiment, when the firmware data is flashed to the backup Flash, a signature can be set for the code segment to be written, and the second verification code corresponding to the data to be written can be determined based on the signatures of all the code segments. The disclosed embodiment does not specifically limit the method of determining the second verification code based on the signature of the code segment. For example, the signatures of all the code segments can be added to obtain the second verification code, and the disclosed embodiment does not specifically limit this.
[0132] After the second verification code is obtained, the second verification code may be stored. Exemplarily, the second verification code may be stored in the configuration partition of the standby Flash when the firmware data is flashed to the standby Flash.
[0133] When the executable program partition and configuration partition of the backup Flash are periodically mounted, the firmware data of the backup Flash can be detected at the same time. The signature of each code segment in the firmware data can be determined by reading the firmware data of the backup Flash, and the first check code of the firmware data can be determined in the same way as the second check code of the data to be written when the firmware data is flashed, and then the first check code is matched with the second check code. Since the first check code is determined based on the signatures of the code segments of all the firmware data written into the backup Flash, and the second check code is determined based on the signatures of all the code segments of the firmware data to be written into the backup Flash, when the first check code and the second check code are different, it can be determined that the detection result for the firmware data is the third detection result, that is, some code segments are not normally written into the backup Flash, and an abnormality occurs in the firmware data of the backup Flash when flashing.
[0134] On the other hand, if the first check code and the second check code are the same, it can be determined that the detection result for the firmware data is a normal result, that is, no abnormality occurs when the firmware data is flashed.
[0135] The Flash detection method provided by the embodiment of the present disclosure can generate a second check code according to the data to be written, and generate a first check code according to the firmware data, and then judge whether the firmware data is flashed normally according to whether the first check code and the second check code are the same, so that when the firmware data of the backup Flash is abnormal, an alarm can be issued in time to repair the firmware data of the backup Flash, so as to ensure that the backup Flash must be available when the main Flash fails and the BMC switches to the backup Flash, so as to avoid the situation where the backup Flash also fails and the BMC enters an out-of-control state where it cannot be started at all and cannot issue an alarm.
[0136] In an exemplary embodiment, referring to Figure 5 As shown, the above method also includes:
[0137] In step 502, according to the detection object corresponding to the target detection result, the bit identifier corresponding to the detection object in the detection log file is adjusted from the first identifier to the second identifier, wherein the target detection result includes the first detection result, the second detection result, and the third detection result, and the detection object includes at least one of the hardware of the backup Flash, the service to be detected of the backup Flash, and the firmware data of the backup Flash, the first identifier is used to characterize that the detection object is normal, and the second identifier is used to characterize that the detection object is abnormal.
[0138] In step 504, the detection object with the median identifier of the second identifier in the detection log file is used as an alarm object.
[0139] In step 506, alarm processing is performed according to the alarm object.
[0140] In the embodiment of the present disclosure, when it is determined that the detection result for the hardware of the standby Flash is the first detection result, it is determined that the detection object is the hardware of the standby Flash, and then the bit identifier corresponding to the hardware of the standby Flash in the detection log file is adjusted from the first identifier to the second identifier; or when it is determined that the detection result for the service to be detected for the standby Flash is the second detection result, it is determined that the detection object is the service to be detected, and then the bit identifier corresponding to the service to be detected in the detection log file is adjusted from the first identifier to the second identifier; or when it is determined that the detection result for the firmware data of the standby Flash is the third detection result, it is determined that the detection object is the firmware data of the standby Flash, and then the bit identifier corresponding to the firmware data of the standby Flash in the detection log file is adjusted from the first identifier to the second identifier. The first identifier can be 0, and the second identifier can be 1. It should be noted that the first identifier can also be 1, and the second identifier can also be 0, as long as the first identifier is different from the second identifier, and the embodiment of the present disclosure does not make specific limitations on this.
[0141] The detection log file can be read after uninstalling the executable program partition and configuration partition of the backup Flash and ending the detection of the backup Flash in this cycle. The bit identifiers in the detection log file can be read in sequence. When the mth bit identifier is read as the second identifier, the detection object corresponding to the mth bit identifier can be used as the alarm object, and an alarm process is performed according to the alarm object, and the subsequent bit identifiers are read. When the nth bit identifier is read as the second identifier again, the detection object corresponding to the nth bit identifier is used as the alarm object, and an alarm process is performed according to the alarm object... and so on, until all the bit identifiers are read; or, the detection objects whose all bit identifiers are the second identifier can be determined by first reading the bit identifier in the detection log file, and then the detection objects whose all bit identifiers are the second identifier can be used as the alarm object, and the alarm process is performed according to the alarm object. The embodiment of the present disclosure does not make specific limitations on this.
[0142] Since each target detection result has its corresponding specific exception type, the corresponding specific exception type can also be added to the alarm information when the alarm is processed according to the alarm object. For example, if the bit mark corresponding to the service to be detected in the standby Flash is the second mark, it can be determined that the reason why the bit mark is the second mark is that the executable program file and the configuration file of the service to be detected in the standby Flash do not match. At this time, "the executable program file and the configuration file of the service to be detected in the standby Flash do not match" can be added to the alarm information so that the operation and maintenance personnel can understand the cause of the abnormality.
[0143] The Flash detection method provided by the embodiment of the present disclosure can record the abnormalities occurring during the detection process through bit identification in the detection log file, and after the backup Flash detection is completed, alarm processing is performed by reading the data in the detection log file, so that when the backup Flash is abnormal, alarm repair can be performed in time according to the detection log file, so as to ensure that when the main Flash fails and the BMC switches to the backup Flash, the backup Flash must be available, and avoid the situation where the backup Flash also fails and the BMC enters an out-of-control state where it cannot be started at all and cannot alarm.
[0144] In order to enable those skilled in the art to better understand the embodiments of the present disclosure, the embodiments of the present disclosure are described below through specific examples.
[0145] Reference Figure 6 As shown, a flow chart of a Flash detection method is shown.
[0146] In the disclosed embodiment, when the BMC is running in user mode, the backup Flash detection process can be enabled manually or through an automatically started script. When the preset cycle time is reached, the system will automatically mount the configuration partition and executable service partition of the backup Flash to the target directory. If the mount is unsuccessful at this time, it can be determined that the detection result is the first detection result, and the backup Flash detection of this cycle is ended after recording the first detection result in the detection log file.
[0147] In the case of successful mounting, the services can be determined as services to be detected in order according to the arrangement order of each service in the service list to be detected, and the process of closing the service to be detected, loading the executable service file and configuration file of the service to be detected, determining the detection result for the service to be detected according to the running status of the service to be detected, and recording the detection result in the detection log file can be seen in the description of the aforementioned embodiment, and the embodiment of the present disclosure will not be repeated here.
[0148] During this period, the firmware data can be detected at the same time. A third detection result for the firmware data can be obtained by generating a first check code for the firmware data in the backup Flash and comparing the first check code with the second check code pre-stored in the backup Flash. The specific method of obtaining the first check code and the second check code can refer to the description in the aforementioned embodiment, and the embodiment of the present disclosure will not be repeated here.
[0149] When all services in the service list to be detected have been detected, the detection of the backup Flash in this cycle can be ended, the executable program partition and the configuration partition can be uninstalled, and the bit mark in the detection log file can be read. In the case where there is a bit mark as the second mark, an alarm can be processed according to the detection object with the bit mark as the second mark, and the operation and maintenance personnel can be called to intervene and repair. In the case where there is no bit mark as the second mark, the backup Flash detection of the next cycle can be entered normally.
[0150] The Flash detection method provided in the embodiment of the present disclosure can ensure that the BMC can normally switch to the backup Flash after an abnormality occurs in the main Flash, and the BMC will not be unable to operate normally due to abnormalities in both the main Flash and the backup Flash, causing the server to enter an out-of-control state. In addition, the embodiment of the present disclosure can complete the detection of the backup Flash when the BMC is running, without manually switching the BMC to the backup Flash to run to determine whether the backup Flash is normal, so that the full-automatic and rapid detection of the backup Flash can be achieved, thereby improving the efficiency of detecting the backup Flash.
[0151] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0152] Based on the same inventive concept, the embodiment of the present application also provides a Flash detection device for implementing the Flash detection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more Flash detection device embodiments provided below can refer to the limitations on the Flash detection method above, and will not be repeated here.
[0153] In one embodiment, Figure 7 As shown, a Flash detection device is provided, including: a mounting module 702, a first determination module 704, a start module 706, and a second determination module 708, wherein:
[0154] The mounting module 702 is used to periodically mount the executable program partition and the configuration partition of the standby Flash to the target directory during the BMC running based on the main Flash, wherein the executable program partition stores the executable program files of the BMC service;
[0155] A first determining module 704 is used to determine the service to be detected and close the service to be detected from the services currently running by the BMC if the executable program partition and the configuration partition are mounted successfully;
[0156] A starting module 706, configured to start the service to be detected based on the executable program file corresponding to the service to be detected in the executable program partition and the configuration file corresponding to the service to be detected in the configuration partition, and obtain the running status of the service to be detected;
[0157] The second determining module 708 is used to determine the detection result for the backup Flash according to the running status of the service to be detected.
[0158] The Flash detection device provided in the embodiment of the present disclosure can detect the service to be detected by periodically mounting the executable program partition and configuration partition of the standby Flash during the operation of the BMC based on the main Flash, and determine the detection result for the standby Flash according to the operation status of the service to be detected. That is, the standby Flash detection can be implemented periodically, so that when the standby Flash is abnormal, an alarm repair can be performed in time to ensure that the standby Flash must be available when the main Flash fails and the BMC switches to the standby Flash, so as to avoid the situation where the standby Flash also fails and the BMC enters an out-of-control state where it cannot be started and cannot alarm.
[0159] In one embodiment, the device further comprises:
[0160] The first detection module is used to obtain a first detection result for the hardware of the standby Flash when the executable program partition and the configuration partition are not mounted successfully, wherein the first detection result is used to indicate that an abnormality occurs in the hardware of the standby Flash.
[0161] In one embodiment, the second determining module is further used to:
[0162] When the running status of the service to be detected indicates that the service to be detected is not running successfully, a second detection result for the service to be detected is obtained, and the second detection result is used to indicate that the configuration file of the service to be detected does not match the executable program file of the service to be detected.
[0163] In one embodiment, the device further comprises:
[0164] The first restart module is used to restart the service to be detected based on the executable program file and configuration file corresponding to the service to be detected in the main Flash when the running status of the service to be detected indicates that the service to be detected fails to run successfully.
[0165] In one embodiment, the first determining module 704 is further configured to:
[0166] In the case that there are undetected services in the list of services to be detected, determining the service to be detected from the undetected services, wherein the list of services to be detected is used to record at least one service to be detected, the undetected service is a service in the list of services to be detected for which a detected mark is not set, and the detected mark is used to indicate that the service has completed detection;
[0167] A detected mark is set for the service to be detected in the list of services to be detected.
[0168] In one embodiment, the device further comprises:
[0169] A closing module, configured to close the at least one service to be detected recorded in the list to be detected if the undetected service does not exist in the list of services to be detected;
[0170] A second restart module, configured to restart the at least one service to be detected based on an executable program file and a configuration file corresponding to the at least one service to be detected in the main Flash;
[0171] The first uninstallation module is used to uninstall the executable program partition and the configuration partition of the backup Flash from the target directory.
[0172] In one embodiment, the device further comprises:
[0173] The second uninstallation module is used to interrupt the detection process of the backup Flash and uninstall the executable program partition and the configuration partition when the service to be detected is a target service.
[0174] In one embodiment, the device further comprises:
[0175] A reading module, used for reading the firmware data of the backup Flash and generating a first check code according to the firmware data;
[0176] A matching module, used for matching the first check code with a second check code, wherein the second check code is a check code generated according to the data to be written when the standby Flash performs firmware data refresh;
[0177] The second detection module is used to obtain a third detection result for the firmware data of the backup Flash when the first verification code and the second verification code do not match, and the third detection result is used to indicate that an abnormality occurs when the firmware data of the backup Flash is flashed.
[0178] In one embodiment, the device further comprises:
[0179] an adjustment module, adjusting, according to a detection object corresponding to a target detection result, a bit identifier corresponding to the detection object in a detection log file from a first identifier to a second identifier, wherein the target detection result includes a first detection result, a second detection result, and a third detection result, the detection object includes at least one of the hardware of the standby Flash, the service to be detected of the standby Flash, and the firmware data of the standby Flash, the first identifier is used to characterize that the detection object is normal, and the second identifier is used to characterize that the detection object is abnormal;
[0180] A processing module, used for taking the detection object with the bit identifier in the detection log file as the second identifier as an alarm object;
[0181] The alarm module is used to perform alarm processing according to the alarm object.
[0182] Each module in the above Flash detection device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0183] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a Flash detection method is implemented.
[0184] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0185] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0186] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0187] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0188] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0189] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0190] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0191] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A Flash detection method, characterized in that: The method comprises: During the BMC operation based on the main Flash, the executable program partition and the configuration partition of the standby Flash are periodically mounted to the target directory, wherein the executable program partition stores the executable program files of the BMC service, and the target directory is any directory of the Linux system; In the case that the executable program partition and the configuration partition are mounted successfully, determining a service to be detected, and shutting down the service to be detected from the services currently running by the BMC; Based on the executable program file corresponding to the service to be detected in the executable program partition and the configuration file corresponding to the service to be detected in the configuration partition, start the service to be detected and obtain the running status of the service to be detected; A detection result for the standby Flash is determined according to the running status of the service to be detected.
2. The method according to claim 1, characterized in that The method further comprises: In the case that the executable program partition and the configuration partition are not mounted successfully, a first detection result for the hardware of the standby Flash is obtained, and the first detection result is used to indicate that an abnormality occurs in the hardware of the standby Flash.
3. The method according to claim 1, characterized in that The step of determining the detection result for the standby Flash according to the running state of the service to be detected includes: When the running status of the service to be detected indicates that the service to be detected is not running successfully, a second detection result for the service to be detected is obtained, and the second detection result is used to indicate that the configuration file of the service to be detected does not match the executable program file of the service to be detected.
4. The method according to claim 3, characterized in that The method further comprises: When the running status of the service to be detected indicates that the service to be detected fails to run successfully, the service to be detected is restarted based on the executable program file and configuration file corresponding to the service to be detected in the main Flash.
5. The method according to claim 1, characterized in that The determining of the service to be detected includes: In the case that there are undetected services in the list of services to be detected, determining the service to be detected from the undetected services, wherein the list of services to be detected is used to record at least one service to be detected, the undetected service is a service in the list of services to be detected for which a detected mark is not set, and the detected mark is used to indicate that the service has completed detection; A detected mark is set for the service to be detected in the list of services to be detected.
6. The method according to claim 5, characterized in that The method further comprises: If the undetected service does not exist in the list of services to be detected, shut down the at least one service to be detected recorded in the list of services to be detected; Restarting the at least one service to be detected based on the executable program file and the configuration file corresponding to the at least one service to be detected in the main Flash; The executable program partition and the configuration partition of the standby Flash are uninstalled from the target directory.
7. The method according to claim 1, characterized in that The method further comprises: Reading the firmware data of the backup Flash, and generating a first check code according to the firmware data; Matching the first check code with a second check code, wherein the second check code is a check code generated according to the data to be written when the standby Flash is flashing firmware data; In the case that the first check code and the second check code do not match, a third detection result for the firmware data of the spare Flash is obtained, and the third detection result is used to indicate that an abnormality occurs in the firmware data of the spare Flash during flashing.
8. A Flash detection device, characterized in that: The device comprises: The mounting module is used to periodically mount the executable program partition and configuration partition of the standby Flash to the target directory during the BMC running based on the main Flash, wherein the executable program partition stores the executable program files of the BMC service, and the target directory is any directory of the Linux system; A first determination module is used to determine the service to be detected and close the service to be detected from the services currently running by the BMC when the executable program partition and the configuration partition are mounted successfully; A startup module, used to start the service to be detected based on the executable program file corresponding to the service to be detected in the executable program partition and the configuration file corresponding to the service to be detected in the configuration partition, and obtain the running status of the service to be detected; The second determining module is used to determine the detection result for the standby Flash according to the running status of the service to be detected.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Double-BMC FLASH upgrading method and equipment
CN110990045A
BMC firmware upgrading method and device, electronic device and storage medium
CN113703823A