Asset information acquisition method and device, electronic equipment and storage medium
By setting up first and second storage devices in the server and utilizing the backup data verification and valid bit information mechanism of the second manager, the problem of asset information errors caused by frequent writes to the storage device is solved, ensuring that the server obtains accurate information and improving stability and storage lifespan.
Patent Information
- Application Number
- CN202511005476.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-11-21
AI Technical Summary
During the server's boot process, frequent writing of asset information caused a problem with the storage, resulting in the first manager obtaining incorrect asset information and failing to function properly.
In the asset information interaction system, a first memory and a second memory are set up. The second asset information is written to the second memory as backup data through the second manager. The storage medium and transmission link of the first memory are verified, and valid bit information is set. If there are no problems, the second asset information is written to the first memory, and a write completion notification is sent so that the first manager can read the accurate asset information.
This ensures that the first manager obtains accurate asset information, improves server stability, reduces the number of times the memory is erased and rewritten, extends memory lifespan, and automatically repairs link problems when they are repairable, thus improving repair efficiency.
Smart Images

Figure CN120994462A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of server technology, and in particular to methods, apparatus, electronic devices and storage media for acquiring asset information. Background Technology
[0002] In the server technology field, for security reasons, during the server boot-up phase, the second manager first identifies the server's asset information and sends this information unilaterally to the first manager. This means the first manager cannot proactively initiate interaction with the second manager. After receiving the asset information from the second manager, the first manager integrates and uses the asset information it identified with the second manager. For example, the first manager could be a Baseboard Management Controller (BMC), and the second manager could be a Basic Input Output System (BIOS) integrated circuit.
[0003] Since the primary manager needs all asset information, a storage device is typically placed between the primary and secondary managers. Both managers can write the asset information they identify into this storage device, allowing the primary manager to access all asset information. However, because this process of writing asset information to the storage device occurs every time the server starts, problems can arise. This can cause the primary manager to obtain incorrect asset information, preventing the server from functioning properly. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, storage medium, and program product for acquiring asset information, in order to solve the problem that the server cannot function properly because the first manager acquires incorrect asset information.
[0005] This application provides an asset information acquisition method, which is applied to an asset information interaction system. The asset information interaction system includes a first manager, a second manager, a first memory, and a second memory. The method is executed by the first manager and includes:
[0006] Obtain primary asset information;
[0007] The first asset information is written into the first memory. The second manager writes the second asset information it has acquired into the second memory. Based on the first asset information and the second asset information read from the first memory, it determines whether to write the second asset information into the first memory and sets the valid bit information in the first memory. When it is determined that the second asset information should be written into the first memory, the second asset information is written into the first memory.
[0008] When a write completion notification is received from the second manager, the valid bit information is read from the first memory;
[0009] Based on the valid bit information, the target memory is determined in the first memory and the second memory;
[0010] Read the second asset information from the target storage;
[0011] Based on the second asset information and the first asset information, generate total asset information.
[0012] This application also provides an asset information acquisition device, which is applied to an asset information interaction system. The asset information interaction system includes a first manager, a second manager, a first memory, and a second memory. The device includes:
[0013] The acquisition module is used to acquire the first asset information;
[0014] The write module is used to write the first asset information into the first memory. The second manager writes the second asset information it has acquired into the second memory. Based on the first asset information and the second asset information read from the first memory, it determines whether to write the second asset information into the first memory, sets the valid bit information in the first memory, and writes the second asset information into the first memory when it is determined that the second asset information should be written into the first memory.
[0015] The read module is used to read valid bit information from the first memory when it receives a write completion notification sent by the second manager;
[0016] The determination module is used to determine the target memory in the first memory and the second memory based on the valid bit information;
[0017] The reading module is also used to read second asset information from the target storage;
[0018] The generation module is used to generate total asset information based on the second asset information and the first asset information.
[0019] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above-described asset information acquisition methods.
[0020] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described asset information acquisition methods.
[0021] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described asset information acquisition methods.
[0022] According to this application, since the asset information obtained by both the first manager and the second manager is incomplete, and the first manager needs to perform business processing based on complete asset information, a first memory and a second memory can be set up in the aforementioned asset information interaction system for exchanging asset information. Because the first memory, as the main memory, may be damaged due to frequent read / write operations, resulting in the inability to correctly store asset information, or there may be problems with the communication link between the first memory and the first manager, leading to errors in the transmitted asset information, the second manager can first write the second asset information as backup data into the second memory. Simultaneously, it verifies the storage medium of the first memory and whether there are problems with the transmission link between the first memory and the first manager based on the second asset information, and sets valid bit information. If there are no problems, the second manager can write the second asset information into the first memory; if there are problems, the second manager does not need to write the second asset information into the first memory. After completing the above operations, the second manager can send a write completion notification to the first manager. Upon receiving this notification, the first manager can read the valid bit information from the first memory. Based on this information, the first manager can determine the target memory for storing accurate second asset information, read the second asset information from the target memory, and merge it with the first asset information it has already read to form the total asset information. Through this process, the first manager can obtain accurate asset information, ensuring the server functions correctly and improving its stability. Attached Figure Description
[0023] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This application provides an architectural diagram of an asset information interaction system.
[0025] Figure 2 A flowchart illustrating an asset information acquisition method provided in this application embodiment;
[0026] Figure 3 A flowchart illustrating a memory verification method provided in an embodiment of this application;
[0027] Figure 4 A flowchart illustrating another method for obtaining asset information provided in this application embodiment;
[0028] Figure 5 A flowchart illustrating another method for obtaining asset information provided in this application embodiment;
[0029] Figure 6 A flowchart illustrating another memory verification method provided in an embodiment of this application;
[0030] Figure 7 A schematic diagram of memory partitioning provided in an embodiment of this application;
[0031] Figure 8 This is a schematic diagram of the structure of an asset information acquisition device provided in an embodiment of this application;
[0032] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0034] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0035] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0036] The asset information acquisition method provided in this application can be implemented by an asset information exchange system, such as... Figure 1As shown, the asset information interaction system may include a first manager, a second manager, a first memory, and a second memory. For example, the first manager may be a Baseboard Management Controller (BMC), and the second manager may be a Basic Input Output System (BIOS) integrated circuit. Both the first and second memories may be electrically erasable programmable read-only memory (EEPROM). The second memory may also be a Complementary Metal Oxide Semiconductor (CMOS) Random Access Memory (RAM). Both the first and second managers are electrically connected to the first and second memories. The first and second managers are electrically connected, for example, through a General-Purpose Input / Output (GPIO) interface.
[0037] Embodiments of this application provide an asset information acquisition method, which can be executed by the aforementioned first manager, such as... Figure 2 As shown, the specific processing steps of the asset information acquisition method may include:
[0038] Step S201: Obtain the first asset information.
[0039] The first asset information can be the configuration information of the server's components.
[0040] Specifically, after the server is powered on, the first manager, upon startup, can obtain configuration information of multiple components (e.g., network cards, hard drives) within the server via I2C lines or the Management Component Transport Protocol (MCTP) over the Peripheral Component Interconnect Express (PCIe) bus. This configuration information constitutes the aforementioned first asset information. Furthermore, the first manager can write this first asset information to its own storage location.
[0041] In some optional implementations, the first manager can obtain the first asset information based on a specified firmware version. Accordingly, the specific process by which the first manager obtains the first asset information may include:
[0042] Step 1: Obtain target version information.
[0043] Step 2: Based on the target version information, read the identification information of at least one configuration item that matches both the first manager and the target version information from the first storage.
[0044] Step 3: Based on the identifier information of each configuration item, obtain the configuration information corresponding to each configuration item.
[0045] The configuration information corresponding to each configuration item constitutes the first asset information. The identification information of the configuration item may include component type and parameters, such as network interface card temperature.
[0046] Specifically, the first memory can store identification information of configuration items that need to be scanned for different versions. Accordingly, when the first manager obtains the target version information, it can first determine the target storage location corresponding to the target version information in the first memory, and read the identification information of at least one configuration item that needs to be scanned under the target version information from the target storage location. Furthermore, the first manager can scan the components corresponding to each configuration item based on the identification information of each configuration item to obtain the configuration information corresponding to each configuration item.
[0047] Step S202: Write the first asset information into the first memory.
[0048] Specifically, the first manager can write the first asset information to a designated location in the first memory. Furthermore, the first manager can also set the completion bit information in the first memory to a first preset value (e.g., 1). When the server powers on, the second manager can scan multiple components of the server to obtain the second asset information. Then, the second manager can write the second asset information to the second memory as backup data. Similarly, the second manager can also set the completion bit information in the second memory to the first preset value.
[0049] Furthermore, to confirm whether the first memory correctly stores the first asset information and can correctly transmit the second asset information, the second manager can determine whether to write the second asset information to the first memory based on the first and second asset information read from the first memory, and set the valid bit information in the first memory. When it is determined that the second asset information should be written to the first memory, the second asset information is written to the first memory. Specifically, before reading the first asset information from the first memory, the second manager can first read the completion bit information from the first memory. If the completion bit information is determined to be the second preset information (for example, it can be 0), the valid bit information in the first memory can be directly set to the second preset information. When the completion bit information is determined to be the first preset information, the first manager can then read the first asset information from the first memory. Since the completion bit information being the second preset information indicates that the first manager has not yet written the complete first asset information to the first memory, or the first manager is in the process of starting up, directly reading it may result in reading incomplete asset information, leading to subsequent judgment errors. Therefore, by setting the completion bit information, it can be ensured that the second manager can read the complete first asset information.
[0050] The second manager, based on the first asset information and the second asset information it has acquired, sets the valid bit information in the first memory, which may specifically include the following steps:
[0051] Step 1: Based on the identification information of each configuration item included in the first asset information and the identification information of each configuration item included in the second asset information, determine the candidate configuration items with the same identification information.
[0052] Step 2: Based on the configuration information corresponding to the candidate configuration items in the first asset information and the configuration information corresponding to the candidate configuration items in the second asset information, determine whether the first memory correctly stores the first asset information.
[0053] Step 3: When it is determined that the first memory correctly stores the first asset information, the valid bit information in the first memory is set to the first preset information. Alternatively, when it is determined that the first memory does not correctly store the first asset information, the valid bit information in the first memory is set to the second preset value.
[0054] Because the configuration items scanned by the first manager and the second manager differ and overlap, and because the second asset information acquired by the second manager has not yet interacted with the storage medium, errors are generally unlikely. However, the first asset information, having already been written to the storage medium, may contain erroneous data due to storage medium damage. Therefore, the second manager can use its acquired second asset information as a benchmark to judge the first asset information. Specifically, the second manager can determine whether the configuration information of identical configuration items in the first and second asset information is consistent. If they are consistent, it indicates that the first storage correctly stores the first asset information; if they are inconsistent, it indicates that the first storage has not correctly stored the first asset information.
[0055] Furthermore, if the first memory can correctly store the first asset information, the second manager can also write the second asset information it has acquired into the first memory, reducing the number of read / write operations on the second memory. If the first memory fails to correctly store the first asset information, since the second memory serves as a backup memory and the probability of storage medium errors is extremely small, the first manager can read the written second asset information from the second memory.
[0056] In some optional implementations, based on the first asset information obtained by the first manager according to the target version information in step S201, the first manager writing the first asset information to the first memory may include the following specific steps:
[0057] Step 1: Based on the identifier information and target version information of the target configuration item, write the configuration information corresponding to the target configuration information into the first memory.
[0058] The target configuration item is any one of at least one configuration item.
[0059] Step 2: When the writing operation of the configuration information corresponding to all configuration items in at least one configuration item is completed, determine that the first asset information is written to the first memory.
[0060] Specifically, the first manager can determine the target sub-storage location of the target configuration item in the first memory based on the target version information and the identifier information of the target configuration item (specifically, it can first determine the target storage location corresponding to the target version information, and then determine the target sub-storage location corresponding to the target version information within the target storage location), and write the configuration information of the target configuration item into the target sub-storage location. In this way, the configuration information of each configuration item can be written to the first memory in a similar manner.
[0061] The method by which the second manager obtains the second asset information can be similar to the method by which the first manager obtains the first asset information based on the target version information in step one. Accordingly, the second manager can write the second asset information to the first or second memory in a similar way to the method by which the first asset information is written based on the configuration item's identifier information and the target version information in step one. This will not be elaborated here.
[0062] Step S203: When a write completion notification is received from the second manager, the valid bit information is read from the first memory.
[0063] Specifically, after setting the valid bit information in the first memory, the second manager can notify the first manager via the GPIO interface. In this way, the first manager can receive the write completion notification sent by the second manager. To determine the read location of the second asset information, the first manager can read the valid bit information from the first memory.
[0064] Step S204: Determine the target memory in the first memory and the second memory based on the valid bit information.
[0065] Specifically, when the first manager reads valid bit information, it can determine the storage location of the second asset information based on the valid bit information. Correspondingly, when the first manager determines that the valid bit information is the first preset information, it indicates that the second manager believes the storage medium (first memory) storing the asset information is problem-free, and the link between the first manager and the first memory is problem-free. Therefore, the first memory can be designated as the target memory. Alternatively, when the first manager determines that the valid bit information is the second preset information, it indicates that the second manager believes there is a problem with the storage medium storing the asset information in the first memory, or there is a problem with the link between the first manager and the first memory. In this case, the second memory can be designated as the target memory.
[0066] Step S205: Read the second asset information from the target memory.
[0067] Specifically, when the target storage is determined to be the first storage, the first manager can read the second asset information from the first storage. When the target storage is determined to be the second storage, the first manager can read the second asset information from the second storage.
[0068] In some optional implementations, when the target memory is determined to be the second memory, the first manager can first read the completion bit information from the second memory and determine whether the completion bit information is the first preset information. If it is, then it reads the second asset information. This ensures that complete second asset information is read. If not, an alarm can be reported to the target device. The target device can be the client device where the technician is located.
[0069] In some optional implementations, the first manager may also read the configuration information of all configuration items from the storage location corresponding to the target version information in the target storage, that is, read the second asset information.
[0070] Step S206: Generate total asset information based on the second asset information and the first asset information.
[0071] Specifically, when the first manager reads the second asset information, it can merge the second asset information with the first asset information it has obtained. Specifically, it can retain the configuration information of the configuration items that differ, and keep only one copy of the configuration information of the same configuration items. In this way, the complete total asset information can be obtained.
[0072] For example, the first manager can obtain the network card's temperature, and the second manager can obtain the network card's Media Access Control (MAC) address. Both the first and second managers can obtain the network card's vendor ID (VID). The vendor ID is the overlapping configuration item mentioned above. The merged total asset information can include the network card's MAC address, VID, and temperature.
[0073] In some optional implementations, after generating the total asset information, the first manager can store the total asset information in its own memory and perform a hash calculation on the first asset information to obtain a first hash value, which is then written into its own memory. This way, after the server powers on again, the first manager can retrieve the first asset information again, perform a hash calculation on the retrieved first asset information, and obtain a third hash value. Furthermore, the first manager can determine whether the first hash value and the third hash value are consistent. If they are consistent, the first manager can read the previously recorded total asset information from its own memory, without needing to read the second asset information from the first or second memory, greatly reducing the number of write / erase cycles of the first and second memory, increasing their lifespan, and reducing the probability of problems. If they are inconsistent, the total asset information is regenerated following the above steps.
[0074] In some optional implementations, the second manager can also perform a hash calculation on the second asset information upon acquisition, obtaining a fourth hash value which is stored in its own memory. Thus, upon the server's next power-on and startup, the second manager can reacquire the second asset information and perform a hash calculation on it to obtain a fifth hash value. If the fourth hash value matches the fifth hash value, the second manager does not need to write the reacquired second asset information to either the first or second memory, significantly reducing the number of erase / write operations on the first and second memories.
[0075] The asset information acquisition method in this application addresses the issue that the asset information acquired by both the first manager and the second manager is incomplete, while the first manager needs to perform business processing based on complete asset information. Accordingly, a first memory and a second memory can be set up in the aforementioned asset information interaction system for exchanging asset information. Since the first memory, as the main memory, may become damaged due to frequent read / write operations, preventing it from correctly storing asset information, or there may be problems with the communication link between the first memory and the first manager, leading to errors in the transmitted asset information, the second manager can first write the second asset information as backup data into the second memory. Simultaneously, it verifies the storage medium of the first memory and checks for problems with the transmission link between the first memory and the first manager based on the second asset information, and sets valid bit information. If there are no problems, the second manager can write the second asset information into the first memory; if there are problems, the second manager does not need to write the second asset information into the first memory. After completing the above operations, the second manager can send a write completion notification to the first manager. Upon receiving this notification, the first manager can read the valid bit information from the first memory. Based on this information, the first manager can determine the target memory for storing accurate second asset information, read the second asset information from the target memory, and merge it with the first asset information it has already read to form the total asset information. Through this process, the first manager can obtain accurate asset information, ensuring the server functions correctly and improving its stability.
[0076] To determine whether a problem in the first memory or a problem in the communication link between the first memory and the first manager is a repairable problem (e.g., a temporary problem caused by interference, which is a repairable problem), and if it is determined to be a repairable problem, the asset information in the first memory is repaired. Accordingly, when the valid bit information is determined to be the second preset information, and the first manager is in a preset working state (which could be an idle state, not performing any other services, or its load being less than a preset load threshold), the first management controller can perform the asset information recovery operation. Accordingly, embodiments of this application also provide a memory verification method, which can be executed by the aforementioned first manager, such as... Figure 3 As shown, the specific processing steps of the memory verification method may include:
[0077] Step S301: Erase the first asset information stored in the first memory.
[0078] Specifically, the first manager can first clear the first asset information in the first storage.
[0079] Step S302: Rewrite the first asset information into the first memory, and write the second asset information into the first memory.
[0080] Specifically, after the erasure operation is completed, the first manager can rewrite the first asset information into the first memory and write the second asset information into the first memory (originally only written into the second memory, this is the first time the second asset information is written into the first memory).
[0081] Step S303: Set the valid bit information in the first memory to the third preset information.
[0082] The third preset information can be determined based on the first preset information and the preset number of repairs. For example, if the first preset information is 1 and the preset number of repairs is 3, the third preset information can be 4.
[0083] Specifically, the first manager can set the valid bit information in the first memory to the third preset information.
[0084] Step S304: Obtain the first hash value.
[0085] Specifically, when the first manager obtains the first asset information, it can perform a hash calculation on the first asset information to obtain the first hash value and write the first hash value into its own memory. Correspondingly, during the recovery process, the first manager can read the first hash value from its own memory.
[0086] Step S305: In the current round of verification operation, read the first asset information from the first memory again, and read the second asset information from the first memory again.
[0087] Specifically, the first manager can repeat the verification operation multiple times. In each round of verification operation, the first manager can reread the first asset information and the second asset information from the first memory.
[0088] Step S306: Determine the verification result corresponding to the current round based on the first hash value, the first asset information reread from the first memory, and the second asset information read from the first memory.
[0089] Specifically, in each round of verification operations, when the first manager reads the first asset information and the second asset information, it can verify the first asset information and the second asset information respectively to obtain the verification result for that round. Accordingly, the following specific steps may be included:
[0090] Step 1: Perform a hash calculation on the first asset information reread from the first memory to obtain the second hash value.
[0091] Step two: Determine the verification result based on the first hash value, the second hash value, and the second asset information read from the first memory.
[0092] The first manager can perform a hash calculation on the reread first asset information to obtain a second hash value, and then verify the first asset information based on the first hash value and the second hash value. Furthermore, if the first asset information is verified to be correct, the second asset information is verified based on the first asset information to obtain a verification result. Accordingly, step two above can specifically include:
[0093] Step 1: Determine whether the first storage device correctly stores the first asset information based on the first hash value and the second hash value.
[0094] Step 2: When it is determined that the first memory correctly stores the first asset information, determine whether the first memory correctly stores the second asset information based on the first asset information reread from the first memory and the second asset information read from the first memory.
[0095] Step 3: If it is determined that the first memory correctly stores the second asset information, the verification is considered successful. Alternatively, if it is determined that the first asset information is not correctly stored in the first memory, or the second asset information is not correctly stored, the verification is considered unsuccessful.
[0096] In step 1, when the first manager determines that the first hash value is equal to the second hash value, it can be determined that the first memory correctly stores the first asset information. When it determines that the first hash value is not equal to the second hash value, it can be determined that the first memory has not correctly stored the first asset information.
[0097] In step 2, the first manager can determine whether the first memory correctly stores the second asset information in a similar manner to the specific operation of the second manager in step S202 to determine whether the first memory correctly stores the first asset information. This will not be elaborated here.
[0098] In step 3, when it is determined that the first memory correctly stores the second asset information, the first manager can determine the verification success as the verification result. When it is determined that the first memory does not correctly store the first asset information, or does not correctly store the second asset information, the first manager can determine the verification failure as the verification result of the current round.
[0099] Step S307: When it is determined that the valid bit information needs to be updated based on the verification result corresponding to the current round, a preset update operation is performed on the valid bit information.
[0100] Specifically, when the first manager can determine that the verification result corresponding to the current round is successful, it can perform a preset update operation on the valid bit information. For example, when the valid bit information is a numerical value, the valid bit information is decremented by one.
[0101] Step S308: When it is determined that the sequence value of the current round is equal to the preset sequence value, or when the valid bit information changes from the third preset information to the first preset information after one or more preset update operations, the verification operation is stopped and the final verification result is determined.
[0102] Specifically, when the current round's sequence value is determined to be less than a preset sequence value, and the valid bit information has not yet changed to the first preset information, it indicates that the verification count has not reached the threshold, and the verification operation has not been successful; the next round of verification operation can proceed. When the current round's sequence value is determined to be equal to the preset sequence value, it indicates that the number of verification operations has reached the preset verification count threshold, and the verification operation can be stopped. Alternatively, when it is determined that the valid bit information has changed from the third preset information to the first preset information after one or more preset update operations, it indicates that the problem in the first memory or the link between the first memory and the first manager is a repairable problem; in this case, the first manager does not need to perform any further verification operations, thus saving resources.
[0103] After the verification operation is stopped, if the valid bit information still does not match the first preset information (e.g., the value of the valid bit information is still greater than the value indicated by the first preset information), it indicates that there is an irreparable problem with the first memory or the link between the first memory and the first manager, and verification failure can be determined as the final verification result. In addition, the first manager can also report alarm information to the target device so that technicians can replace the first memory in a timely manner. If the valid bit information matches the first preset information (e.g., the value of the valid bit information is still equal to the value indicated by the first preset information), verification success can be determined as the final verification result.
[0104] In some optional implementations, after the verification operation is completed, the first manager can update the repair bit information in the first memory to obtain the updated repair bit information. When the repair bit information is detected to match the preset repair information, an alarm is reported to the target device. For example, the repair bit information can be a numerical value, which is incremented by one for each successful repair. When the value equals a preset repair count threshold (which could be 3), a serious problem is considered to have occurred in the first memory, and an alarm can be reported to the target device.
[0105] The memory verification method of this application automatically performs verification operations when a problem is determined to exist in the first memory or the link between the first memory and the first manager, eliminating the need for manual verification, thus improving repair efficiency and saving labor costs. During the repair process, multiple verification operations are performed, and the problem is only considered repairable after multiple successful verifications, resulting in higher reliability. Furthermore, during the verification process, no other data is required; instead, the first asset information and the second asset information are written into the first memory. This eliminates the need for rewriting after successful verification, further increasing efficiency and reducing the number of erase / write cycles to the first memory, thereby extending its lifespan and reducing the probability of problems.
[0106] The following example will be used to explain in detail the execution process of the above asset information acquisition method.
[0107] First, the first manager and the second manager can be connected via, for example... Figure 4The illustrated processes work together to complete the interactive operation of asset information. After the server powers on, the first manager starts up, acquires the first asset information, writes it into the first memory, and sets the completion bit in the first memory to 1. After the server powers on, the second manager starts up, acquires the second asset information, writes it into the second memory, and sets the completion bit in the second memory to 1. The second manager determines whether the completion bit in the first memory is 1. If not, it can directly set the valid bit in the first memory to 0. If yes, it reads the first asset information from the first memory and verifies its accuracy against the second asset information. If accurate, it writes the second asset information into the first memory and sets the valid bit in the first memory to 1. It also sends a write completion notification to the first manager via GPIO. Upon receiving the write completion notification, the first manager can read the valid bit from the first memory. When it determines that the valid bit is 1, it can directly read the second asset information from the first memory. Alternatively, when the valid bit information is determined to be 0, the completion bit information can be read from the second memory and it can be determined whether this completion bit information is 1. If it is 1, the first manager can read the second asset information from the second memory; if it is 0, an alarm can be reported to the target device.
[0108] Then, in order to reduce the number of erase cycles on the first memory, the first manager can, as follows: Figure 5 The process shown determines whether reading and writing to the first memory is necessary. After startup, the first manager can first determine whether it stores a hash value H1 (e.g., the first hash value mentioned above). If not, it can perform a hash calculation on the newly acquired first asset information to obtain H1_New (as the first hash value after the next startup). If yes, it can perform a hash calculation on the newly acquired first asset information to obtain H1_New (e.g., the second hash value mentioned above). Furthermore, the first manager can determine whether H1 and H1_New are equal. If they are equal, there is no need to write the newly acquired first asset information to the first memory, i.e., no operation on the first memory, reducing the number of erase operations on the first memory. If they are not equal, it indicates that the asset information has changed. The first manager can write the newly acquired first asset information to the first memory, update H1 in its own memory to H1_New, and use it as the first hash value for comparison after the next startup.
[0109] Finally, the first manager can be configured as follows: Figure 6The verification operation is performed as shown. When the first manager is idle, it can clear the first asset information in the first memory and rewrite the first and second asset information into the first memory. Additionally, the first manager can set the valid bit information in the first memory to 4. Further, the first manager can reread the first and second asset information from the first memory, perform a hash calculation on the reread first asset information to obtain a second hash value, and compare the second hash value with the first hash value to determine if they match. If they do not match, the valid bit information is not modified. If they match, the second asset information is verified using the first asset information. If the verification of the second asset information is inaccurate, the valid bit information is not modified; if the verification of the second asset information is accurate, the valid bit information is decremented by 1. The first manager can determine whether the valid bit information is equal to 1 and whether the number of verifications is equal to a preset verification threshold. When the valid bit information is determined to be equal to 1 and the number of verifications is less than the preset verification threshold, the verification success can be determined as the final verification result, eliminating the need for subsequent verifications and saving resources. Alternatively, when the valid bit information is determined to be 1 and the number of verifications equals the preset verification threshold, the verification success can be defined as the final verification result. Alternatively, if the valid bit information is determined to be greater than 1 and the number of verifications equals the preset verification threshold, but verification is still unsuccessful and the problem with the first memory cannot be repaired, the verification operation can be stopped. If the valid bit information is determined to be greater than 1 and the number of verifications is still less than the preset verification threshold, the next verification operation can be initiated until the verification termination condition is met (i.e., the valid bit information is equal to 1 or the number of verifications equals the preset verification threshold). After determining the final verification result, the repair bit information in the first memory can be incremented by 1. When the repair bit information is detected to be equal to 3, an alarm can be reported to the target device. If the repair bit information does not reach 3, the first memory can still be used normally.
[0110] like Figure 7 As shown, both the first memory and the second memory described above can be configured as follows: Figure 7 The asset information and status bit information are stored in the manner shown. The status bit information may include the completion bit information, validity bit information, and repair bit information mentioned above.
[0111] Taking the first memory as an example, the first memory can be configured with a completion bit (for storing completion bit information), a validity bit (for storing validity bit information), a repair bit (for storing repair bit information), a basic storage bit corresponding to the first manager, and multiple incremental storage bits, as well as a basic storage bit corresponding to the second manager and multiple incremental storage bits. The basic storage bit is used for initial version information, as well as the identification and configuration information of configuration items under the initial version. The incremental storage bits are used to store updated version information, as well as the identification and configuration information of newly added configuration items under the updated version. For example, if a network card temperature configuration item is added in version 0.0.2, the storage location corresponding to this configuration item in the incremental storage bit of version 0.0.2 can be used to store the network card temperature value.
[0112] Accordingly, the first manager can determine the identifier information of the configuration items that need to be read based on the target version information. For example, if the initial version is 0.0.1 and the target version information indicates version 0.0.2, the first manager can obtain the configuration information of all configuration items under the base storage bits of version 0.0.1 and the incremental storage bits of version 0.0.2 as the first asset information. If the target version information indicates version 0.0.1, the first manager can only obtain the configuration information of all configuration items under the base storage bits of version 0.0.1. In this way, the first manager can flexibly adjust the method of obtaining asset information according to the actual situation, and can save storage resources of the first memory. In addition, detailed division of the memory area can ensure that data interaction between different versions will not conflict, further reducing the coupling between the first manager and the second manager.
[0113] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0114] Embodiments of this application also provide an asset information acquisition device, such as... Figure 8 As shown, it includes:
[0115] Module 810 is used to acquire first asset information;
[0116] The write module 820 is used to write the first asset information into the first memory. The second manager writes the second asset information it has acquired into the second memory. Based on the first asset information and the second asset information read from the first memory, it determines whether to write the second asset information into the first memory, sets the valid bit information in the first memory, and writes the second asset information into the first memory when it is determined that the second asset information should be written into the first memory.
[0117] The read module 830 is used to read valid bit information from the first memory when it receives a write completion notification sent by the second manager;
[0118] The determination module 840 is used to determine the target memory in the first memory and the second memory based on the valid bit information;
[0119] The reading module 830 is also used to read second asset information from the target memory;
[0120] The generation module 850 is used to generate total asset information based on the second asset information and the first asset information.
[0121] In some alternative implementations, the determining module 840 is specifically used for:
[0122] When the valid bit information is determined to be the first preset information, the first memory is determined as the target memory;
[0123] or,
[0124] When the valid bit information is determined to be the second preset information, the first memory is determined as the target memory.
[0125] In some alternative implementations, the device further includes a verification module 860 for:
[0126] When the valid bit information is determined to be the second preset information and the first manager is in the preset working state, the first asset information stored in the first memory is erased;
[0127] The first asset information is rewritten into the first memory, and the second asset information is written into the first memory;
[0128] Set the valid bit information in the first memory to the third preset information;
[0129] Get the first hash value;
[0130] In the current round of verification operations, the first asset information is read again from the first memory, and the second asset information is read again from the first memory;
[0131] Based on the first hash value, the first asset information reread from the first memory, and the second asset information read from the first memory, determine the verification result corresponding to the current round;
[0132] When it is determined that the valid bit information needs to be updated based on the verification result corresponding to the current round, a preset update operation is performed on the valid bit information;
[0133] When the current round's sequence value is determined to be equal to the preset sequence value, or when the valid bit information changes from the third preset information to the first preset information after one or more preset update operations, the verification operation stops and the final verification result is determined.
[0134] In some alternative implementations, the verification module 860 is specifically used for:
[0135] A hash calculation is performed on the first asset information reread from the first memory to obtain a second hash value;
[0136] The verification result is determined based on the first hash value, the second hash value, and the second asset information read from the first memory.
[0137] In some alternative implementations, the determining module 840 is specifically used for:
[0138] Based on the first hash value and the second hash value, determine whether the first storage device correctly stores the first asset information;
[0139] When it is determined that the first memory correctly stores the first asset information, it is determined whether the first memory correctly stores the second asset information based on the first asset information reread from the first memory and the second asset information read from the first memory.
[0140] When it is confirmed that the first memory correctly stores the second asset information, the verification success will be determined as the verification result;
[0141] or,
[0142] When it is determined that the first asset information is not stored correctly in the first memory, or the second asset information is not stored correctly, the verification failure is determined as the verification result.
[0143] In some optional implementations, the acquisition module 810 is specifically used for:
[0144] Obtain target version information;
[0145] Based on the target version information, read the identification information of at least one configuration item that matches both the first manager and the target version information from the first storage;
[0146] Based on the identifier information of each configuration item, the configuration information corresponding to each configuration item is obtained. The configuration information corresponding to all configuration items constitutes the first asset information.
[0147] In some alternative implementations, the write module 820 is specifically used for:
[0148] Based on the identification information and target version information of the target configuration item, the configuration information corresponding to the target configuration information is written into the first memory, wherein the target configuration item is any one of at least one configuration item;
[0149] When the write operation of the configuration information corresponding to all configuration items in at least one configuration item is completed, it is determined that the first asset information will be written to the first memory.
[0150] For a description of the features in the embodiment corresponding to the asset information acquisition device, please refer to the relevant description in the embodiment corresponding to the asset information acquisition method, which will not be repeated here.
[0151] Embodiments of this application also provide an electronic device, such as... Figure 9 As shown, the device includes a memory 10 and a processor 20. The memory 10 stores a computer program, and the processor 20 is configured to run the computer program to perform the steps in any of the above-described asset information acquisition method embodiments. The electronic device may be the first manager described above.
[0152] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described asset information acquisition method embodiments when it is run.
[0153] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0154] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described asset information acquisition method embodiments.
[0155] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described asset information acquisition method embodiments.
[0156] Those skilled in the art will further 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 implementation should not be considered beyond the scope of this application.
[0157] The foregoing has provided a detailed description of the asset information acquisition method, apparatus, electronic device, storage medium, and program product provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. A method for obtaining asset information, characterized in that, The method is applied to an asset information interaction system, which includes a first manager, a second manager, a first memory, and a second memory. The method is executed by the first manager and includes: Obtain primary asset information; The first asset information is written into the first memory, wherein the second manager writes the second asset information it has acquired into the second memory, determines whether to write the second asset information into the first memory based on the first asset information and the second asset information read from the first memory, sets the valid bit information in the first memory, and writes the second asset information into the first memory when it is determined that the second asset information should be written into the first memory. When a write completion notification is received from the second manager, the valid bit information is read from the first memory; Based on the valid bit information, the target memory is determined in the first memory and the second memory; Read the second asset information from the target memory; Based on the second asset information and the first asset information, generate total asset information.
2. The asset information acquisition method according to claim 1, characterized in that, The step of determining the target memory in the first memory and the second memory based on the valid bit information includes: When the valid bit information is determined to be the first preset information, the first memory is determined to be the target memory; or, When the valid bit information is determined to be the second preset information, the first memory is determined to be the target memory.
3. The asset information acquisition method according to claim 2, characterized in that, When the valid bit information is determined to be the second preset information, and the first manager is in a preset working state, the method further includes: Erase the first asset information stored in the first memory; The first asset information is rewritten into the first memory, and the second asset information is written into the first memory; Set the valid bit information in the first memory to the third preset information; Get the first hash value; In the current round of verification operations, the first asset information is read again from the first memory, and the second asset information is read again from the first memory; Based on the first hash value, the first asset information reread from the first memory, and the second asset information read from the first memory, determine the verification result corresponding to the current round; When it is determined that the valid bit information needs to be updated based on the verification result corresponding to the current round, a preset update operation is performed on the valid bit information; When it is determined that the order value of the current round is equal to the preset order value, or when the valid bit information changes from the third preset information to the first preset information after one or more preset update operations, the verification operation is stopped and the final verification result is determined.
4. The asset information acquisition method according to claim 3, characterized in that, The step of determining the verification result corresponding to the current round based on the first hash value, the first asset information reread from the first memory, and the second asset information read from the first memory includes: A hash calculation is performed on the first asset information reread from the first memory to obtain a second hash value; The verification result is determined based on the first hash value, the second hash value, and the second asset information read from the first memory.
5. The asset information acquisition method according to claim 4, characterized in that, Determining the verification result based on the first hash value, the second hash value, and the second asset information read from the first memory includes: Based on the first hash value and the second hash value, determine whether the first memory correctly stores the first asset information; When it is determined that the first memory correctly stores the first asset information, it is determined whether the first memory correctly stores the second asset information based on the first asset information reread from the first memory and the second asset information read from the first memory; When it is determined that the first memory correctly stores the second asset information, the verification success will be determined as the verification result; or, When it is determined that the first asset information is not stored correctly in the first memory, or the second asset information is not stored correctly, the verification failure is determined as the verification result.
6. The asset information acquisition method according to any one of claims 1 to 5, characterized in that, The acquisition of the first asset information includes: Obtain target version information; Based on the target version information, read the identification information of at least one configuration item that matches both the first manager and the target version information from the first memory; Based on the identification information of each configuration item, configuration information corresponding to each configuration item is obtained, wherein the configuration information corresponding to all configuration items constitutes the first asset information.
7. The asset information acquisition method according to claim 6, characterized in that, The step of writing the first asset information into the first memory includes: Based on the identification information of the target configuration item and the target version information, the configuration information corresponding to the target configuration information is written into the first memory, wherein the target configuration item is any one of at least one of the configuration items; When the write operation of the configuration information corresponding to all configuration items in at least one of the configuration items is completed, it is determined that the first asset information is written to the first memory.
8. An asset information acquisition device, characterized in that, The device is applied to an asset information interaction system, which includes a first manager, a second manager, a first memory, and a second memory. The device includes: The acquisition module is used to acquire the first asset information; The write module is used to write the first asset information into the first memory. The second manager writes the second asset information it has acquired into the second memory. Based on the first asset information and the second asset information read from the first memory, it determines whether to write the second asset information into the first memory, sets the valid bit information in the first memory, and writes the second asset information into the first memory when it is determined that the second asset information should be written into the first memory. The read module is used to read the valid bit information from the first memory when it receives a write completion notification sent by the second manager; The determining module is used to determine the target memory in the first memory and the second memory based on the valid bit information; The reading module is also used to read the second asset information from the target memory; The generation module is used to generate total asset information based on the second asset information and the first asset information.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the asset information acquisition method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the asset information acquisition method as described in any one of claims 1 to 7.