Configuration import method, configuration export method, server and readable storage medium

By analyzing and verifying the configuration file in the server's visual interface, and directly implementing configuration imports on the server to be configured, the problems of failure and lack of automation in the existing technology are solved, and the success rate and reliability of configuration imports are improved.

CN119668676APending Publication Date: 2025-03-21INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411786277.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

The prior art is prone to import failures in server batch configuration, lacking the ability to automate and batch processing, resulting in a low success rate of configuration import.

Method used

By outputting the configuration page on the visual interface of the server to be configured, the configuration file is acquired and parsed in response to the configuration import operation, legality verification is performed, and configuration import is performed after passing the verification.

Benefits of technology

There is no need to issue instructions through third-party devices, and the operation is simple, which can improve the success rate of server configuration import, ensure the reliability of configuration and quickly replicate the configuration of configured servers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668676A_ABST
    Figure CN119668676A_ABST
Patent Text Reader

Abstract

The invention discloses a configuration import method, a configuration export method, a server and a readable storage medium, and the method comprises the steps that after a server to be configured outputs a configuration page on a visual interface, a configuration file to be imported is determined in response to a configuration import operation; wherein the configuration file comprises an object created by a configured server through contrasting with a local function, and the object has configuration information corresponding to the local function; acquiring a configuration file, and analyzing the configuration file based on an object numbered musical notation programming language; performing legality verification on the analyzed object and configuration information of the object; and after the validity verification is passed, configuring a corresponding local function by using the analyzed object and the configuration information of the object. The method has the technical effects that the to-be-configured server can be configured on the basis of the configuration page without participation of third-party equipment, the operation is simple, legality verification is performed on the configuration file in the configuration process, and the server configuration success rate can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer application technology, and in particular to a configuration import method, a configuration export method, a server, and a readable storage medium. Background Art

[0002] As the scale of data centers and enterprise networks continues to expand, the number of servers is increasing rapidly, and manual server configuration can no longer meet the needs of efficient management. Existing server configuration methods are complex and prone to errors, and lack automation and batch processing capabilities.

[0003] In the existing implementation scheme for batch configuration of servers, the required configuration items are stored in a remote server, and the relevant instructions are sent through a third-party device, so that the target server communicates with the server storing the configuration items, and then the required configuration can be performed on the target server. Since the instructions need to be sent through a third-party device, import failures are likely to occur.

[0004] In summary, how to effectively improve the success rate of service configuration import is a technical problem that technical personnel in this field urgently need to solve. Summary of the invention

[0005] The purpose of this application is to provide a configuration import method, a configuration export method, a server and a readable storage medium, which are simple to operate and can improve the success rate of server configuration import.

[0006] In order to solve the above technical problems, this application provides the following technical solutions:

[0007] A configuration import method, applied to a server to be configured, comprising:

[0008] After the configuration page is outputted on the visual interface, a configuration file to be imported is determined in response to a configuration import operation; wherein the configuration file includes an object created by the configured server by comparing the local function, and the object has configuration information of the corresponding local function;

[0009] Obtaining the configuration file, and parsing the configuration file based on the object notation programming language;

[0010] Perform legality check on the parsed objects and their configuration information;

[0011] After the legality check is passed, the corresponding local functions are configured using the parsed objects and the object's configuration information.

[0012] Preferably, obtaining the configuration file includes:

[0013] The front end of the server to be configured turns on the configuration import switch of the message bus system;

[0014] The backend of the server to be configured detects that the configuration import switch is in the on state, starts the configuration import service, and uses the configuration import service to obtain the configuration file;

[0015] Accordingly, it also includes:

[0016] After the configuration import is completed, the configuration import switch of the message bus system is reset.

[0017] Preferably, after configuring the corresponding local function using the parsed object and the configuration information of the object, the method further includes:

[0018] In response to the configuration rollback operation, determining a historical configuration file to be rolled back;

[0019] Acquire the historical configuration file, and parse the historical configuration file based on the object notation programming language;

[0020] The parsed objects and their configuration information are used to roll back the corresponding local functions.

[0021] Preferably, after configuring the corresponding local function using the parsed object and the configuration information of the object, the method further includes:

[0022] In response to the configuration comparison operation, determining a first configuration file and a second configuration file to be compared;

[0023] Obtaining the first configuration file and the second configuration file, and parsing the first configuration file and the second configuration file based on the object notation programming language;

[0024] The parsed objects and their configuration information are used to perform configuration comparison to obtain configuration difference information.

[0025] Preferably, the object obtained through parsing and its configuration information are subjected to a validity check, including:

[0026] Perform at least one of structure check, nested structure check, value range check, type check, format check and dependency check on the parsed objects and configuration information;

[0027] If all the judgment results are passed, it is determined that the legality check has passed;

[0028] If there is a failure in the judgment result, it is determined that the legality check has failed, an error log is recorded, the configuration is terminated, and the legality verification failure is output;

[0029] Wherein, the structure verification includes:

[0030] Determine whether necessary configuration items exist in the object;

[0031] If yes, it is determined that the structure check has been passed; if no, it is determined that the structure check has not been passed;

[0032] The nested structure verification includes:

[0033] Obtaining a nested structure between objects, and determining whether the nested structure matches a preset structure;

[0034] If yes, it is determined that the nested structure check has been passed; if no, it is determined that the nested structure check has not been passed;

[0035] The value range check includes:

[0036] Read the configuration parameters in the configuration information and determine whether the configuration parameters are within the corresponding value range;

[0037] If yes, it is determined that the value range test is passed; if no, it is determined that the value range test is not passed;

