Methods, apparatus, equipment, and media for the first time synchronization during the BMC startup phase.
By checking time synchronization during the BMC startup phase and comparing the time recorded in the configuration file, the problem of unsuccessful or excessively different BMC time synchronization is solved, achieving accurate BMC time synchronization and convenient log management.
Patent Information
- Application Number
- CN202310302083.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2043-03-24
AI Technical Summary
BMC startup phase time synchronization failure or too large difference from standard time leads to inconvenience in log management.
During the BMC startup phase, it determines whether time synchronization is successful, retrieves the recorded time from the configuration file, compares it with the server time, selects an appropriate time as the current time of the BMC, and periodically records the current time to the configuration file during operation to reduce time discrepancies.
By using software to reduce the time discrepancies caused by the abnormal first synchronization time during the BMC startup phase, BMC time synchronization becomes more accurate and log management is more convenient.
Smart Images

Figure CN116225572B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of BMC system time synchronization technology, specifically to a method, apparatus, device, and medium for the first time synchronization during the BMC startup phase. Background Technology
[0002] With the continuous development of technologies such as cloud computing, big data, and artificial intelligence, servers are ushering in new development opportunities. As the number of users operating servers increases and technology updates, the functionality of the Baseboard Management Controller (BMC) is also becoming increasingly powerful. In the server field, the BMC provides server management functions such as local and remote diagnostics, console support, configuration management, hardware management, fault analysis, and alarm push notifications. Since using these functions requires recording management logs, and these logs require corresponding timestamps, BMC time synchronization is necessary for convenient later management and log viewing.
[0003] Currently, the traditional BMC time synchronization method uses RTC, ME, BIOS, NTP server, etc. as time sources for BMC time synchronization. NTP is an application layer protocol used to synchronize computer time. It can synchronize the computer with its server or clock source (such as quartz clock, GPS, etc.) and can provide high-precision time correction. During the startup phase, BMC first synchronizes with the network NTP server. If that fails, it then synchronizes with the server's RTC time. If synchronization is successful, the server's time is used as the BMC time. If synchronization fails, a fixed time is used as the BMC time.
[0004] If the server time is inconsistent with the standard time or synchronization fails, using a fixed time may result in a large difference between the final BMC time setting and the standard time. Summary of the Invention
[0005] To address the issue that inconsistencies between the server time and the standard time, or unsuccessful synchronization, may lead to a significant difference between the final BMC time setting and the standard time, this invention provides a method, apparatus, device, and medium for the first time synchronization during the BMC startup phase.
[0006] In a first aspect, the present invention also provides a method for the first time synchronization during the BMC startup phase, comprising the following steps:
[0007] During the startup phase of the baseboard management controller, it is determined whether the time of the baseboard management controller and the server has been successfully synchronized.
[0008] Check if the configuration file used to store the recorded times exists;
[0009] When synchronization is successful and the configuration file exists, obtain the latest record time stored in the configuration file;
[0010] Compare the acquired time with the time of the synchronized server;
[0011] When the acquired time is faster than the time of the synchronized server, the acquired time is set to the current time of the baseboard management controller;
[0012] When the acquired time is not faster than the time of the synchronized server, the time of the synchronized server is used as the current time of the baseboard management controller.
[0013] During the startup and operation of the substrate management controller, the current substrate management controller time is periodically recorded into the configuration file.
[0014] As a preferred embodiment of the technical solution of the present invention, the method further includes:
[0015] If synchronization is successful but the configuration file does not exist, the time of the synchronized server is used as the current time of the baseboard management controller;
[0016] The substrate management controller starts up and completes the operation process, creating a configuration file for storing recorded time.
[0017] The current baseboard management controller time is periodically recorded in the configuration file.
[0018] As a preferred embodiment of the technical solution of the present invention, the method further includes:
[0019] If synchronization fails but the configuration file exists, retrieve the latest record time stored in the configuration file;
[0020] Set the acquired time to the current time of the baseboard management controller;
[0021] When synchronization fails and the configuration file does not exist, the default time is used as the current time of the baseboard management controller; execution steps: the baseboard management controller starts up and completes the running process to create a configuration file for storing the recorded time.
[0022] As a preferred embodiment of the technical solution of the present invention, during the startup phase of the baseboard management controller, the step of determining whether the time of the baseboard management controller and the server has been successfully synchronized includes:
[0023] During the startup phase of the baseboard management controller, the clock synchronization module of the baseboard management controller connects with the server clock module to obtain the time from the server clock module.
[0024] Determine whether the time from the clock module was successfully obtained;
[0025] If so, the time synchronization between the baseboard management controller and the server is successful;
[0026] If not, it is determined that the time synchronization between the baseboard management controller and the server has failed.
[0027] As a preferred embodiment of the technical solution of the present invention, in order to reduce the size of the configuration file and save storage space, the step of periodically recording the current time of the baseboard management controller into the configuration file during the startup and operation of the baseboard management controller includes:
[0028] Once the baseboard management controller has started and completed its operation, it periodically records the current baseboard management controller time. After recording a set time threshold, it deletes the historical time from the configuration file.
[0029] As a preferred embodiment of the technical solution of the present invention, the method further includes:
[0030] Based on the storage period of historical records in the configuration file, determine the storage location of the target record time in the configuration file.
[0031] As a preferred embodiment of the technical solution of the present invention, the method further includes:
[0032] The target recorded times are directly overwritten and stored sequentially at the storage location.
[0033] After the last recorded time is stored, if there are still historical time records in the location to be stored, the existing historical time records will be overwritten by a set constant. The historical time records are the recorded times before this startup.
[0034] By using the storage location in a round-robin fashion to overwrite the storage target record time, the storage process does not involve deleting the historical record time. This eliminates the need to equip an additional deletion unit to delete the historical record time at a set time, thus avoiding performance jitter issues.
[0035] Secondly, the technical solution of the present invention also provides a device for the first time synchronization during the BMC startup phase, including a synchronization processing module, a storage time acquisition module, a time comparison module, a time setting module, and a time recording module;
[0036] The synchronization processing module is used during the startup phase of the baseboard management controller to determine whether the time between the baseboard management controller and the server has been successfully synchronized; and to determine whether the configuration file for storing and recording time exists.
[0037] The storage time acquisition module is used to acquire the latest record time stored in the configuration file when the synchronization is successful and the configuration file exists;
[0038] The time comparison module is used to compare the acquired time with the time of the synchronized server;
[0039] The time setting module is used to set the acquired time as the current time of the baseboard management controller when the acquired time is faster than the time of the synchronized server; and to use the time of the synchronized server as the current time of the baseboard management controller when the acquired time is not faster than the time of the synchronized server.
[0040] The time recording module is used to periodically record the current time of the baseboard management controller into the configuration file during the startup and operation process of the baseboard management controller.
[0041] As a preferred embodiment of the technical solution of the present invention, the device further includes a configuration file creation module;
[0042] The time setting module is used to use the time of the synchronized server as the current time of the baseboard management controller when synchronization is successful but the configuration file does not exist;
[0043] The configuration file creation module is used to create a configuration file for storing recorded times when the baseboard management controller starts up and completes the running process if the configuration file does not exist.
[0044] As a preferred embodiment of the technical solution of the present invention, the method further includes:
[0045] The storage time acquisition module is used to acquire the latest record time stored in the configuration file when synchronization fails but the configuration file exists;
[0046] The time setting module is used to set the acquired time as the current time of the baseboard management controller; when synchronization fails and the configuration file does not exist, the default time is used as the current time of the baseboard management controller.
[0047] As a preferred embodiment of the technical solution of the present invention, during the startup phase of the baseboard management controller, the step of determining whether the time of the baseboard management controller and the server has been successfully synchronized includes:
[0048] During the startup phase of the baseboard management controller, the clock synchronization module of the baseboard management controller connects with the server clock module to obtain the time from the server clock module.
[0049] The synchronization processing module is used to determine whether the time of the clock module has been successfully obtained; if so, it determines that the time synchronization between the baseboard management controller and the server has been successful; if not, it determines that the time synchronization between the baseboard management controller and the server has failed.
[0050] As a preferred embodiment of the technical solution of the present invention, the device further includes a storage setting module, which is used to delete the historical time in the configuration file when the time recording module periodically records the current time of the substrate management controller after the set time threshold is recorded.
[0051] As a preferred embodiment of the technical solution of the present invention, the storage setting module is used to determine the storage location of the target recording time in the configuration file according to the storage period of the historical record time in the configuration file. Specifically, it is used to directly overwrite the target recording time to the storage location in sequence. When the last recording time is stored, if there is still a historical record time in the storage location, the existing historical record time is uniformly overwritten by a set constant, wherein the historical record time is the recording time before this startup.
[0052] Thirdly, the present invention also provides an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory storing computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to perform the method for the first time synchronization during the BMC startup phase as described in the first aspect.
[0053] Fourthly, the present invention also provides a non-transitory computer-readable storage medium storing computer instructions that cause the computer to execute the method for the first time synchronization during the BMC startup phase as described in the first aspect.
[0054] As can be seen from the above technical solutions, the present invention has the following advantages:
[0055] By configuring the Baseboard Management Controller (BMC) to periodically record its current time during startup, and setting the last recorded time stored in the configuration file when synchronization with the server fails, the BMC sets the current time to the last recorded time stored in the configuration file. Even if synchronization is successful, due to inaccurate server clocks, the BMC compares the acquired server clock time with the last recorded time stored in the configuration file and sets the faster time as its current time. This software-based approach reduces the time difference caused by the initial synchronization time anomaly during BMC startup, minimizing BMC time synchronization discrepancies.
[0056] Furthermore, the design principle of this invention is reliable, the structure is simple, and it has a very wide range of application prospects.
[0057] Therefore, it is evident that the present invention has outstanding substantive features and significant progress compared with the prior art, and the beneficial effects of its implementation are also obvious. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0059] Figure 1 This is a schematic flowchart of a method according to an embodiment of the present invention.
[0060] Figure 2 This is a schematic flowchart of a method according to another embodiment of the present invention.
[0061] Figure 3 This is a schematic block diagram of an apparatus according to an embodiment of the present invention.
[0062] Figure 4 This is a system block diagram of the BMC startup process and the synchronization time after startup. Detailed Implementation
[0063] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0064] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0065] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, or it may be an electrical, mechanical, or other form of connection.
[0066] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of the invention. To enable those skilled in the art to better understand the technical solutions in the invention, the technical solutions in the embodiments of the invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the invention, and not all of them. Based on the embodiments of the invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the invention.
[0067] Figure 1 This is a schematic flowchart of the method for the first time synchronization during the BMC startup phase provided by an embodiment of the present invention. The method includes the following steps:
[0068] Step 1: During the BMC startup phase, determine whether the time between the BMC and the server has been successfully synchronized, and check whether the configuration file used to store and record the time exists;
[0069] Step 2: When synchronization is successful and the configuration file exists, obtain the latest record time stored in the configuration file;
[0070] Step 3: Compare the acquired time with the time of the synchronized server;
[0071] Step 4: Is the time obtained faster than the time of the synchronized server? If yes, proceed to step 5; otherwise, proceed to step 6.
[0072] Step 5: Set the acquired time to the current time of the BMC; proceed to step 7;
[0073] Step 6: Use the time of the synchronized server as the current time of the BMC; proceed to Step 7;
[0074] Step 7: During the BMC startup process, the current BMC time is periodically recorded into the configuration file.
[0075] It's important to note that after BMC starts, time synchronization is typically managed by a BMC cluster. This cluster requires an NTP server. Time synchronization requires obtaining the time from the cluster's NTP server. Once all servers in the cluster have synchronized their NTP times, to prevent time discrepancies caused by changes in server times, a synchronization period is set for all servers in the cluster. This period can be configured according to user needs. When the period is reached, the servers in the cluster synchronize with the latest time source in turn.
[0076] This invention primarily addresses the problem of excessive discrepancies between BMC time and standard time, which can occur during the initial synchronization phase of the BMC (Browser Control Center) when it fails to synchronize with the network NTP server. Large BMC time deviations lead to significant log discrepancies, making subsequent log querying and management inconvenient. This application addresses this by setting a time period during normal BMC operation to record the current BMC time, such as every minute, and storing the recorded time in a persistent configuration file. This configuration file ensures data is not lost upon BMC restarts.
[0077] Figure 2 This is a schematic flowchart of the method for the first time synchronization during the BMC startup phase provided by an embodiment of the present invention. The method includes the following steps:
[0078] S1: During the BMC startup phase, check whether the time between the BMC and the server has been successfully synchronized; check whether the configuration file used to store the recorded time exists.
[0079] In this embodiment of the invention, the steps of determining whether the time of the BMC and the server has been successfully synchronized and determining whether the configuration file used to store the recorded time exists can be performed simultaneously;
[0080] When synchronization is successful and the configuration file exists, proceed to step S2;
[0081] If synchronization is successful but the configuration file does not exist, proceed to step S7;
[0082] If synchronization fails but the configuration file exists, proceed to step S10.
[0083] If synchronization fails and the configuration file does not exist, proceed to step S12.
[0084] S2: Obtain the latest record time stored in the configuration file;
[0085] S3: Compare the acquired time with the time of the synchronized server;
[0086] S4: Is the time obtained faster than the time of the synchronization server? If yes, proceed to step S5; otherwise, proceed to step S6.
[0087] S5: Set the acquired time to the current time of the BMC; proceed to step S13;
[0088] S6: Use the time of the synchronized server as the current time of the BMC; proceed to step S13;
[0089] S7: Use the time of the synchronized server as the current time of the BMC;
[0090] S8: After the BMC startup process is complete, a configuration file is created to store the recorded time.
[0091] S9: After creation, the current BMC time is periodically recorded in the configuration file;
[0092] S10: Obtain the latest record time stored in the configuration file;
[0093] S11: Set the acquired time to the current time of the BMC; proceed to step S13;
[0094] S12: Use the default time as the current time of the BMC; proceed to step 8;
[0095] S13: During the BMC startup process, the current BMC time is periodically recorded in the configuration file.
[0096] By configuring the BMC to periodically record the current BMC time during startup and operation, and setting the last recorded time stored in the configuration file when BMC synchronization with the server fails, the BMC's current time is set as the last recorded time stored in the configuration file. Even if BMC synchronization with the server succeeds, due to the possibility of server clock inaccuracies, the server clock time obtained during synchronization needs to be compared with the last recorded time stored in the configuration file, and the faster time is set as the BMC's current time. This software-based approach reduces the difference between the BMC time synchronization and the standard time caused by the first synchronization time anomaly during BMC startup, thus minimizing BMC time synchronization discrepancies.
[0097] Time synchronization during the BMC startup phase can be either during the first BMC startup or during the BMC restart process. This invention provides a method for time synchronization during the first BMC startup phase, specifically during a BMC restart. The method includes the following steps:
[0098] During normal operation of the BMC, the current BMC time is periodically recorded in the configuration file time.conf, for example, once every minute.
[0099] like Figure 4 As shown, when the BMC restarts, during the startup phase, the BMC synchronizes its time for the first time. At this time, because the network module is not started, the BMC cannot synchronize its time with the network NTP server, thus failing to synchronize with the server's time.
[0100] When the BMC synchronizes its time with the server, the BMC's clock synchronization module connects to the server's clock module RTC to obtain the server's time; it then determines whether the time from the clock module has been successfully obtained; if so, the BMC and server are considered to have successfully synchronized their time; otherwise, the synchronization has failed.
[0101] If time synchronization between the BMC and the server fails, the time stored in the time.conf file is used as the BMC's time. If time synchronization between the BMC and the server succeeds, the time stored in the time.conf file is read and compared with the server's time; if the time stored in the time.conf file is faster than the server's time, the time stored in the time.conf file is used as the BMC's time; otherwise, the server's time is used as the BMC's time.
[0102] This invention provides a method for the first time synchronization during the BMC startup phase, that is, the startup phase when the BMC restarts. The method includes the following steps:
[0103] During normal operation of the BMC, the current BMC time is periodically recorded in the configuration file time.conf, for example, once every minute.
[0104] When the BMC restarts, it synchronizes its time for the first time during the startup phase. At this time, because the network module is not started, the BMC cannot synchronize its time with the network NTP server, thus failing to synchronize with the server's time.
[0105] When the BMC synchronizes its time with the server, the BMC's clock synchronization module connects to the server's clock module RTC to obtain the server's time; it then determines whether the time from the clock module has been successfully obtained; if so, the BMC and server are considered to have successfully synchronized their time; otherwise, the synchronization has failed.
[0106] If time synchronization between the BMC and the server fails, the time stored in the time.conf file is used as the BMC's time. If time synchronization between the BMC and the server succeeds, the time stored in the time.conf file is read and compared with the server's time; if the time stored in the time.conf file is faster than the server's time, the time stored in the time.conf file is used as the BMC's time; otherwise, the server's time is used as the BMC's time.
[0107] To reduce the size of the configuration file and save storage space, the BMC periodically records the current BMC time into the configuration file during its startup and operation. Once a set time threshold is reached, the historical time records in the configuration file are deleted. The time threshold is typically the duration from the first time record after server startup to the completion of time synchronization with the NTP server after server startup. When synchronizing with the NTP server, the BMC uses the NTP server's time as its current time.
[0108] This invention provides a method for the first time synchronization during the BMC startup phase, that is, the startup phase when the BMC restarts. The method includes the following steps:
[0109] During normal operation of the BMC, the current BMC time is periodically recorded in the configuration file time.conf, for example, once every minute.
[0110] When the BMC restarts, it synchronizes its time for the first time during the startup phase. At this time, because the network module is not started, the BMC cannot synchronize its time with the network NTP server, thus failing to synchronize with the server's time.
[0111] When the BMC synchronizes its time with the server, the BMC's clock synchronization module connects to the server's clock module RTC to obtain the server's time; it then determines whether the time from the clock module has been successfully obtained; if so, the BMC and server are considered to have successfully synchronized their time; otherwise, the synchronization has failed.
[0112] If time synchronization between the BMC and the server fails, the time stored in the time.conf file is used as the BMC's time. If time synchronization between the BMC and the server succeeds, the time stored in the time.conf file is read and compared with the server's time; if the time stored in the time.conf file is faster than the server's time, the time stored in the time.conf file is used as the BMC's time; otherwise, the server's time is used as the BMC's time.
[0113] In this embodiment of the invention, the storage location of the target recording time in the configuration file is determined based on the storage period of the historical record times in the configuration file. In practice, the target recording times are directly overwritten and stored sequentially to the storage location. After the last recording time is stored, if there are still historical record times at the storage location, these historical record times are overwritten using a set constant. These historical record times are the recording times from before this startup.
[0114] By using the storage location in a round-robin fashion to overwrite the storage target record time, the storage process does not involve deleting the historical record time. This eliminates the need to equip an additional deletion unit to delete the historical record time at a set time, thus avoiding performance jitter issues.
[0115] like Figure 3 As shown, this embodiment of the invention also provides a device for the first time synchronization during the BMC startup phase, including a synchronization processing module, a storage time acquisition module, a time comparison module, a time setting module, and a time recording module;
[0116] The synchronization processing module is used during the startup phase of the baseboard management controller to determine whether the time between the baseboard management controller and the server has been successfully synchronized; and to determine whether the configuration file for storing and recording time exists.
[0117] The storage time acquisition module is used to acquire the latest record time stored in the configuration file when the synchronization is successful and the configuration file exists;
[0118] The time comparison module is used to compare the acquired time with the time of the synchronized server;
[0119] The time setting module is used to set the acquired time as the current time of the baseboard management controller when the acquired time is faster than the time of the synchronized server; and to use the time of the synchronized server as the current time of the baseboard management controller when the acquired time is not faster than the time of the synchronized server.
[0120] The time recording module is used to periodically record the current time of the baseboard management controller into the configuration file during the startup and operation process of the baseboard management controller.
[0121] This invention also provides a device for the first time synchronization during the BMC startup phase, including a configuration file creation module, a synchronization processing module, a storage time acquisition module, a time comparison module, a time setting module, and a time recording module;
[0122] The synchronization processing module is used during the startup phase of the baseboard management controller to determine whether the time between the baseboard management controller and the server has been successfully synchronized; and to determine whether the configuration file for storing and recording time exists.
[0123] The storage time acquisition module is used to acquire the latest record time stored in the configuration file when the synchronization is successful and the configuration file exists;
[0124] The time comparison module is used to compare the acquired time with the time of the synchronized server;
[0125] The time setting module is used to set the acquired time as the current time of the baseboard management controller when the acquired time is faster than the time of the synchronized server; and to use the time of the synchronized server as the current time of the baseboard management controller when the acquired time is not faster than the time of the synchronized server.
[0126] The time recording module is used to periodically record the current time of the baseboard management controller into the configuration file during the startup and operation process of the baseboard management controller.
[0127] The configuration file creation module is used to create a configuration file when the baseboard management controller starts up and completes the running process, if the configuration file does not exist.
[0128] The storage time acquisition module is used to acquire the last record time stored in the configuration file when synchronization fails but the configuration file exists;
[0129] The time setting module is used to set the last recorded time as the current time of the baseboard management controller; when synchronization fails and the configuration file does not exist, the default time is used as the current time of the baseboard management controller.
[0130] During the startup phase of the baseboard management controller, the clock synchronization module of the baseboard management controller connects with the server clock module to obtain the time from the server clock module.
[0131] The synchronization processing module is used to determine whether the time of the clock module has been successfully obtained; if so, it determines that the time synchronization between the baseboard management controller and the server has been successful; if not, it determines that the time synchronization between the baseboard management controller and the server has failed.
[0132] The storage settings module is used to record the time of the baseboard management controller during startup and operation. The time recording module periodically records the current time of the baseboard management controller. After the set time threshold is reached, the historical time in the configuration file is deleted.
[0133] Alternatively, in some embodiments, the storage setting module is used to determine the storage location of the target recording time in the configuration file according to the storage period of the historical record time in the configuration file. Specifically, it is used to directly overwrite the target recording time to the storage location in sequence. When the last recording time is stored, if there are still historical record times in the storage location, the existing historical record times are uniformly overwritten by a set constant, where the historical record time is the recording time before this startup.
[0134] This invention also provides an electronic device, comprising: a processor, a communication interface, a memory, and a bus, wherein the processor, communication interface, and memory communicate with each other via the bus. The bus can be used for information transmission between the electronic device and a sensor. The processor can call logical instructions in the memory to execute the following method: S1: BMC startup phase, determining whether the time of the BMC and the server is successfully synchronized; determining whether a configuration file for storing recorded time exists; when synchronization is successful and the configuration file exists, executing step S2; when synchronization is successful but the configuration file does not exist, executing step S7; when synchronization fails but the configuration file exists, executing step S10; when synchronization fails and the configuration file does not exist, executing step S12; S2: obtaining the latest recorded time stored in the configuration file; S3: comparing the obtained time with the time of the synchronized server; S4: whether the obtained time is faster than the time of the synchronized server; if yes, executing step S5; otherwise, executing step S6; S5: setting the obtained time as the current time of the BMC; executing step S13;
[0135] S6: Use the time of the synchronized server as the current time of the BMC; execute step S13; S7: Use the time of the synchronized server as the current time of the BMC; S8: After the BMC startup process is complete, a configuration file for storing recorded times is created; S9: The current BMC time is periodically recorded in the configuration file. S10: Obtain the latest recorded time stored in the configuration file; S11: Set the obtained time as the current time of the BMC; execute step S13; S12: Use the default time as the current time of the BMC; execute step 8; S13: During the BMC startup process, the current BMC time is periodically recorded in the configuration file.
[0136] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the technology, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0137] This invention provides a non-transitory computer-readable storage medium storing computer instructions that cause a computer to execute the method provided in the above-described method embodiments. For example, the instructions include: S1: BMC startup phase, determining whether the BMC and server time are successfully synchronized; determining whether a configuration file for storing recorded times exists; if synchronization is successful and the configuration file exists, executing step S2; if synchronization is successful but the configuration file does not exist, executing step S7; if synchronization fails but the configuration file exists, executing step S10; if synchronization fails and the configuration file does not exist, executing step S12; S2: obtaining the latest recorded time stored in the configuration file; S3: comparing the obtained time with the time of the synchronized server; S4: determining whether the obtained time is faster than the time of the synchronized server; if yes, executing step S5; otherwise, executing step S6.
[0138] S5: Set the acquired time as the current time of the BMC; execute step S13; S6: Use the time of the synchronized server as the current time of the BMC; execute step S13; S7: Use the time of the synchronized server as the current time of the BMC; S8: The BMC startup process completes and creates a configuration file for storing recorded times; S9: Periodically record the current BMC time in the configuration file. S10: Obtain the latest recorded time stored in the configuration file; S11: Set the acquired time as the current time of the BMC; execute step S13; S12: Use the default time as the current time of the BMC; execute step 8; S13: During the BMC startup process, periodically record the current BMC time to the configuration file.
[0139] The method, apparatus, device, and medium for the first time synchronization during the BMC startup phase of this invention are the units and algorithm steps of various examples described in conjunction with the embodiments disclosed herein. These can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0140] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the invention should also be covered within the protection scope of the invention. Therefore, the protection scope of the invention should be determined by the scope of the claims.
Claims
1. A method for BMC first-time phase 1, characterized in that, The method comprises the following steps: A substrate management controller startup phase determines whether the substrate management controller and the server time synchronization is successful; Determine whether the configuration file for persistently storing a plurality of historical time records exists; When synchronization is successful and the configuration file exists, the latest record time stored in the configuration file is obtained; The obtained latest record time is compared with the synchronized server time; When the obtained latest record time is faster than the synchronized server time, the obtained latest record time is set as the current time of the substrate management controller; When the obtained latest record time is not faster than the synchronized server time, the synchronized server time is used as the current time of the substrate management controller; The substrate management controller startup completion running process periodically records the current substrate management controller time in the configuration file to update the historical time records; When synchronization is successful but the configuration file does not exist, the synchronized server time is used as the current time of the substrate management controller; The substrate management controller startup completion running process creates a configuration file for storing record time; After creation, the current substrate management controller time is periodically recorded in the configuration file; When synchronization fails but the configuration file exists, the latest record time stored in the configuration file is obtained; The obtained latest record time is set as the current time of the substrate management controller; When synchronization fails and the configuration file does not exist, the default time is used as the current time of the substrate management controller; the substrate management controller startup completion running process creates a configuration file for storing record time.
2. The method for BMC to time the first time of the boot stage according to claim 1, characterized in that, The step of determining whether the substrate management controller and the server time synchronization is successful in the substrate management controller startup phase comprises: In the substrate management controller startup phase, the clock synchronization module of the substrate management controller is connected with the server clock module to obtain the time of the server clock module; Determine whether the time of the clock module is successfully obtained; If yes, it is determined that the substrate management controller and the server time synchronization is successful; If not, it is determined that the substrate management controller and the server time synchronization fails.
3. The method for BMC to time the first time of the boot stage according to claim 1, characterized in that, The step of periodically recording the current substrate management controller time in the configuration file in the substrate management controller startup completion running process comprises: In the substrate management controller startup completion running process, when the historical record time in the configuration file is deleted after a set time threshold is recorded, the historical record time is deleted.
4. The method for BMC to time the first time of the boot stage according to claim 1, characterized in that, The method further comprises: According to the storage period of the historical record time in the configuration file, the target record time is determined in the storage position of the configuration file.
5. The method for BMC to time the first time of the boot stage according to claim 4, characterized in that, The method further comprises: The target record time is directly stored in the storage position in sequence; After the storage of the last record time is completed, if there is historical record time in the storage position, the existing historical record time is uniformly covered by a set constant, wherein the historical record time is the record time before this startup.
6. An apparatus for implementing the first time synchronization of the BMC boot phase according to the method of any one of claims 1-5, characterized in that, It comprises a synchronization processing module, a storage time obtaining module, a time comparison module, a time setting module, and a time recording module; The synchronization processing module is configured to determine whether the time of the BMC and the server is successfully synchronized in a BMC startup stage; and determine whether a configuration file for storing a record time exists. The record time obtaining module is configured to obtain the latest record time stored in the configuration file when the synchronization is successful and the configuration file exists. The time comparison module is configured to compare the obtained time with the time of the synchronized server. The time setting module is configured to set the obtained time as the current time of the BMC when the obtained time is faster than the time of the synchronized server; and use the time of the synchronized server as the current time of the BMC when the obtained time is not faster than the time of the synchronized server. The time recording module is configured to periodically record the current BMC time in the configuration file during a running process after the BMC is started.
7. An electronic device, comprising: The electronic device comprises at least one processor and a memory connected with the at least one processor in communication; the memory stores computer program instructions executable by the at least one processor, and the computer program instructions are executed by the at least one processor to enable the at least one processor to execute the method for first time synchronization in a BMC startup stage according to any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium, comprising: The non-transitory computer readable storage medium stores computer instructions, and the computer instructions enable the computer to execute the method for first time synchronization in a BMC startup stage according to any one of claims 1 to 5.
Citation Information
Patent Citations
BMC time acquiring method, device, equipment and storable medium
CN108415817A
Time synchronization method and server
CN112148065A
