A server asset reporting method and device
By dynamically adjusting the shared memory layout and filtering virtual device asset information, the problem of insufficient server asset information storage space was solved, ensuring the complete reporting of asset information and the efficient operation of the management system.
Patent Information
- Application Number
- CN202511539947.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2045-10-27
AI Technical Summary
The reported server asset information could not be fully stored due to insufficient storage space, which affected the subsequent data acquisition and utilization by the management system.
By determining the storage space requirements of the asset information to be reported, the system dynamically adjusts the free space of other functional partitions in the shared memory to the asset information partition to expand the capacity. When the capacity is insufficient, the system filters virtual device asset information to ensure complete storage.
It enables reliable reporting of asset information under different storage capacity scenarios, provides a comprehensive and accurate data foundation, and improves the management efficiency and accuracy of the server management system.
Smart Images

Figure CN121029257B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, and in particular to a method and apparatus for reporting server assets. Background Technology
[0002] In the field of server management and maintenance, accurate reporting of asset information is a crucial foundation for achieving intelligent server management, fault diagnosis, and resource scheduling.
[0003] Currently, server asset information reporting is typically performed within a fixed shared memory layout. The basic input / output system and the baseboard management controller pre-allocate shared memory partitions, with the asset information partition having a fixed preset capacity for storing various types of device asset information.
[0004] However, the storage space required for the asset information collected by the server may exceed the preset capacity of the asset information partition, resulting in the asset information not being stored completely. This, in turn, affects the subsequent reading and utilization of the asset information by the baseboard management controller, making it impossible for the server management system to obtain comprehensive and accurate asset data.
[0005] Therefore, improving the reliability of asset information reporting has become an urgent problem to be solved. Summary of the Invention
[0006] This application provides a server asset reporting method and apparatus to at least solve the problem of instability in asset information reporting in related technologies.
[0007] This application provides a method for reporting server assets, including:
[0008] Obtain the asset information to be reported from the server and determine whether the required storage space for the asset information to be reported exceeds the preset capacity of the asset information partition in the shared memory.
[0009] If so, the free space of other functional partitions in the shared memory will be adjusted to the asset information partition to expand the preset capacity and generate the target asset information partition;
[0010] Determine whether the capacity of the target asset information partition meets the required storage space for the asset information to be reported;
[0011] If so, the asset information to be reported is written to the target asset information partition;
[0012] If not, and the asset information to be reported includes virtual asset information corresponding to virtual devices, then the virtual device asset information is filtered based on the attribute information of the virtual devices to obtain the target asset information to be reported, and the target asset information to be reported is written to the target asset information partition.
[0013] This application also provides a server asset reporting device, including:
[0014] The acquisition unit is used to acquire the asset information to be reported from the server and determine whether the required storage space of the asset information to be reported exceeds the preset capacity of the asset information partition in the shared memory.
[0015] The adjustment unit is used to adjust the free space of other functional partitions in the shared memory to the asset information partition when the required storage space of the asset information to be reported exceeds the preset capacity of the asset information partition in the shared memory, so as to expand the preset capacity to generate the target asset information partition.
[0016] The judgment unit is used to determine whether the capacity of the target asset information partition meets the required storage space of the asset information to be reported;
[0017] The writing unit is used to write the asset information to be reported to the target asset information partition when the capacity of the target asset information partition meets the required storage space of the asset information to be reported.
[0018] The filtering unit is used to filter the virtual device asset information based on the attribute information of the virtual device when the capacity of the target asset information partition does not meet the required storage space of the asset information to be reported, and the asset information to be reported includes virtual asset information corresponding to the virtual device, so as to obtain the target asset information to be reported and write the target asset information to be reported into the target asset information partition.
[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 server asset reporting 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 server asset reporting 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 server asset reporting methods.
[0022] This application determines the relationship between the storage space required for the asset information to be reported and the preset capacity of the asset information partition in the shared memory. When the preset capacity is exceeded, the free space of other functional partitions in the shared memory is flexibly adjusted to the asset information partition to expand the capacity and generate the target asset information partition. This breaks the limitations of the traditional fixed shared memory layout and adaptively adjusts the storage area according to the actual scale of asset information, effectively avoiding the problem that the asset information cannot be completely stored due to excessive amount of information, and ensuring the integrity of the asset information storage.
[0023] At the same time, after adjustment, the system will re-evaluate whether the capacity of the target asset information partition meets the requirements. If it does, the asset information to be reported will be directly reported. If it still does not meet the requirements, the asset information of the virtual device will be extracted from the asset information to be reported, and the target asset information will be generated and reported. This will ensure that asset information can be reliably reported to the target asset information partition under different storage capacity scenarios to the greatest extent possible. This will provide a comprehensive and accurate data foundation for the subsequent reading and utilization of asset information by the baseboard management controller, thereby improving the efficiency and accuracy of the server management system in managing assets. Attached Figure Description
[0024] 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.
[0025] Figure 1 This is one of the flowcharts illustrating a server asset reporting method provided in this application embodiment;
[0026] Figure 2 A second schematic flowchart illustrating a server asset reporting method provided in this application embodiment;
[0027] Figure 3 This is a schematic diagram of a server asset reporting device provided in an embodiment of this application. Detailed Implementation
[0028] 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.
[0029] 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.
[0030] 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.
[0031] This application provides a server asset reporting method, the execution entity of which is the server's Basic Input / Output System (BIOS). The method is described in detail below, along with its execution flow. (Refer to...) Figure 1 As shown, the specific steps provided for this application include the following:
[0032] S11. Obtain the asset information to be reported from the server and determine whether the required storage space for the asset information to be reported exceeds the preset capacity of the asset information partition in the shared memory.
[0033] Specifically, the server's asset information to be reported is a comprehensive collection of data describing the characteristics, configuration, and status of server equipment, divided into hardware equipment asset information and virtual device asset information. Hardware equipment asset information covers the basic attributes of the server's physical components (such as CPU model, memory manufacturer, and hard drive serial number), performance parameters (such as the number of CPU cores, memory capacity, and hard drive read / write speed), and real-time operating status (such as device temperature, voltage, and load rate). Virtual device asset information is generated when virtual devices are configured on the current server, and includes virtual component data generated by virtualization technology, such as the MAC address of the virtual network card, the capacity configuration of the virtual hard drive, and the association identifier between the virtual device and the physical device.
[0034] In some embodiments, asset information can clearly present the distribution and status of hardware and software resources, facilitating dynamic resource allocation (such as migrating high-load services) and improving cluster utilization. It also enables rapid fault location through operational parameters (such as troubleshooting CPU overheating and its association with cooling equipment), and allows for equipment lifecycle planning based on usage duration and other data, reducing maintenance costs. Furthermore, it provides a basis for assessing resource carrying capacity for business expansion (such as verifying server performance before adding new applications), while meeting compliance audit requirements in industries such as finance and healthcare, and mitigating regulatory risks.
[0035] In this step, the first step is to obtain the asset information to be reported from the server. After obtaining the asset information, the required storage space (i.e., the number of bytes of memory needed to store the full amount of information) needs to be calculated, and this storage space is compared with the preset capacity of the asset information partition in shared memory. Shared memory is a memory area pre-determined by the BIOS and BMC for information exchange between them; the asset information partition is a sub-area within shared memory specifically used to store asset information, and its preset capacity is a fixed value configured in advance.
[0036] Furthermore, by comparing storage requirements with preset capacity, it can be determined whether the current asset information partition is sufficient to accommodate the asset information to be reported, providing a basis for decision-making on whether to adjust the memory layout in the future.
[0037] Specifically, before obtaining the asset information to be reported from the server and determining whether the required storage space for the asset information exceeds the preset capacity of the asset information partition in shared memory, it is necessary to calculate the required storage space for the asset information to be reported. The specific method can be referred to in steps 1 and 2 below:
[0038] Step 1: Traverse all hardware and virtual devices corresponding to the server and collect asset information corresponding to the hardware and virtual devices to generate asset information to be reported.
[0039] Specifically, when traversing all hardware and virtual devices corresponding to the server, it is necessary to cover all hardware devices (such as CPU, memory, physical network card, hard drive, etc.) and virtual devices (such as virtual network card, virtual hard disk, virtual optical drive, etc.) to ensure that no critical devices are missed. For hardware devices, it is necessary to collect core information such as device model, manufacturer, unique identifier (such as CPUID of CPU, hard disk serial number), performance parameters (such as memory capacity, CPU frequency), and operating status (such as device temperature, load rate). For virtual devices, it is necessary to collect information such as device type, virtual identifier (such as virtual bus address), associated physical device ID, and configuration parameters (such as virtual hard disk capacity, virtual network card MAC address).
[0040] Then, all the collected information is integrated according to a preset format (such as a structured data dictionary or a fixed-field information table) to form a unified set of asset information to be reported, providing a complete data foundation for subsequent storage space calculations.
[0041] Step 2: Obtain the required storage space corresponding to the asset information to be reported.
[0042] Specifically, in this application embodiment, the detailed steps for obtaining the required storage space corresponding to the asset information to be reported may include the following steps 21 and 22:
[0043] Step 21: Calculate the total number of hardware devices and virtual devices in the asset information to be reported.
[0044] Since the asset information to be reported is structured data, the total storage space can be calculated using the formula "number of bytes stored per device × total number of devices". The "number of bytes stored per device" is a preset fixed value (e.g., based on the number of fields in the asset information and the storage length of each field, setting each hardware / virtual device's information to occupy a fixed 512 bytes or 1KB). This value can be flexibly configured according to the server device type and management needs.
[0045] Step 22: Calculate the required storage space by combining the total number of devices and the preset storage bytes for each device's information.
[0046] Specifically, you can first count the total number of hardware and virtual devices collected in step 21, and then combine the preset storage bytes per device to obtain the required storage space for the asset information to be reported through multiplication (the unit can be uniformly bytes, kilobytes, etc.).
[0047] If some devices have missing asset information fields (such as virtual network cards without a configured MAC address), the storage capacity can be calculated according to the preset default field length to avoid inaccurate calculation results due to incomplete information.
[0048] This application ensures data completeness through step 1, avoiding misjudgments of storage requirements due to information omissions; step 2 ensures calculation accuracy by transforming abstract asset information into specific capacity values through standardized algorithms. The combination of these two steps provides an objective and quantifiable basis for subsequently determining whether the required storage space exceeds the preset capacity of the asset information partition, serving as a crucial preliminary step to ensure the logical rigor of the entire asset reporting process.
[0049] In step S11 above, if the required storage space for the asset information to be reported exceeds the preset capacity of the asset information partition in the shared memory, then step S12 is executed as follows:
[0050] S12. Adjust the free space of other functional partitions in the shared memory to the asset information partition to expand the preset capacity and generate the target asset information partition.
[0051] Specifically, shared memory is a dedicated memory area pre-defined by the BIOS and the Baseboard Management Controller (BMC) for information exchange between the two. In addition to the asset information partition, it also includes other functional partitions, such as: a control instruction partition, used to store interaction instructions between the BIOS and the BMC (such as BMC's request to read asset information, BIOS's response instructions, etc.); and a status identifier partition, used to store auxiliary information such as memory layout status and checksums (such as memory layout update flags, partition address parameters, etc.).
[0052] Furthermore, when the required storage space for the asset information to be reported exceeds the preset capacity of the asset information partition in shared memory, this step uses a dynamic memory layout adjustment mechanism to allocate free space from other functional partitions to the asset information partition. The specific process can be as follows:
[0053] All unused free space in other functional partitions (e.g., non-core free space in the control instruction partition and status identifier partition) can be directly allocated to the asset information partition, thereby expanding the capacity of the asset information partition and generating the target asset information partition. This method is suitable for scenarios where efficiency requirements are higher than granular management.
[0054] It should be noted that in S12, the preferred method can accurately allocate the required space on demand. Specifically, the "gap capacity" (i.e., "required storage space - original preset capacity of asset information partition") required for the asset information to be reported is first calculated, and then free space not less than the gap capacity is allocated from other functional partitions. Based on the storage space required for the asset information to be reported and the preset capacity of the asset information partition determined in S11, the precise amount of space to be expanded is obtained (e.g., if the required space is 15MB and the original capacity is 10MB, then the gap capacity is 5MB).
[0055] Then, free space is selected first from the reserved partition. If the free space in the reserved partition is greater than or equal to the gap capacity, the corresponding size of space is directly allocated to the asset information partition. If the space in the reserved partition is insufficient, it is supplemented from the non-core free segments of the control instruction partition and status identifier partition until the gap capacity is met or all available free space is exhausted.
[0056] By adopting the above-mentioned preferred methods, resource utilization becomes more efficient, and the waste of shared memory caused by indiscriminate occupation of idle space is avoided. This is especially suitable for fine-grained management of memory resources in multi-tasking scenarios.
[0057] Then, the subsequent step S13 is needed to determine whether the adjusted target partition capacity meets the required storage space for the asset information to be reported. If it does, S14 is executed to report directly; otherwise, the process proceeds to the S15 screening process.
[0058] S13. Determine whether the capacity of the target asset information partition meets the required storage space for the asset information to be reported.
[0059] Furthermore, by assessing the compatibility between the adjusted target asset information partition capacity and the storage space required for the asset information to be reported, a decision-making basis is provided for subsequent asset information reporting strategies.
[0060] Specifically, the capacity of the target asset information partition is the total capacity of the asset information partition (in bytes, KB, or MB, etc.) generated after space adjustment. Its value is "the original asset information partition preset capacity + the amount of free space allocated from other functional partitions", which can be obtained directly by reading the partition configuration record of shared memory. The required storage space for the asset information to be reported is the full asset information storage requirement (i.e., the total number of storage bytes of hardware and virtual device asset information) calculated in step S11, which is the benchmark value for judgment.
[0061] Then, the capacity of the target asset information partition is compared with the required storage space of the asset information to be reported. Specifically, there are two results: one is that the target partition capacity is greater than or equal to the required storage space, which means that the space adjustment in step S12 is sufficient to accommodate all the asset information to be reported. No further processing is required, and the process can proceed directly to step S14 to write all the information into the target asset information partition to complete the reporting.
[0062] Another scenario is that the target partition capacity is less than the required storage space. This indicates that even after space adjustment, the capacity of the target asset information partition is still insufficient to store all the information. In this case, step S15 is required to reduce the total storage requirement by filtering virtual device asset information, so that the adjusted target asset information can be adapted to the partition capacity.
[0063] In step S13 above, if the capacity of the target asset information partition meets the required storage space for the asset information to be reported, then S13 is executed as follows; if the capacity of the target asset information partition does not meet the required storage space for the asset information to be reported, and the asset information to be reported includes virtual asset information corresponding to virtual devices, then S14 is executed as follows:
[0064] S14. Write the asset information to be reported to the target asset information partition.
[0065] Furthermore, when the capacity of the target asset information partition meets the required storage space for the asset information to be reported, the full amount of information is continuously written to the designated address segment of the target asset information partition (starting from the partition's starting address and continuing until the length matching the required storage space) according to the data format pre-agreed between the BIOS and BMC (such as structured data frames, including device type identifiers, field lengths, and specific parameter values). During the writing process, data verification information (such as checksums and data length identifiers) is recorded synchronously for subsequent BMC reading to verify data integrity.
[0066] This step ensures that BMC can obtain comprehensive asset data of the server by writing all asset information in scenarios with sufficient storage space. This provides a complete basis for resource scheduling, fault diagnosis, lifecycle management, etc., and avoids management decision deviations due to missing information.
[0067] S15. Filter the virtual device asset information based on the attribute information of the virtual device to obtain the target asset information to be reported, and write the target asset information to be reported into the target asset information partition.
[0068] Therefore, when the capacity of the target asset information partition is insufficient to meet the required storage space for the asset information to be reported, it is necessary to further filter the original asset information to be reported in order to reduce the space occupied by the asset information to be reported.
[0069] Specifically, the screening targets are virtual device asset information in the asset information to be reported (hardware device asset information is usually fully retained because it is directly related to physical resources, in order to ensure the accuracy of physical layer management).
[0070] Based on the attribute information of virtual devices (such as device type, physical address, functional priority, etc.), for example, only virtual devices related to core business (such as virtual network cards that carry critical applications) can be retained, while virtual devices with invalid physical addresses or that are not actually used (such as virtual hard disks left over from testing) can be removed.
[0071] Furthermore, based on the attributes of virtual devices, the virtual device asset information is filtered to obtain simplified target virtual device asset information. Then, the target virtual device asset information is integrated with the complete hardware device asset information in a unified format to generate target asset information to be reported (its total storage space needs to be adapted to the capacity of the target asset information partition); so that the target asset information to be reported can be written into the target asset information partition.
[0072] Therefore, in scenarios with limited storage space, this application, by retaining core asset information, ensures the integrity of hardware asset information and the validity of key virtual asset information while sacrificing some non-critical virtual device information. This avoids reporting failures due to insufficient capacity and provides BMC with the core data required for server management, thus balancing information integrity and storage feasibility.
[0073] It should be noted that the asset information in the asset information partition or the target asset information partition is stored in the form of a descriptor table.
[0074] Each device corresponds to a descriptor entry; the descriptor entry includes at least the device type, manufacturer information, device identifier, and memory-mapped input / output address information.
[0075] Specifically, asset information within an asset information partition or target asset information partition is stored in a structured manner using a descriptor table. This method achieves orderly management of device asset information through uniformly formatted entries, facilitating rapid parsing during BIOS writing and BMC reading. Specifically, the descriptor table is a contiguous memory area composed of multiple descriptor entries arranged sequentially, each uniquely corresponding to a device (including hardware and virtual devices). The beginning of the table stores information such as the table header, total number of entries, individual entry length, and table checksum, used by the BMC to quickly locate and verify the integrity of the entire table. Subsequent entries are the descriptor entries corresponding to each device, with no redundant gaps between entries, maximizing storage space utilization.
[0076] Furthermore, each descriptor entry is a fixed-length structured data (such as 256 bytes or 512 bytes, which can be preset according to the complexity of the device information) and contains at least the following core fields to ensure the uniqueness and traceability of the device information.
[0077] The device type is used to identify the physical and virtual attributes and specific categories of the device, such as "physical CPU", "physical hard disk", "virtual network card", "virtual hard disk", etc. It can be quickly identified by preset enumeration values (such as 0x01 representing physical CPU and 0x0A representing virtual network card).
[0078] Manufacturer information records the equipment manufacturer or virtualization platform provider, stored in the form of strings or manufacturer codes, for the purpose of tracing the origin of the equipment.
[0079] Device identifiers are unique identifiers for devices, such as the serial number (SN) of hardware devices, the CPUID of CPUs, the UUID (Universally Unique Identifier) of virtual devices, or the virtual bus address, ensuring that each device can be uniquely distinguished throughout the server's lifecycle.
[0080] Memory-mapped input / output address (MMIO address) refers to the register address in the memory-mapped address space for hardware devices (used for direct interaction between the BIOS and the hardware); for virtual devices, it refers to the virtual address mapped in the virtualization layer (associated with the MMIO address of the underlying physical device), used to locate the device's operation interface.
[0081] In some embodiments, descriptor entries may additionally include extended fields, such as device status (running / idle / faulty), performance parameters (such as hard disk capacity, network card speed), and associated device identifier (the physical device ID associated with the virtual device), to further enrich the dimensions of asset information, depending on actual management needs.
[0082] This application improves information exchange efficiency by eliminating the need for complex data format conversions during BIOS writing and BMC reading through a unified entry format. At the same time, by using the total number of entries and entry length in the table header, the BMC can directly calculate the entry position of a certain type of device (such as traversing all "virtual network card" type entries), shortening information query time. Furthermore, by combining table checksums and entry self-checking mechanisms, it can quickly detect whether information has been tampered with or damaged, ensuring data reliability.
[0083] This application determines the relationship between the storage space required for the asset information to be reported and the preset capacity of the asset information partition in the shared memory. When the preset capacity is exceeded, the free space of other functional partitions in the shared memory is flexibly adjusted to the asset information partition to expand the capacity and generate the target asset information partition. This breaks the limitations of the traditional fixed shared memory layout and adaptively adjusts the storage area according to the actual scale of asset information, effectively avoiding the problem that the asset information cannot be completely stored due to excessive amount of information, and ensuring the integrity of the asset information storage.
[0084] At the same time, after adjustment, the system will re-evaluate whether the capacity of the target asset information partition meets the requirements. If it does, the asset information to be reported will be directly reported. If it still does not meet the requirements, the asset information of the virtual device will be extracted from the asset information to be reported, and the target asset information will be generated and reported. This will ensure that asset information can be reliably reported to the target asset information partition under different storage capacity scenarios to the greatest extent possible. This will provide a comprehensive and accurate data foundation for the subsequent reading and utilization of asset information by the baseboard management controller, thereby improving the efficiency and accuracy of the server management system in managing assets.
[0085] As an extension and refinement of the above embodiments, refer to Figure 2 As shown, the server asset reporting method provided in this application further includes the following steps:
[0086] S21. Extract asset information corresponding to multiple virtual devices from the asset information to be reported, and generate virtual device asset information.
[0087] This step is a preliminary operation for independently processing virtual device asset information. Its core is to separate the relevant data of virtual devices from the full amount of asset information to be reported, so as to provide clear objects for subsequent screening.
[0088] Specifically, it is necessary to iterate through all entries marked as virtual devices in the asset information to be reported, exclude asset information of hardware devices, and ensure that the extracted objects are only device data generated in the virtualization environment.
[0089] All extracted virtual device asset information is aggregated according to a unified data structure (such as a list or dictionary) to form an independent virtual device asset information set. This set completely contains the original data of all virtual devices, providing a comprehensive data source for subsequent S22 filtering.
[0090] S22. Filter the virtual device asset information according to the virtual device attributes to obtain the target virtual device asset information.
[0091] The virtual device attributes include the virtual device type and physical address.
[0092] This step involves fine-tuning the selection process by using core attributes such as the type and physical address of virtual devices to eliminate redundant or low-value data, retaining only virtual device information that is meaningful for server management.
[0093] Specifically, different types of virtual devices play significantly different roles in server operation (e.g., virtual network cards directly affect network communication, while virtual optical drives are mostly temporary tools), and retention rules can be determined based on business priorities; since virtual devices rely on underlying physical resources to operate, the validity of the physical address (whether it points to a real physical device interface) is the key information for determining whether it is a valid and in-use device (virtual devices with invalid physical addresses are mostly redundant configurations or test remnants).
[0094] Furthermore, filtering can be performed based on the type of virtual device to prioritize retaining types that core business relies on (such as virtual network cards and virtual hard disks), while directly eliminating non-core types (such as virtual optical drives and virtual printers). Filtering can also be performed based on physical address, retaining only virtual devices with valid physical addresses (such as virtual network cards whose physical addresses correspond to the high-speed peripheral component interconnect express (PCIe) ports of real physical network cards), and eliminating virtual device information with empty, invalid, or offline physical addresses.
[0095] After filtering, the target virtual device asset information is obtained. Its data volume is smaller than that of the original virtual device asset information, but only redundant or invalid data is removed. The core virtual device information related to server operation and management is retained, laying the foundation for subsequent integration to generate target asset information to be reported.
[0096] This application's embodiments achieve independent management of virtual device information through precise extraction, avoiding filtering interference caused by mixing with hardware device information. Furthermore, the filtering logic based on type and physical address ensures both the targeting of the filtering (focusing on key attributes) and the effectiveness of the results (preserving core virtual assets). This allows for efficient reduction of the data volume of virtual device asset information when storage space is limited, while preventing the loss of critical information, providing high-quality virtual device data support for the generation of target asset information to be reported.
[0097] In this embodiment of the application, the above-mentioned S22 (filtering virtual device asset information according to virtual device attributes to obtain target virtual device asset information) can be further refined into the following steps A and B:
[0098] Step A: Obtain the type of each virtual device, and divide the virtual devices into sets of sub-virtual devices corresponding to each type based on their types.
[0099] This step is a fundamental operation for classifying and managing virtual device asset information. It achieves refined filtering logic by grouping by type. Specifically, it first obtains the virtual device type by iterating through the type attributes of each device in the virtual device asset information (e.g., reading from the "Device Type" field of the descriptor entry) to determine the specific category of the device. Common virtual device types include: virtual network interface cards (for network communication), virtual hard disks (for data storage), virtual optical drives (for media mounting), and virtual switches (for virtual network forwarding), etc.
[0100] Furthermore, all virtual devices are grouped according to their device type, with each type corresponding to an independent sub-set of virtual devices. For example, all virtual network cards are grouped into the virtual network card subset; all virtual hard disks are grouped into the virtual hard disk subset; other types of devices are grouped in the same way, forming multiple subsets.
[0101] Therefore, after the division, the devices in each subset have the same functional attributes, providing clear targets for subsequent targeted screening.
[0102] Step B: For each sub-virtual device set, filter by virtual device attributes to obtain the sub-target virtual device set corresponding to each sub-virtual device set.
[0103] This step involves differentiated filtering for different types of sub-target virtual device sets, based on their core attributes, to ensure that the most valuable information for management is retained for each type of device.
[0104] Specifically, the filtering for different sets of sub-target virtual devices can be divided into the following three cases:
[0105] (1) If the type of the sub-virtual device set is virtual network interface device, and there is at least one virtual network interface device with a physical address, then extract the virtual network interface devices with physical addresses to form the sub-target virtual device set.
[0106] Specifically, when the type of the sub-virtual device set is a virtual network interface device, and at least one virtual network interface in the set has a valid physical address (i.e., the physical address field is not empty and points to a real physical network interface interface, such as a PCIe address associated with a physical network interface), only all virtual network interface devices with valid physical addresses are retained to form the sub-target virtual device set corresponding to the sub-set.
[0107] This is because the core function of a virtual network interface card (NIC) is to enable network communication, and the physical address is the key identifier that links it to the underlying physical network link (virtual NICs without a valid physical address cannot forward data normally, often due to configuration errors or redundant remnants). Retaining such devices ensures that the BMC can trace the physical port corresponding to the virtual network traffic, providing a crucial mapping relationship for network fault diagnosis (such as packet loss and latency).
[0108] For example, if a virtual network interface card subset contains 5 devices, of which 3 have valid physical addresses (associated with physical network interface cards A, B, and C) and 2 have no physical addresses, then the subtarget virtual device set only contains these 3 valid devices.
[0109] (2) If the type of the sub-virtual device set is virtual network interface device and each virtual network interface device does not have a physical address, then any virtual network interface device is extracted to form a sub-target virtual device set.
[0110] Specifically, when the type of the sub-virtual device set is a virtual network interface device, but the "physical address" attribute of all virtual network interfaces in the set is invalid (such as the physical address field is empty, points to offline physical devices, or has an incorrect format), any device is randomly extracted from all virtual network interfaces without physical addresses. Preferably, the earliest one can be selected according to the creation time to form the sub-target virtual device set corresponding to the sub-set.
[0111] This is because although such virtual network adapters cannot be associated with the physical network, they may still be part of a test environment or temporary configuration. Retaining at least one piece of information that indicates "the existence of a virtual network adapter configuration" prevents the BMC from mistakenly determining that the server has no virtual network component. At the same time, retaining only one minimizes data volume and adapts to storage space limitations.
[0112] For example, if the virtual network interface card subset contains four devices that have no physical addresses, then one of them (such as the one with the earliest creation time) is randomly selected and included in the sub-target set.
[0113] (3) If the type of the sub-virtual device set is other than virtual network card device, then generate the corresponding sub-target virtual device set based on any virtual device in each other type.
[0114] When the type of the sub-virtual device set is other than virtual network card (such as virtual hard disk, virtual optical drive, virtual switch, etc.), then any virtual device can be selected from the sub-set of that type (according to preset priority, such as the device with the highest resource consumption or the most recently used device) to form the corresponding sub-target virtual device set.
[0115] This is because while virtual devices (such as virtual hard drives) that are not virtual network interface cards (NICs) play a role in business operations, their core management relies on hardware device information (such as the underlying physical hard drive), and similar virtual devices have high functional similarity (such as multiple virtual hard drives mapping to the same physical storage). Retaining any one of these devices is sufficient to demonstrate the existence and basic configuration of that type of virtual device, while significantly reducing the amount of data and balancing storage requirements with information availability.
[0116] For example, the virtual hard disk subset contains 8 devices, from which the one with the largest capacity is selected to be included in the sub-target set; the virtual optical drive subset contains 2 devices, from which the one with the most recently mounted media is selected to be included in the sub-target set.
[0117] Step C: Obtain the sub-virtual asset information corresponding to each sub-target virtual device set to form the target virtual device asset information.
[0118] Specifically, this step extracts the complete asset information (i.e., the descriptor entry corresponding to each device) of each sub-target virtual device set (such as the virtual network card sub-target set, the virtual hard disk sub-target set, etc.) generated above to obtain the sub-virtual asset information.
[0119] Then, the sub-virtual asset information corresponding to all sub-target virtual device sets is summarized and combined according to preset rules (such as device type priority sorting or filtering time order) to form unified target virtual device asset information.
[0120] Furthermore, the virtual devices can be grouped and arranged by device type (e.g., virtual network card information is grouped first, followed by virtual hard disk information), which facilitates quick location of a certain type of virtual device during subsequent BMC reading.
[0121] S23. Integrate the target virtual device asset information with the hardware device asset information in the asset information to be reported to generate the target asset information to be reported, and write the target asset information to be reported to the target asset information partition.
[0122] This step integrates the filtered virtual device asset information with the complete hardware device asset information to generate target asset information that meets storage requirements and completes the reporting to the shared memory partition.
[0123] In this embodiment of the application, it is also necessary to switch the memory layout update flag of the shared memory from the initial state to the updated state, and obtain the start address, end address and adjusted total capacity of the target asset information partition, and store them in association with the memory layout update flag.
[0124] The memory layout update flag is used to indicate that the sizes of multiple partitions in the shared memory have changed.
[0125] In this embodiment, after the space adjustment of the target asset information partition and the writing of asset information are completed, the layout identifier and partition parameters of the shared memory need to be updated synchronously to ensure that the BMC can accurately perceive the changes in the memory structure and read the latest asset information. The specific operation is as follows:
[0126] Specifically, during shared memory initialization, the memory layout update flag is set to an unupdated state by default (e.g., represented by the enumeration value 0x00), indicating that the layout parameters such as the size and address range of each partition have not changed. After the space adjustment of the target asset information partition is completed (i.e., the free space of other functional partitions is allocated to the asset information partition), the BIOS switches the flag from the unupdated state to the updated state (e.g., represented by the enumeration value 0x01) to clearly inform the BMC that the partition layout of the shared memory has changed and the partition parameters need to be read again.
[0127] At the same time, after switching the flag state, the key parameters of the target asset information partition also need to be associated with the flag to ensure that the BMC can locate and obtain the latest partition information based on the flag. Specific parameters may include: the starting address of the target asset information partition, that is, the starting physical address of the target asset information partition in shared memory (such as 0x7F000000); and the ending address of the target asset information partition, that is, the ending physical address of the target asset information partition in shared memory (such as 0x7F010000).
[0128] Preferably, it may also include the adjusted total capacity, i.e., the actual size of the target asset information partition.
[0129] These parameters, along with the memory layout update flag, are then stored together in the shared memory status identifier partition (which is specifically used to record memory layout metadata). The parameters and flags are associated with a fixed offset, allowing the BMC to read the complete information at once.
[0130] In this embodiment, the memory layout update flag is used as a communication signal between the BIOS and the BMC. This allows the BMC to detect partition changes in real time by periodically checking the flag status, thus avoiding information errors caused by reading old addresses. At the same time, the partition address and capacity parameters associated with the storage provide the BMC with a precise location basis for the target asset information partition, ensuring that it can correctly access the adjusted asset information storage area and read the filtered target asset information to be reported.
[0131] In this embodiment of the application, after writing the asset information to be reported or the target asset information to be reported to the target asset information partition, the BMC will read the asset information of the server from the target asset information partition when needed. At this time, the memory layout update flag bit is used to instruct the baseboard management controller to obtain the changes in the size of multiple partitions of the memory layout corresponding to the shared memory, and read the contents of the target asset information partition based on the start address and end address of the target asset information partition.
[0132] Specifically, after the BIOS writes the asset information to be reported or the target asset information to be reported to the target asset information partition, the memory layout update flag, which has previously been switched to an updated state, will continue to serve as a change notification signal for the BMC. That is, the BMC periodically polls the shared memory status flag partition to detect the status of this flag in real time. Once the flag is detected as updated, the BMC can determine that the partition layout of the shared memory (especially the size and address range of the asset information partition) has changed, and needs to terminate the read operation based on the old layout and instead obtain the latest partition parameters.
[0133] During the read process, the BMC simultaneously verifies the checksum (such as CRC checksum) within the partition to ensure that the data has not been tampered with or corrupted. If the read is successful and the data verification passes, the BMC can send a confirmation command to the BIOS. Upon receiving the command, the BIOS resets the memory layout update flag from "updated" to "not updated," reserving a status identifier for the next memory layout change. If the read fails or the verification fails, the BMC can trigger a retry mechanism to reread the partition parameters and target content.
[0134] This application embodiment uses the status indication of the flag bit to prevent the BMC from reading invalid addresses or old data due to not noticing changes in memory layout, thus ensuring the accuracy of information interaction; at the same time, the BMC can directly locate the target partition based on the start and end addresses of the associated storage without traversing the entire shared memory, significantly shortening the data acquisition time.
[0135] 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.
[0136] The embodiments of this application also provide a server asset reporting device, which corresponds one-to-one with the method claims. Figure 3 This is a structural schematic diagram of a server asset reporting device 300 provided in this disclosure, as shown below. Figure 3 As shown, the device 300 of this embodiment includes:
[0137] The acquisition unit 31 is used to acquire the asset information to be reported from the server and determine whether the required storage space of the asset information to be reported exceeds the preset capacity of the asset information partition in the shared memory.
[0138] The adjustment unit 32 is used to adjust the free space of other functional partitions in the shared memory to the asset information partition when the required storage space of the asset information to be reported exceeds the preset capacity of the asset information partition in the shared memory, so as to expand the preset capacity to generate the target asset information partition.
[0139] The judgment unit 33 is used to determine whether the capacity of the target asset information partition meets the required storage space of the asset information to be reported;
[0140] The writing unit 34 is used to write the asset information to be reported to the target asset information partition when the capacity of the target asset information partition meets the required storage space of the asset information to be reported.
[0141] The filtering unit 35 is used to filter the virtual device asset information based on the attribute information of the virtual device when the capacity of the target asset information partition does not meet the required storage space of the asset information to be reported, and the asset information to be reported includes virtual asset information corresponding to the virtual device, so as to obtain the target asset information to be reported and write the target asset information to be reported into the target asset information partition.
[0142] As an optional implementation of this application, the acquisition unit 31 is specifically used to traverse all hardware devices and virtual devices corresponding to the server, and collect asset information corresponding to the hardware devices and virtual devices to generate the asset information to be reported; and acquire the required storage space corresponding to the asset information to be reported.
[0143] As an optional implementation of this application, the acquisition unit 31 is specifically used to count the total number of hardware devices and virtual devices in the asset information to be reported; and to calculate the required storage space by combining the total number of devices and the preset storage bytes of each device information.
[0144] As an optional implementation of this application, the filtering unit 35 is specifically used to extract asset information corresponding to multiple virtual devices from the asset information to be reported, and generate virtual device asset information; filter the virtual device asset information according to the virtual device attributes to obtain target virtual device asset information; the virtual device attributes include the type and physical address of the virtual device; integrate the target virtual device asset information with the hardware device asset information in the asset information to be reported to generate the target asset information to be reported, and write the target asset information to be reported to the target asset information partition.
[0145] As an optional implementation of this application, the filtering unit 35 is specifically used to obtain the type of each virtual device, and divide the virtual devices into sub-virtual device sets corresponding to each type based on the type of the virtual devices; for each sub-virtual device set, filter it in combination with the virtual device attributes to obtain a sub-target virtual device set corresponding to each sub-virtual device set; obtain sub-virtual asset information corresponding to each sub-target virtual device set to form the target virtual device asset information.
[0146] As an optional implementation of this application, the filtering unit 35 is specifically configured to: if the type of the sub-virtual device set is a virtual network interface card (NIC) device, and at least one of the NICs has a physical address, then extract the NICs with the physical address to form the sub-target virtual device set; if the type of the sub-virtual device set is a NIC device, and each NIC does not have a physical address, then extract any NIC to form the sub-target virtual device set; if the type of the sub-virtual device set is a type other than the NIC device, then generate the corresponding sub-target virtual device set based on any virtual device of each other type.
[0147] As an optional implementation of this application, the server asset reporting device further includes a processing unit, which is used to switch the memory layout update flag of the shared memory from the initial state to the updated state, and obtain the start address, end address and adjusted total capacity of the target asset information partition, and store them in association with the memory layout update flag; the memory layout update flag is used to indicate that the sizes of multiple partitions of the shared memory have changed.
[0148] As an optional implementation of this application, the processing unit is further configured to instruct the baseboard management controller to obtain changes in the size of multiple partitions of the memory layout corresponding to the shared memory through the memory layout update flag bit, and to read the content in the target asset information partition based on the start address and the end address of the target asset information partition.
[0149] As an optional implementation of this application, the asset information in the asset information partition or the target asset information partition is stored in the form of a descriptor table; wherein, each device corresponds to a descriptor entry; the descriptor entry includes at least device type, manufacturer information, device identifier and memory-mapped input / output address information.
[0150] For a description of the features in the embodiment corresponding to the server asset reporting device, please refer to the relevant description in the embodiment corresponding to the server asset reporting method, which will not be repeated here.
[0151] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described server asset reporting method embodiments.
[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 server asset reporting 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 server asset reporting 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 server asset reporting 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 above provides a detailed description of a server asset reporting method and apparatus 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 only intended to help 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 the claims of this application.
Claims
1. A server asset reporting method, characterized in that, The method comprises the following steps: acquiring asset information to be reported of a server, and judging whether the required storage space of the asset information to be reported exceeds the preset capacity of an asset information partition in a shared memory; if yes, adjusting the idle space of other functional partitions in the shared memory to the asset information partition to expand the preset capacity to generate a target asset information partition; judging whether the capacity of the target asset information partition meets the required storage space of the asset information to be reported; if yes, writing the asset information to be reported into the target asset information partition; if no, and the asset information to be reported comprises virtual asset information corresponding to a virtual device, filtering the virtual device asset information based on attribute information of the virtual device to obtain target asset information to be reported, and writing the target asset information to be reported into the target asset information partition; after adjusting the idle space of other functional partitions in the shared memory to the asset information partition to expand the preset capacity to generate a target asset information partition, the method further comprises the following steps: switching a memory layout update flag bit of the shared memory from an initial state to an updated state, acquiring the start address, end address and adjusted total capacity of the target asset information partition, and storing the same in association with the memory layout update flag bit; the memory layout update flag bit is used to identify that the sizes of multiple partitions of the memory layout of the shared memory have changed; wherein the actual size of the target asset information partition is also stored in association with the memory layout update flag bit; the method further comprises the following steps: indicating, through the memory layout update flag bit, that a baseboard management controller acquires that the sizes of multiple partitions of the memory layout corresponding to the shared memory have changed, and reading the content in the target asset information partition based on the start address and the end address of the target asset information partition.
2. The method of claim 1, wherein, Before acquiring asset information to be reported of a server and judging whether the required storage space of the asset information to be reported exceeds the preset capacity of an asset information partition in a shared memory, the method further comprises the following steps: traversing all hardware devices and virtual devices corresponding to the server, and collecting asset information corresponding to the hardware devices and the virtual devices to generate the asset information to be reported; acquiring the required storage space corresponding to the asset information to be reported.
3. The method of claim 2, wherein, The step of acquiring the required storage space corresponding to the asset information to be reported comprises the following steps: counting the total number of devices of the hardware devices and the virtual devices in the asset information to be reported; combining the total number of devices and the preset storage byte number of each device information to calculate the required storage space.
4. The method of claim 1, wherein, The step of filtering the virtual device asset information based on attribute information of the virtual device to obtain target asset information to be reported, and writing the target asset information to be reported into the target asset information partition comprises the following steps: extracting asset information corresponding to multiple virtual devices from the asset information to be reported to generate virtual device asset information; Filter the virtual device asset information according to the virtual device attribute to obtain target virtual device asset information; the virtual device attribute includes the type and physical address of the virtual device; Integrate the target virtual device asset information and the asset information of the hardware device in the to-be-reported asset information to generate the target to-be-reported asset information, and write the target to-be-reported asset information to the target asset information partition.
5. The server asset reporting method of claim 4, wherein, The filtering of the virtual device asset information according to the virtual device attribute to obtain target virtual device asset information includes: Obtaining the type of each virtual device, and dividing the virtual device into a sub-virtual device set corresponding to each type based on the type of the virtual device; For each sub-virtual device set, filtering is performed in combination with the virtual device attribute to obtain a sub-target virtual device set corresponding to each sub-virtual device set; Obtaining sub-virtual asset information corresponding to each sub-target virtual device set to constitute the target virtual device asset information.
6. The server asset reporting method of claim 5, wherein, The filtering of each sub-virtual device set in combination with the virtual device attribute to obtain a sub-target virtual device set corresponding to each sub-virtual device set includes: If the type of the sub-virtual device set is a virtual network card device, and at least one virtual network card device has a physical address, the virtual network card device having the physical address is extracted to constitute the sub-target virtual device set; If the type of the sub-virtual device set is the virtual network card device, and each virtual network card device does not have a physical address, any virtual network card device is extracted to constitute the sub-target virtual device set; If the type of the sub-virtual device set is other than the virtual network card device, a corresponding sub-target virtual device set is generated based on any virtual device in each other type.
7. The method of claim 1, wherein, The asset information in the asset information partition or the target asset information partition is saved in the form of a descriptor table; Each device corresponds to a descriptor entry; the descriptor entry at least includes device type, manufacturer information, device identification, and memory-mapped input / output address information.
8. An electronic device, comprising: It includes: A memory for storing a computer program; A processor for executing the computer program to implement the steps of the server asset reporting method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Shared area adjusting method and device and medium
CN115079951A