[0038] The type verification includes:

[0039] Determine whether the configuration information is consistent with the type of the configuration item;

[0040] If yes, the type check is passed; if no, it is determined that the type check is not passed;

[0041] The format verification includes:

[0042] Use regular expressions to check the string type in the configuration information to determine whether the string format is correct;

[0043] If yes, it is determined that the format check has been passed; if no, it is determined that the format check has not been passed;

[0044] The dependency verification includes:

[0045] Check whether there is a dependency relationship between objects;

[0046] If yes, it is determined that the dependency check has been passed; if no, it is determined that the dependency check has not been passed.

[0047] Preferably, it also includes:

[0048] Use several test cases to test the import process and obtain several test results;

[0049] Summarize several test results and get a test report;

[0050] The test report is stored in a designated directory, and / or the test report is sent to a designated client.

[0051] A configuration export method, applied to a configured server, includes:

[0052] After the configuration page is outputted on the visual interface, the configuration properties of the message bus system are read in response to the configuration export operation to obtain the configuration information;

[0053] Create corresponding objects for different local functions according to the object notation programming language, and write the configuration information belonging to the object into the object;

[0054] A configuration file is created in the target directory, and the created object is imported into the configuration file, so that the unconfigured server executes the steps of the configuration import method as described above.

[0055] Preferably, the configuration properties of the message bus system are read to obtain configuration information, including:

[0056] In the case of a failure in reading the target configuration attribute, determining the configuration information corresponding to the target configuration attribute as an output configuration value error;

[0057] When the target configuration attribute is read successfully, the configuration information corresponding to the target configuration attribute is determined as the read content information.

[0058] A server, comprising:

[0059] Memory for storing computer programs;

[0060] A processor is used to implement the steps of the configuration import method as described above, or the steps of the configuration import method as described above when executing the computer program.

[0061] A readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the configuration import method described above are implemented, or the steps of the configuration import method described above are implemented.

[0062] A computer program product comprises a computer program / instruction, which, when executed by a processor, performs the steps of the configuration import method described above, or the steps of the configuration import method described above.

[0063] By applying the method provided in the embodiment of the present application, after the server to be configured outputs the configuration page on the visual interface, the configuration file to be imported is determined in response to the configuration import operation; wherein the configuration file includes an object created by the configured server by comparing the local function, and the object has the configuration information of the corresponding local function; the configuration file is obtained, and the configuration file is parsed based on the object notation programming language; the legitimacy of the object obtained by parsing and the configuration information of the object is checked; after the legitimacy check is passed, the corresponding local function is configured using the object obtained by parsing and the configuration information of the object.

[0064] In the present application, the server to be configured can output a configuration page in a visual interface, and the user can operate the configuration page. In response to the configuration import operation, the server to be configured can determine the configuration file to be imported. After obtaining the configuration file, the configuration file can be parsed. Since the configuration file includes objects created by the configured server by comparing its local functions, and the objects have configuration information of corresponding local functions, the configuration file is parsed based on the object notation programming language, and after the parsing is successful, the objects and the configuration information of the objects can be obtained. In order to ensure the reliability and success rate of the configuration, the objects and the configuration information of the objects obtained by the parsing will first be checked for legality, and then the configuration will be performed only after the legality check is passed.

[0065] The technical effect of the present application is as follows: there is no need to issue instructions through a third-party device, but the configuration file can be selected based on the configuration page, so as to configure the server to be configured. The operation is simple, and the back-end configuration directly obtains the configuration file of the configured server, and then after successfully parsing the configuration file, a legality check is performed, so that the server to be configured can quickly copy the configuration of the configured server based on the parsed object and the configuration information of the object, which can improve the success rate of server configuration.

[0066] Correspondingly, the embodiments of the present application also provide a configuration export method, a server, a readable storage medium and a computer program product corresponding to the above-mentioned configuration import method, which have the above-mentioned technical effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0068] Figure 1 This is a flowchart of an implementation of a configuration import method in an embodiment of the present application;

[0069] Figure 2 This is a schematic diagram of an implementation of a configuration import method in an embodiment of the present application;

[0070] Figure 3 This is a flowchart of an implementation of a configuration import method in an embodiment of the present application;

[0071] Figure 4 This is a schematic diagram of an implementation of a configuration import method in an embodiment of the present application;

[0072] Figure 5This is a schematic diagram of a test process in an embodiment of the present application;

[0073] Figure 6 This is a schematic diagram of the structure of a server in an embodiment of the present application;

[0074] Figure 7 This is a schematic diagram of the specific structure of a server in an embodiment of the present application. DETAILED DESCRIPTION

[0075] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0076] Please refer to Figure 1 , Figure 1 This is a flowchart of a configuration import method in an embodiment of the present application, which is applied to a server to be configured. The method includes the following steps:

[0077] S101. After a configuration page is output on a visualization interface, a configuration file to be imported is determined in response to a configuration import operation.

[0078] The configuration file includes an object created by the configured server by comparing the local function, and the object contains configuration information of the corresponding local function.

[0079] In this embodiment, the front end of the server can output a configuration page on a visual interface. The user can perform configuration import operations on the configuration page, such as selecting which configuration file to use.

[0080] In response to the configuration import operation, the server may determine a configuration file to import.

[0081] For example, Figure 2 As shown in the figure, you can add a new import BMC (Baseboard Manager Controller) configuration function: add a new import BMC configuration function and corresponding button on the Web page. In this way, users can complete the configuration import operation by browsing files and submitting files. Among them, browse files: users click the browse file button and select the BMC configuration file to be imported from the local, and the file content will be parsed by the browser and stored in the local memory; submit files: users click the import configuration button, and the browser transmits the file content to the backend.

[0082] It should be noted that in the embodiment of the present application, the configuration file includes an object created by the configured server by comparing the local function, and the object has the configuration information of the corresponding local function. In other words, the object and the configuration information of the object in the configuration file are the relevant functions and specific configuration items of the configured server.

[0083] The configuration file can be a configuration file exported by the configured server after completing its configuration. In the process of exporting the configuration file, the configured server creates objects (json objects) based on its own functions, obtains the configuration information of the specific configuration items under the function, writes it into the corresponding object (json object), creates a file (JSON file) covering these objects, and stores the file in the specified target (such as the local tmp directory of the BMC) so that other servers to be configured can obtain it.

[0084] For example: configuration information can include all the attributes of the configuration that needs to be exported that are exposed on dbus, such as the user name, enabled status, user group permissions, user group information, etc. of each user in the user configuration, as well as the current time, time zone, and ntp server IP information in the time configuration. This information is exposed on dbus and saved through the corresponding attributes on dbus, and then read and used by other processes. Other processes can also call dbus methods to set related attributes and modify the corresponding configuration. In the exported configuration, the corresponding configuration attributes are mainly obtained by calling dbus methods and then placed under the newly created json object.

[0085] S102: Obtain a configuration file, and parse the configuration file based on the object notation programming language.

[0086] In this embodiment, the server may obtain the configuration file by communicating with a configured server storing the configuration file, or by downloading the configuration file through a network, or by reading the configuration file from a locally saved file.

[0087] In a specific implementation of the present application, obtaining a configuration file includes:

[0088] The front end of the server to be configured turns on the configuration import switch of the message bus system;

[0089] The backend of the server to be configured detects that the configuration import switch is turned on, starts the configuration import service, and uses the configuration import service to obtain the configuration file;

[0090] Accordingly, it also includes:

[0091] After the configuration import is completed, reset the configuration import switch of the message bus system.

[0092] For ease of description, the above steps are combined for explanation below.

[0093] Before implementing this embodiment, a new service may be added: a new bmc-config-import (configuration import) service may be added to the system. The service will read the import configuration json file with a fixed name in the / tmp directory.

[0094] Before implementing this embodiment, a new dbus attribute can be added: a new attribute BMCImportEnable (configuration import switch) is added to the dbus interface. The default initial value of this attribute is false. When we perform a configuration import operation, the redfish method will be called to set the attribute value to true. When the backend detects that the value is set to true, the bmc-config-import service will be started, and then the configuration import operation will begin. After the configuration import operation is completed, the attribute will be reset to false regardless of whether it is successful.

[0095] Added a new BMC configuration import function: Added a new BMC configuration import function and corresponding button on the web page. After the user browses the file and submits the file, the browser transfers the configuration file content to the backend.

[0096] After receiving the file content, the backend renames it and stores it in the local tmp directory of the BMC (the bmc-config-import service uses a fixed file name to search for the corresponding import configuration file in the / tmp directory. The configuration file imported through the front end cannot restrict the customer to use a certain file name. As long as the content, file size and file suffix are legal, they can be used as import configuration files for import configuration operations. Renaming is required here to facilitate search). Enable import service: Enable the bmc-config-import service. Read configuration files: The bmc-config-import service reads the imported configuration files from the tmp directory.

[0097] After obtaining the configuration file, the configuration file can be parsed based on the object notation programming language.

[0098] Specifically, you can use the file reading library to read the configuration file from the specified directory, and use the JSON parsing library to parse the file content into a JSON object. If the configuration file content cannot be parsed into a JSON object, the failure is directly recorded and the configuration import operation is interrupted.

[0099] For example: After bmc-config-import finishes reading, it will interpret the contents of the configuration file into json objects according to the corresponding functions, such as the configuration parameters contained in TimeSetting, Usersetting, and other objects.

[0100] S103: Perform a validity check on the parsed object and its configuration information.

[0101] After successful parsing, the legitimacy of the parsed object and the object's configuration information can be checked to ensure that the file content meets the expected format and requirements, thereby ensuring smooth configuration.

[0102] The legality check may be performed on the relationship between objects, the relationship between configuration information and objects, the format and value range of the configuration information itself, etc.

[0103] In a specific implementation of the present application, the object obtained by parsing and the configuration information of the object are subjected to a validity check, including:

[0104] Step 1: Perform at least one of structure check, nested structure check, value range check, type check, format check and dependency check on the parsed object and configuration information;

[0105] Step 2: If the judgment results are all passed, it is determined that the legality check has passed;

[0106] Step 3: If there is a failure in the judgment result, determine that the legality check has failed, record the error log, end the configuration and output the legality verification failure;

[0107] Among them, structural verification includes:

[0108] Determine whether necessary configuration items exist in the object;

[0109] If yes, it is determined that the structure check has been passed; if no, it is determined that the structure check has not been passed;

[0110] Nested structure validation, including:

[0111] Get the nested structure between objects and check whether the nested structure matches the preset structure;

[0112] If yes, it is determined that the nested structure check has been passed; if no, it is determined that the nested structure check has not been passed;

[0113] Value range check, including:

[0114] Read the configuration parameters in the configuration information and determine whether the configuration parameters are within the corresponding value range;

[0115] If yes, it is determined that the value range test is passed; if no, it is determined that the value range test is not passed;

[0116] Type checking, including:

[0117] Determine whether the configuration information is consistent with the type of the configuration item;

[0118] If yes, the type check is passed; if no, it is determined that the type check is not passed;

[0119] Format verification, including:

[0120] Use regular expressions to check the string type in the configuration information to determine whether the string format is correct;

[0121] If yes, it is determined that the format check has been passed; if no, it is determined that the format check has not been passed;

[0122] Dependency verification, including:

[0123] Check whether there is a dependency relationship between objects;

[0124] If yes, it is determined that the dependency check has been passed; if no, it is determined that the dependency check has not been passed.

[0125] For ease of description, the above steps are combined for explanation below.

[0126] Among them, structure verification: configuration item existence verification: check whether the json object contains predefined necessary configuration items.

[0127] Nested structure verification: Check whether the nested structure of the JSON object meets expectations. For example, some configuration items may need to contain specific sub-configuration items.

[0128] Value range and type verification: Value range verification: For numeric configuration items, check whether their values ​​are within the predefined range. For example, the port number should be between 0 and 65535.

[0129] Type verification: Check whether the type of each configuration item is correct. For example, the IP address should be a string and the port number should be an integer.

[0130] Use regular expressions to check the format of string-type configuration items, such as the format of IP addresses and email addresses.

[0131] Dependency verification: Check the dependencies between configuration items. For example, if a feature is enabled, you need to check whether the related configuration items are also set.

[0132] Error handling and logging: If an illegal configuration item is found, an error log is recorded, including the error type, configuration item path, expected value, and actual value. The import operation is aborted and an error code or message is returned.

[0133] In practical applications, one or more of the above verification methods can be selected for legality verification. When multiple verification methods are selected, the legality verification is determined to have passed only when every verification passes; when there is a verification that fails, the legality verification is determined to have failed.

[0134] S104: After the legality check is passed, the corresponding local function is configured using the parsed object and the configuration information of the object.

[0135] After the legality check is passed, the corresponding local functions can be configured using the parsed objects and the object's configuration information.

[0136] In actual applications, the verified configuration can be applied to the local system by asynchronously calling the dbus set-property method. It should be noted that the corresponding dbus method (dbus set-property method, configuration method) can be called only after the verification is passed to update the corresponding configuration according to the imported value. If the parameter verification fails or the dbus method call fails, the final status returned by this service is failure.

[0137] Among them, set-property is a method in the dbus (Desktop Bus) protocol, which is used to set the value of an object property. dbus is a message bus system used for inter-process communication (IPC), such as in the Linux desktop environment and other systems, for communication between different applications and services.

[0138] The SetProperty method is usually located in the org.freedesktop.DBus.Properties interface. Its method signature is void SetProperty(string interface_name, string property_name, variantvalue), and its parameters are: interface_name (string): the name of the interface to which the property belongs; property_name(string): the name of the property to be set; value(variant): the new value to be set, the type is variant (variant), which can contain any basic data type or complex data structure. This method has no return value (void). This method is used in scenarios: used to dynamically update the property value of an object, such as configuration management, status update, etc.

[0139] By applying the method provided in the embodiment of the present application, after the server to be configured outputs the configuration page on the visual interface, the configuration file to be imported is determined in response to the configuration import operation; wherein the configuration file includes an object created by the configured server by comparing the local function, and the object has the configuration information of the corresponding local function; the configuration file is obtained, and the configuration file is parsed based on the object notation programming language; the legitimacy of the object obtained by parsing and the configuration information of the object is checked; after the legitimacy check is passed, the corresponding local function is configured using the object obtained by parsing and the configuration information of the object.

[0140] In the present application, the server to be configured can output a configuration page in a visual interface, and the user can operate the configuration page. In response to the configuration import operation, the server to be configured can determine the configuration file to be imported. After obtaining the configuration file, the configuration file can be parsed. Since the configuration file includes objects created by the configured server by comparing its local functions, and the objects have configuration information of corresponding local functions, the configuration file is parsed based on the object notation programming language, and after the parsing is successful, the objects and the configuration information of the objects can be obtained. In order to ensure the reliability and success rate of the configuration, the objects and the configuration information of the objects obtained by the parsing will first be checked for legality, and then the configuration will be performed only after the legality check is passed.

[0141] The technical effect of the present application is as follows: there is no need to issue instructions through a third-party device, but the configuration file can be selected based on the configuration page, so as to configure the server to be configured. The operation is simple, and the back-end configuration directly obtains the configuration file of the configured server, and then after successfully parsing the configuration file, a legality check is performed, so that the server to be configured can quickly copy the configuration of the configured server based on the parsed object and the configuration information of the object, which can improve the success rate of server configuration.

[0142] It should be noted that, based on the above embodiments, the embodiments of the present application also provide corresponding improved solutions. In the preferred / improved embodiments, the same steps or corresponding steps as those in the above embodiments can be referenced to each other, and the corresponding beneficial effects can also be referenced to each other, which will not be described one by one in the preferred / improved embodiments of this article.

[0143] In a specific implementation of the present application, after configuring the corresponding local function using the parsed object and the configuration information of the object, it also includes:

[0144] In response to the configuration rollback operation, determining a historical configuration file to be rolled back;

[0145] Obtain the historical configuration file, and parse the historical configuration file based on the object notation programming language;

[0146] The parsed objects and their configuration information are used to roll back the corresponding local functions.

[0147] For ease of description, the above steps are combined for explanation below.

[0148] After configuring the server to be configured, the configuration file used for this configuration can be retained. A configuration rollback function can be provided on the configuration page. In response to the configuration rollback operation, the historical configuration file to be rolled back can be determined.

[0149] Then, the historical configuration file is obtained and parsed, and after the parsing is successful, the corresponding local function can be directly rolled back using the parsed object and the configuration information of the object. That is, the corresponding local function is directly reconfigured based on the historical configuration file to achieve configuration rollback.

[0150] The historical version rollback function can be used to select a historical version configuration to overwrite if there is a problem with the imported configuration of a certain version, or when a previous configuration is needed, so as to realize arbitrary switching of historical versions and ensure the normal operation of server functions.

[0151] When configuration fails or a problem is found, roll back to a previous version. Specifically, a rollback user interface can be provided to display the version history and support users to select a target version for rollback. During the rollback process, the configuration file of the target version is automatically imported, and legality verification and functional testing are performed.

[0152] In a specific implementation of the present application, after configuring the corresponding local function using the parsed object and the configuration information of the object, it also includes:

[0153] In response to the configuration comparison operation, determining a first configuration file and a second configuration file to be compared;

[0154] Obtaining a first configuration file and a second configuration file, and parsing the first configuration file and the second configuration file based on an object notation programming language;

[0155] The parsed objects and their configuration information are used to perform configuration comparison to obtain configuration difference information.

[0156] For ease of description, the above steps are combined for explanation below.

[0157] After configuring the server to be configured, the configuration file used for this configuration can be retained. A configuration comparison function can be provided on the configuration page. In response to the configuration comparison operation, a first configuration file and a second configuration file to be compared can be determined.

[0158] Then, the first configuration file and the second configuration file are parsed to obtain objects and configuration information of the objects in the two different versions of the configuration files. Configuration difference information can be obtained by comparing the objects and configuration information of the objects respectively parsed from the two configuration files.

[0159] Specifically, it can provide a version comparison function to display the differences between different versions and help users understand the specific content of configuration changes. It supports text comparison (such as using the Diff algorithm) and structured data comparison (such as JSON comparison).

[0160] For example, if the objects parsed out of the first configuration file are A, B and C, and the objects parsed out of the second configuration file are A and B, then the functional difference between the first configuration file and the second configuration file is function C; accordingly, by comparing the configuration information of function A one by one, it can also be determined whether there is a configuration difference corresponding to function A; by comparing the configuration information of function B one by one, it can also be determined whether there is a configuration difference corresponding to function B.

[0161] It can be seen that the configuration import method provided in the present application implements multi-dimensional detection of the configuration file content when importing the configuration, thereby ensuring the legality of the imported configuration and avoiding the corresponding function failure or process crash due to incorrect imported configuration.

[0162] Corresponding to the above configuration import method, this application also provides a configuration export method, which is applied to the configured server, please refer to Figure 3 , the configuration export method includes:

[0163] S201. After the configuration page is output on the visualization interface, the configuration properties of the message bus system are read in response to the configuration export operation to obtain configuration information.

[0164] After the configuration page is output on the visual interface, the user can perform operations on the configuration page according to the configuration requirements to trigger the configured server to export the configuration file.

[0165] Among them, read the configuration properties of the message bus system to obtain configuration information, including:

[0166] In the case of failure to read the target configuration attribute, the configuration information corresponding to the target configuration attribute is determined as an output configuration value error;

[0167] When the target configuration attribute is read successfully, the configuration information corresponding to the target configuration attribute is determined as the read content information.

[0168] S202, creating corresponding objects for different local functions according to the object notation programming language, and writing the configuration information belonging to the object into the object.

[0169] S203: Create a configuration file in the target directory, and import the created object into the configuration file, so that the unconfigured server executes the steps of the configuration import method as described above.

[0170] In the actual implementation process, Figure 4 As shown, you can add a new service: add a bmc-config-export (configuration export) service in the Linux system. This service will call all the dbus interfaces of the required exported configurations. If the configurations of some services are not exposed on the dbus, but are directly placed in the corresponding configuration files, then this service will also directly read the corresponding configuration files and read out the configurations in the files; after all the configurations are read out, a new json object will be created according to the functions. For example, for time-related configurations, a new TimeSetting object will be created, and for user-related configurations, a new UserSetting object will be created, and then all the configurations of the corresponding functions will be placed under this object. When all the configurations that need to be exported are exported, all the function configuration objects will be included to generate a json document with the generation date as the file name, and then placed in the corresponding set directory.

[0171] New dbus attribute: A new attribute BMCExportEnable (configuration export enable switch) is added to the dbus interface. When the configuration export operation is required, the corresponding redfish interface is called to change the value of this attribute to true. After the backend receives the signal, it will start the bmc-config-export service to collect relevant configurations. After the configuration export operation is completed, the attribute will be reset to false regardless of whether it is successful.

[0172] Function implementation in the front-end: Added a new BMC configuration export function: Added a new BMC configuration export function and corresponding button on the web page. Calling Redfish URL (network address for accessing Redfish service): When the user clicks the export configuration button, the front-end will call the corresponding Redfish URL and send the request to export the BMC configuration to the back-end (system).

[0173] Backend processing flow:

[0174] 1. Receive request: The backend receives the request signal to export the BMC configuration.

[0175] 2. Asynchronous call of dbus method: The backend asynchronously calls dbus BMCExportEnable.

[0176] 3. Start the export service: The implementation of BMCExportEnable starts the bmc-config-export service.

[0177] 4. Read configuration: The bmc-config-export service reads the properties under dbus corresponding to the required configuration.

[0178] 5. Error handling: If an error occurs in the dbus call to obtain a property, the value of the property will be set to "output configuration value error" in the exported JSON file.

[0179] 6. Generate JSON file: All other attributes generate corresponding JSON objects according to the corresponding modules (such as time configuration, user configuration, log configuration, etc.), and finally integrate all JSON messages into a JSON file.

[0180] 7. Store the file: Store the generated JSON file in the specified directory of the BMC, such as the / tmp directory or other specified directory. This completes the export of the configuration file.

[0181] In addition, you can maintain a version library to store each exported configuration file and its related information. Generate a unique version number for each version, and record metadata such as export time, operator, and modification record. Support version comparison of configuration files to display the differences between different versions.

[0182] The configuration files and version metadata can be stored in a file system or a database (such as SQLite, PostgreSQL, etc.). Each time a configuration file is exported, the file content and metadata are stored in the version library.

[0183] Combining the configuration export method with the configuration import method can quickly copy the configuration of a server to another server, thus achieving fast configuration replication. In addition, when exporting the configuration, you can assign special values ​​to the problematic configuration and record the corresponding logs, so that operators can quickly locate the problem point and save time.

[0184] Corresponding to the above configuration import method and configuration export method, this application also provides a configuration test solution, please refer to Figure 5 , the specific implementation includes the following steps:

[0185] S301. Use several test cases to test the export process and import process of the server configuration to obtain several test results.

[0186] Among them, the import process includes the steps of the configuration import method as mentioned above, and the import process includes the steps of the configuration import method as mentioned above.

[0187] S302: Summarize several test results to obtain a test report.

[0188] S303: Store the test report in a designated directory, and / or send the test report to a designated client.

[0189] That is, the test report can be stored in a specified directory, sent to a specified client, or stored in a specified directory and sent to a specified client at the same time.

[0190] A series of automated test scripts can be written covering the main functions of importing and exporting configurations.

[0191] The test process of this automated test script includes configuration import validity test, and the test content includes:

[0192] File upload test: upload different types of configuration files (legal files, files missing key configuration items, files that do not conform to the format); verify whether the system can receive and store files normally.

[0193] Legality check: Check whether the log records detailed information about illegal configuration items (including error type, path, and cause); verify whether legal files can pass the check and whether illegal files are rejected.

[0194] Boundary value test: Upload a configuration file containing boundary values ​​(such as minimum value, maximum value, empty value, etc.) to ensure that the system processes it correctly.

[0195] Error handling verification: Check whether the system interrupts the import process and returns an error prompt when a file parsing error occurs.

[0196] Configure application testing, including:

[0197] Configuration parameter comparison: After importing a valid configuration file, read the configuration on the server (through dbus properties) to verify whether the server configuration is consistent with the value in the file.

[0198] Configuration coverage test: Test the effect of repeatedly importing the same configuration file. Test the correctness of the system configuration after importing different versions of configuration files.

[0199] System function test (after importing the configuration, the overall function test of the server further ensures the correctness of the imported configuration), including:

[0200] Service status test: After importing the configuration, check whether the operation status of key services is normal. Perform functional verification on modules associated with the configuration (such as log module and user module).

[0201] Network connectivity testing: Checks whether the network is configured correctly and verifies whether the server can successfully connect to the expected network resources (such as databases, API endpoints).

[0202] System resource usage test: Monitor the system resource usage (CPU, memory, disk usage, etc.) after the configuration is imported to ensure that the configuration does not cause abnormal resource consumption.

[0203] Version control test: Version record test: After importing multiple configurations, check whether the version library correctly records the configuration version imported each time.

[0204] Version rollback test: Roll back to a historical version to verify whether the configuration after rollback is consistent with the target version.

[0205] Version comparison test: Compare any two versions of configuration files to check whether the differences are displayed accurately.

[0206] Error and exception handling testing, including:

[0207] Logging test: Check whether the log records detailed import and verification information. Verify whether the log includes error prompts and configuration operation history.

[0208] Abnormal file processing: Upload configuration files with serious errors (such as non-JSON files, large files) to verify the robustness of the system.

[0209] Power outage / interruption test: simulates system interruptions during the import process (such as power outages, process termination) to verify the system's recovery capabilities and data integrity.

[0210] Test result verification and report generation, as follows:

[0211] About result analysis: Automatically compare the running results of the test scripts to determine whether they pass or fail.

[0212] Generate test report: summarize the results of all test cases, indicating the success rate, failed cases and error information.

[0213] The report includes: test case number and description, test execution steps and inputs, and comparison of actual output with expected value.

[0214] Notification mechanism: Test reports can be stored in a specified directory. Reports can also be sent to relevant personnel via email or message queues. Use an automated testing framework (such as Python's unittest or pytest) to organize and run tests.

[0215] About test case design:

[0216] 1. Correctness of configuration parameters: By obtaining the configured attribute values ​​on the corresponding dbus and comparing them with the corresponding values ​​in the configuration file, whether the corresponding values ​​have been correctly configured.

[0217] 2. Network connection test: Test whether the server can connect to network resources normally, such as databases, external APIs, etc.

[0218] 3. Service status check: Check the running status of key services on the server to ensure that they start normally after the configuration is imported.

[0219] 4. System resource monitoring: Monitor the usage of system resources such as CPU, memory, disk, etc. to ensure there are no abnormalities.

[0220] Test execution includes the following steps:

[0221] Step 1: After the configuration is imported, the predefined test script is automatically triggered.

[0222] Step 2: Use a scheduler (such as cron or systemd) to run the test script regularly to ensure that the system status remains normal.

[0223] Result verification and report generation: Generate a detailed test report based on the test results, including the passed test cases, failed test cases and their error information. Store the test report in the specified directory and send it to the specified email address or message queue for notification.

[0224] In actual applications, in addition to using the redfish interface to enable import and export of configurations, the IPMI interface can also be used to achieve this. Compared with the redfish interface, when using the IPMI interface, you only need to use the ipmi command to implement the functions implemented by the corresponding redfish command, and I will not go into details here.

[0225] Corresponding to the above method embodiment, the embodiment of the present application further provides a server. The server described below and the configuration import method and configuration import method described above can refer to each other.

[0226] See also Figure 6 As shown, the server includes:

[0227] A memory 332, for storing computer programs;

[0228] The processor 322 is used to implement the steps of the configuration import method of the above method embodiment when executing the computer program.

[0229] For details, please refer to Figure 7 , Figure 7A specific structural diagram of a server provided for this embodiment, which may have relatively large differences due to different configurations or performances, may include one or more processors (central processing units, CPU) (for example, one or more processors) and a memory 332, and the memory 332 stores one or more computer programs 342 or data 344. Among them, the memory 332 can be a temporary storage or a permanent storage. The program stored in the memory 332 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the data processing device. Furthermore, the processor 322 can be configured to communicate with the memory 332 and execute a series of instruction operations in the memory 332 on the server 301.

[0230] The server 301 may also include one or more power supplies 326 , one or more wired or wireless network interfaces 350 , one or more input and output interfaces 358 , and / or one or more operating systems 341 .

[0231] The steps in the configuration import method described above can be implemented by the structure of the server.

[0232] That is, when the server is a server to be configured, the server can implement the following steps:

[0233] After the configuration page is outputted on the visual interface, a configuration file to be imported is determined in response to a configuration import operation; wherein the configuration file includes an object created by the configured server by comparing the local function, and the object has configuration information of the corresponding local function;

[0234] Obtain the configuration file and parse the configuration file based on the object notation programming language;

[0235] Perform legality check on the parsed objects and their configuration information;

[0236] After the legality check is passed, the corresponding local functions are configured using the parsed objects and the object's configuration information.

[0237] In a specific implementation, obtaining a configuration file includes:

[0238] The front end of the server to be configured turns on the configuration import switch of the message bus system;

[0239] The backend of the server to be configured detects that the configuration import switch is turned on, starts the configuration import service, and uses the configuration import service to obtain the configuration file;

[0240] Accordingly, it also includes:

[0241] After the configuration import is completed, reset the configuration import switch of the message bus system.

[0242] In a specific implementation, after configuring the corresponding local function using the parsed object and the configuration information of the object, the method further includes:

[0243] In response to the configuration rollback operation, determining a historical configuration file to be rolled back;

[0244] Obtain the historical configuration file, and parse the historical configuration file based on the object notation programming language;

[0245] The parsed objects and their configuration information are used to roll back the corresponding local functions.

[0246] In a specific implementation, after configuring the corresponding local function using the parsed object and the configuration information of the object, the method further includes:

[0247] In response to the configuration comparison operation, determining a first configuration file and a second configuration file to be compared;

[0248] Obtaining a first configuration file and a second configuration file, and parsing the first configuration file and the second configuration file based on an object notation programming language;

[0249] The parsed objects and their configuration information are used to perform configuration comparison to obtain configuration difference information.

[0250] In a specific implementation, the validity of the parsed object and the configuration information of the object is verified, including:

[0251] Perform at least one of structure check, nested structure check, value range check, type check, format check and dependency check on the parsed objects and configuration information;

[0252] If all the judgment results are passed, it is determined that the legality check has passed;

[0253] If there is a failure in the judgment result, it is determined that the legality check has failed, an error log is recorded, the configuration is terminated, and the legality verification failure is output;

[0254] Among them, structural verification includes:

[0255] Determine whether necessary configuration items exist in the object;

[0256] If yes, it is determined that the structure check has been passed; if no, it is determined that the structure check has not been passed;

[0257] Nested structure validation, including:

[0258] Get the nested structure between objects and check whether the nested structure matches the preset structure;

[0259] If yes, it is determined that the nested structure check has been passed; if no, it is determined that the nested structure check has not been passed;

[0260] Value range check, including:

[0261] Read the configuration parameters in the configuration information and determine whether the configuration parameters are within the corresponding value range;

[0262] If yes, it is determined that the value range test is passed; if no, it is determined that the value range test is not passed;

[0263] Type checking, including:

[0264] Determine whether the configuration information is consistent with the type of the configuration item;

[0265] If yes, the type check is passed; if no, it is determined that the type check is not passed;

[0266] Format verification, including:

[0267] Use regular expressions to check the string type in the configuration information to determine whether the string format is correct;

[0268] If yes, it is determined that the format check has been passed; if no, it is determined that the format check has not been passed;

[0269] Dependency verification, including:

[0270] Check whether there is a dependency relationship between objects;

[0271] If yes, it is determined that the dependency check has been passed; if no, it is determined that the dependency check has not been passed.

[0272] In a specific embodiment, it also includes:

[0273] Use several test cases to test the import process and obtain several test results;

[0274] Summarize several test results and get a test report;

[0275] Store the test report in a specified directory and / or send the test report to a specified client.

[0276] When the server is a configured server, the steps in the configuration import method described above can be implemented by the structure of the server. That is, the following steps are implemented in the server:

[0277] After the configuration page is outputted on the visual interface, the configuration properties of the message bus system are read in response to the configuration export operation to obtain the configuration information;

[0278] Create corresponding objects for different local functions according to the object notation programming language, and write the configuration information belonging to the object into the object;

[0279] Create a configuration file in the target directory, and import the created object into the configuration file, so that the unconfigured server executes the steps of the configuration import method as described above.

[0280] In a specific implementation, reading the configuration attributes of the message bus system to obtain configuration information includes:

[0281] In the case of failure to read the target configuration attribute, the configuration information corresponding to the target configuration attribute is determined as an output configuration value error;

[0282] When the target configuration attribute is read successfully, the configuration information corresponding to the target configuration attribute is determined as the read content information.

[0283] Corresponding to the above method embodiment, the embodiment of the present application also provides a readable storage medium. The readable storage medium described below and the configuration import method and configuration import method described above can refer to each other.

[0284] A readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the configuration import method of the above method embodiment, or the steps of the configuration import method as described above.

[0285] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.

[0286] Corresponding to the above method embodiment, the embodiment of the present application also provides a computer program product. The computer program product described below and the configuration import method and configuration import method described above can refer to each other.

[0287] A computer program product includes a computer program / instruction. When the computer program / instruction is executed by a processor, the steps of the above-mentioned configuration import method are implemented, or the steps of the above-mentioned configuration import method are implemented.

[0288] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the server disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0289] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0290] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0291] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms include, include or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0292] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A configuration import method, characterized in that: Applicable to the server to be configured, including: After the configuration page is outputted on the visual interface, a configuration file to be imported is determined in response to a configuration import operation; wherein the configuration file includes an object created by the configured server by comparing the local function, and the object has configuration information of the corresponding local function; Obtaining the configuration file, and parsing the configuration file based on the object notation programming language; Perform legality check on the parsed objects and their configuration information; After the legality check is passed, the corresponding local functions are configured using the parsed objects and the object's configuration information.

2. The method according to claim 1, characterized in that Obtaining the configuration file includes: The front end of the server to be configured turns on the configuration import switch of the message bus system; The backend of the server to be configured detects that the configuration import switch is in the on state, starts the configuration import service, and uses the configuration import service to obtain the configuration file; Accordingly, it also includes: After the configuration import is completed, the configuration import switch of the message bus system is reset.

3. The method according to claim 1, characterized in that After configuring the corresponding local functions using the parsed objects and the configuration information of the objects, it also includes: In response to the configuration rollback operation, determining a historical configuration file to be rolled back; Acquire the historical configuration file, and parse the historical configuration file based on the object notation programming language; The parsed objects and their configuration information are used to roll back the corresponding local functions.

4. The method according to claim 1, characterized in that: After configuring the corresponding local functions using the parsed objects and the configuration information of the objects, it also includes: In response to the configuration comparison operation, determining a first configuration file and a second configuration file to be compared; Obtaining the first configuration file and the second configuration file, and parsing the first configuration file and the second configuration file based on the object notation programming language; The parsed objects and their configuration information are used to perform configuration comparison to obtain configuration difference information.

5. The method according to claim 1, characterized in that Perform validity checks on the parsed objects and their configuration information, including: Perform at least one of structure check, nested structure check, value range check, type check, format check and dependency check on the parsed objects and configuration information; If all the judgment results are passed, it is determined that the legality check has passed; If there is a failure in the judgment result, it is determined that the legality check has failed, an error log is recorded, the configuration is terminated, and the legality verification failure is output; Wherein, the structure verification includes: Determine whether necessary configuration items exist in the object; If yes, it is determined that the structure check has been passed; if no, it is determined that the structure check has not been passed; The nested structure verification includes: Obtaining a nested structure between objects, and determining whether the nested structure matches a preset structure; If yes, it is determined that the nested structure check has been passed; if no, it is determined that the nested structure check has not been passed; The value range check includes: Read the configuration parameters in the configuration information and determine whether the configuration parameters are within the corresponding value range; If yes, it is determined that the value range test is passed; if no, it is determined that the value range test is not passed; The type verification includes: Determine whether the configuration information is consistent with the type of the configuration item; If yes, the type check is passed; if no, it is determined that the type check is not passed; The format verification includes: Use regular expressions to check the string type in the configuration information to determine whether the string format is correct; If yes, it is determined that the format check has been passed; if no, it is determined that the format check has not been passed; The dependency verification includes: Check whether there is a dependency relationship between objects; If yes, it is determined that the dependency check has been passed; if no, it is determined that the dependency check has not been passed.

6. The method according to any one of claims 1 to 5, characterized in that: Also includes: Use several test cases to test the import process and obtain several test results; Summarize several test results and get a test report; The test report is stored in a designated directory, and / or the test report is sent to a designated client.

7. A configuration export method, characterized in that: Applies to configured servers, including: After the configuration page is outputted on the visual interface, the configuration properties of the message bus system are read in response to the configuration export operation to obtain the configuration information; Create corresponding objects for different local functions according to the object notation programming language, and write the configuration information belonging to the object into the object; A configuration file is created in a target directory, and the created object is imported into the configuration file, so that the unconfigured server performs the steps of the configuration import method according to any one of claims 1 to 6.

8. The method according to claim 7, characterized in that Read the configuration properties of the message bus system to obtain configuration information, including: In the case of a failure in reading the target configuration attribute, determining the configuration information corresponding to the target configuration attribute as an output configuration value error; When the target configuration attribute is read successfully, the configuration information corresponding to the target configuration attribute is determined as the read content information.

9. A server, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the configuration import method according to any one of claims 1 to 6, or the steps of the configuration import method according to claim 7 or 8, when executing the computer program.

10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the configuration import method according to any one of claims 1 to 6, or the steps of the configuration import method according to claim 7 or 8 are implemented.

Citation Information

Cited By

  • Configuration processing method and device of substrate management controller

    CN120407042A