Method and application of automated testing of OpenStack cluster stability
By configuring cluster environment files and using the Rally plugin, automated stability testing of OpenStack clusters was achieved, solving the problem of excessive manual intervention in existing technologies and improving testing efficiency and quality.
Patent Information
- Application Number
- CN202111082794.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-15
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-09-15
AI Technical Summary
The lack of a complete automated testing system in existing technologies leads to a significant need for manual intervention in the testing of OpenStack clusters, which increases labor costs and testing risks, and reduces testing efficiency and quality.
By configuring cluster environment files and utilizing Rally's custom plugins and plugin information, automated stability testing of OpenStack clusters can be achieved, including database initialization, configuration detection, execution of stability tests, report generation, and database updates.
It automates OpenStack cluster stability testing, ignores subtle environmental differences, improves testing efficiency and quality, and reduces labor costs.
Smart Images

Figure CN113791941B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing, and in particular to a method and application for automatically testing the stability of an OpenStack cluster. Background Art
[0002] OpenStack is an open source cloud computing platform that aims to provide easy-to-implement, large-scale scalable, and feature-rich solutions for all types of clouds. As an open source cloud operating system, OpenStack is used by many manufacturers to redevelop public cloud, private cloud, and hybrid cloud solutions. It is widely used, but OpenStack currently does not have a complete automated testing system. Although there are many testing tools available, the use of these testing tools requires a lot of manual participation, which greatly increases labor costs and testing risks, while reducing the efficiency and quality of project testing. Although Rally technology can currently test OpenStack in terms of performance, API, etc., the above problems still exist.
[0003] The information disclosed in this background technology section is only intended to enhance the understanding of the overall background of the invention and should not be regarded as an acknowledgment or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the invention
[0004] The purpose of the present invention is to provide a method and application for automatically testing the stability of an OpenStack cluster, which can realize automatic testing of the stability of an OpenStack cluster in different OpenStack environments by configuring a cluster environment file, thereby ignoring subtle differences in the OpenStack cluster environment.
[0005] To achieve the above objective, an embodiment of the present invention provides a method for automatically testing the stability of an OpenStack cluster.
[0006] In one or more embodiments of the present invention, the method includes: presetting a plug-in according to a cluster environment; configuring a cluster environment file, wherein the cluster environment file includes: external component information, task information and the plug-in information; and performing a stability test.
[0007] In one or more embodiments of the present invention, before executing the stability test, it also includes: initializing a database, wherein the database includes: a task information table and a deployment information table; detecting whether the configuration of the cluster environment file is normal; if so, executing the stability test.
[0008] In one or more embodiments of the present invention, the executing stability test specifically includes: the test case of the plug-in issues a task request to start the stability test.
[0009] In one or more embodiments of the present invention, after the stability test is completed, the method further includes: verifying the result of the stability test, generating a corresponding stability test report, and counting the number of error records of the task.
[0010] In one or more embodiments of the present invention, after generating the corresponding stability test report, the method further includes: updating the database, and writing the ID of the task and the ID of the stability test report into the task information table.
[0011] In one or more embodiments of the present invention, the method further includes: accumulating the number of error records for each task to obtain a total number of errors; determining whether the total number of errors exceeds an upper limit of the configured external component information; if not, rechecking whether the configuration of the cluster environment file is normal.
[0012] In another aspect of the present invention, a device for automatically testing the stability of an OpenStack cluster is provided, which includes a configuration module and a test module.
[0013] The configuration module is used to pre-set the plug-in according to the cluster environment; and configure the cluster environment file, wherein the cluster environment file includes: external component information, task information and the plug-in information.
[0014] The test module is used to perform stability testing.
[0015] In one or more embodiments of the present invention, the configuration module is also used to: initialize the database before executing the stability test, wherein the database includes: a task information table and a deployment information table; detect whether the configuration of the cluster environment file is normal; if so, perform the stability test.
[0016] In one or more embodiments of the present invention, the test module is further configured to: the test case of the plug-in issues a task request to start the stability test.
[0017] In one or more embodiments of the present invention, the test module is also used for: after the stability test is completed, the method further includes: verifying the results of the stability test, generating a corresponding stability test report, and counting the number of error records of the task.
[0018] In one or more embodiments of the present invention, the configuration module is further used to: after generating the corresponding stability test report, it also includes: updating the database and writing the ID of the task and the ID of the stability test report into the task information table.
[0019] In one or more embodiments of the present invention, the configuration module is also used to: accumulate the number of error records for each task to obtain a total number of errors; determine whether the total number of errors exceeds the upper limit of the configured external component information; if not, recheck whether the configuration of the cluster environment file is normal.
[0020] In another aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory, wherein the memory stores instructions, and when the instructions are executed by the at least one processor, the at least one processor executes the method for automatically testing the stability of an OpenStack cluster as described above.
[0021] In another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for automatically testing the stability of an OpenStack cluster are implemented.
[0022] Compared with the prior art, the method and application for automated testing of the stability of an OpenStack cluster according to the embodiments of the present invention can further encapsulate the stability test of OpenStack and make the testing process transparent. For different OpenStack environments, it is only necessary to adjust the relevant configurations to achieve automated testing of the stability of the OpenStack cluster. Therefore, the specific implementation of the automated test is no longer important, and the slight differences in the OpenStack cluster environments can also be ignored, thereby achieving automation of the stability test of the OpenStack cluster. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a flow chart of a method for automatically testing the stability of an OpenStack cluster according to an embodiment of the present invention;
[0024] Figure 2 is an extended flow chart of a method for automatically testing the stability of an OpenStack cluster according to an embodiment of the present invention;
[0025] Figure 3 is a structural diagram of an apparatus for automatically testing the stability of an OpenStack cluster according to an embodiment of the present invention;
[0026] Figure 4The figure is a hardware structure diagram of a computing device for automatically testing the stability of an OpenStack cluster according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific implementation modes.
[0028] Unless explicitly stated otherwise, throughout the specification and claims, the term “comprise” or variations such as “include” or “comprising”, etc., will be understood to include the stated elements or components but not to exclude other elements or components.
[0029] The technical solutions provided by various embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0030] Example 1
[0031] like Figure 1 As shown, a method for automatically testing the stability of an OpenStack cluster in an embodiment of the present invention is introduced, and the method includes the following steps.
[0032] In step S101, a plug-in is pre-set according to the cluster environment.
[0033] Pre-configured plugins are used to configure preset conditions for OpenStack cluster testing. For example, you can add custom plugins for Rally to adapt to different OpenStack environments.
[0034] As an independent project of OpenStack, Rally can test the performance and scale of cloud environments by simulating stress tests in high-concurrency scenarios. Rally can test the cloud environment that has been deployed, and also supports the deployment of cloud environments, providing its own deployment engine. Rally can automatically install and run the tempest test cloud environment, and generate HTML format report documents for the Rally test results. Rally's database is used to store test results.
[0035] In step S102, a cluster environment file is configured.
[0036] To configure the cluster environment file, you need to configure the setting.conf file (i.e., task information) and the stable.json file (i.e., external component information and plug-in information) according to different OpenStack environment information and specific stability test requirements.
[0037] Task information includes the waiting time or timeout of requests and responses, and the configuration information of each component. For example, the image required by nova to create a virtual machine, the storage type and size of volume and glance, and other configuration information. External component information includes configuration information such as execution time, number of concurrent executions, and error handling mechanism.
[0038] In step S103, a stability test is performed.
[0039] After the cluster environment file configuration is completed, execute the Rally part, that is, execute the automated script to perform stability testing.
[0040] By configuring the cluster environment file, you can automatically test the stability of the OpenStack cluster in different OpenStack environments without manually creating preset resources in the environment. This way, you can ignore the subtle differences in the OpenStack cluster environment.
[0041] Example 2
[0042] like Figure 2 As shown, a method for automatically testing the stability of an OpenStack cluster in another embodiment of the present invention is introduced, and the method includes the following steps.
[0043] In step S201, a plug-in is pre-set according to the cluster environment.
[0044] Pre-configured plugins are used to configure preset conditions for OpenStack cluster testing. For example, you can add custom plugins for Rally to adapt to different OpenStack environments.
[0045] As an independent project of OpenStack, Rally can test the performance and scale of cloud environments by simulating stress tests in high-concurrency scenarios. Rally can test the cloud environment that has been deployed, and also supports the deployment of cloud environments, providing its own deployment engine. Rally can automatically install and run the tempest test cloud environment, and generate HTML format report documents for the Rally test results. Rally's database is used to store test results.
[0046] In step S202, a cluster environment file is configured.
[0047] To configure the cluster environment file, you need to configure the setting.conf file (i.e., task information) and the stable.json file (i.e., external component information and plug-in information) according to different OpenStack environment information and specific stability test requirements.
[0048] Task information includes the waiting time or timeout of requests and responses, and the configuration information of each component. For example, the image required by nova to create a virtual machine, the storage type and size of volume and glance, and other configuration information. External component information includes configuration information such as execution time, number of concurrent executions, and error handling mechanism.
[0049] In step S203, the database is initialized and the configuration of the cluster environment file is checked to see if it is normal.
[0050] The database includes a task information table and a deployment information table. The deployment information table is used to associate the current OpenStack environment, and the task information table is used to record the ID of each task and its associated report ID.
[0051] The cluster environment files include external component information, task information, and plug-ins.
[0052] Detect the configuration of the external component. In this embodiment, the configuration of the external component is the configuration for the entire automated process. For example, the external component may include configuration information such as execution time, concurrent execution number, and error handling mechanism. If the configuration of the external component triggers the critical value, that is, the external component configuration is triggered, the automated testing task will end.
[0053] Check the configuration of task information. The configuration of task information is for a single task. In the process of automated testing, the number of tasks is not specifically limited. For example, task information can be the image required for nova to create a virtual machine, the waiting or timeout time for requests and responses, and the storage type and size of volume or glance. If the task information configuration is abnormal, the task is triggered to end and the configuration information of the current task is read.
[0054] Check whether the configuration of the plug-in is normal. If an abnormal plug-in is detected, the trigger ends; if the plug-in is detected to be normal, all plug-ins are loaded.
[0055] In step S204, the test case of the plug-in sends a task request to start the stability test.
[0056] According to the test case of the plug-in, the Client API is called to request the OpenStack service. After the API request is issued, the query process will be started to poll the results. In this embodiment, the client called is the client that comes with Rally, not the client of the OpenStack environment.
[0057] In step S205, the result of the stability test is verified, a corresponding stability test report is generated, and the number of error records of the task is counted.
[0058] If the test fails or there is still no response after the timeout period configured for the task is reached, the task request is abnormal. If an exception occurs during the execution of a single task, the task ends. Verify based on the results of the above polling and generate a stability test report for this task.
[0059] In step S206, the database is updated, and the ID of the task and the ID of the stability test report are written into the task information table.
[0060] After the task report is generated, the database will be updated. In this embodiment, the task information table in the database is updated, and a task record is inserted, namely the ID of this task and the ID of the stability test report of this task.
[0061] In step S207, the number of error records for each task is accumulated to obtain the total number of errors.
[0062] After each task is completed, the log of this task is counted, and the number of error records of this task is recorded in the log to accumulate the total number of errors. When the total number of errors reaches the preset value, the external end mechanism will be triggered, that is, the configuration of the external component triggers the critical value, the external component configuration triggers the end, and the stability test ends.
[0063] In step S208, it is determined whether the total number of errors exceeds the upper limit of the configured external component information.
[0064] Determine whether the total number of errors exceeds the upper limit of the configured external component information after the current task is completed. If the total number of errors reaches the upper limit of the external configuration, the end mechanism is triggered. If the total number of errors does not reach the upper limit of the external configuration, this task ends normally, and re-checks whether the configuration of the cluster environment file is normal, and performs the stability test of the next task.
[0065] by Figure 2For example, adjust the plug-in according to the cluster environment. Since the stability test is for the life cycle of the virtual machine, only the plug-in related to the virtual machine needs to be loaded. The test cases include creating a virtual machine, mounting a network card, unmounting a network card, mounting a disk, unmounting a disk, powering on and off, restarting, and deleting. Configure the configuration files of task information and external component information according to the requirements of the stability test. Since the external component information is for the entire stability test service, it is necessary to configure the relevant information of each component of the OpenStack cluster, such as the waiting time for nova to create a virtual machine request and response, the storage type used, the image ID, the template ID, and the host used; the task information is for a single task and plug-in, and the execution strategy, time, and concurrency of the task are configured. After the configuration is completed and there is no abnormality in the configuration information, the automated test service is started. The automated test service performs stability tests according to the configured test cases, execution time, and concurrency. The specific configuration information is as follows: concurrency 20, that is, 20 concurrent processes; stop-in-hours 168, that is, continuously execute the above virtual machine life cycle test process for 7*24 hours to verify the stability of the cluster. After the stability test is completed, a corresponding report is generated and the database is updated, and the stability test of the next task is carried out until all task tests are completed or the total number of errors reaches the upper limit, and the stability test is ended.
[0066] like Figure 3 As shown, a device for automatically testing the stability of an OpenStack cluster according to a specific embodiment of the present invention is introduced.
[0067] In an embodiment of the present invention, the apparatus for automatically testing the stability of an OpenStack cluster includes a configuration module 301 and a testing module 302 .
[0068] The configuration module 301 is used to pre-set the plug-in according to the cluster environment; and configure the cluster environment file, wherein the cluster environment file includes: external component information, task information and plug-in information.
[0069] The testing module 302 is used to perform stability testing.
[0070] The configuration module 301 is also used to: before executing the stability test, initialize the database, wherein the database includes: a task information table and a deployment information table; detect whether the configuration of the cluster environment file is normal; if so, execute the stability test.
[0071] The testing module 302 is also used for: the test case of the plug-in sends a task request to start the stability test.
[0072] The test module 302 is also used to: after the stability test is completed, verify the results of the stability test, generate a corresponding stability test report, and count the number of error records of the task.
[0073] The configuration module 301 is also used to: after generating the corresponding stability test report, update the database and write the ID of the task and the ID of the stability test report into the task information table.
[0074] The configuration module 301 is also used to: accumulate the number of error records of each task to obtain the total number of errors; determine whether the total number of errors exceeds the upper limit of the configured external component information; if not, re-check whether the configuration of the cluster environment file is normal.
[0075] Figure 4 FIG. 4 shows a hardware structure diagram of a computing device 40 for automatically testing the stability of an OpenStack cluster according to an embodiment of the present specification. Figure 4 As shown, the computing device 40 may include at least one processor 401, a memory 402 (e.g., a non-volatile memory), a memory 403, and a communication interface 404, and the at least one processor 401, the memory 402, the memory 403, and the communication interface 404 are connected together via a bus 405. At least one processor 401 executes at least one computer-readable instruction stored or encoded in the memory 402.
[0076] It should be understood that the computer executable instructions stored in the memory 402, when executed, cause at least one processor 401 to perform the above combined operations in various embodiments of the present specification. Figure 1-4 Describes the various operations and functions.
[0077] In the embodiments of the present specification, the computing device 40 may include, but is not limited to, a personal computer, a server computer, a workstation, a desktop computer, a laptop computer, a notebook computer, a mobile computing device, a smart phone, a tablet computer, a cellular phone, a personal digital assistant (PDA), a handheld device, a messaging device, a wearable computing device, a consumer electronic device, and the like.
[0078] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in the form of software), which, when executed by a machine, causes the machine to perform the above-mentioned combination of various embodiments of this specification. Figure 1-4 Specifically, a system or device equipped with a readable storage medium may be provided, on which a software program code implementing the functions of any of the above-mentioned embodiments is stored, and a computer or processor of the system or device reads and executes the instructions stored in the readable storage medium.
[0079] According to the method and application of automated testing of OpenStack cluster stability in the embodiments of the present invention, the stability test of OpenStack can be further encapsulated to make the testing process transparent. For different OpenStack environments, it is only necessary to adjust the relevant configurations to achieve automated testing of the stability of the OpenStack cluster. Therefore, the specific implementation of the automated test is no longer important, and the slight differences in the OpenStack cluster environments can also be ignored, thereby achieving automation of the stability test of the OpenStack cluster.
[0080] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0081] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0082] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0083] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps for the functions specified in one or more boxes.
[0084] The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and it is clear that many changes and variations can be made based on the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different selections and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.
Claims
1. A method for automatically testing the stability of an OpenStack cluster, characterized in that: The following steps are involved: Pre-set the Rally plugin according to the cluster environment; Configure the cluster environment file, wherein the cluster environment file includes: external component information, task information and plug-in information. The external component information includes execution time, number of concurrent executions, and error handling mechanism. The task information includes request and response waiting time, timeout time, image required by nova to create a virtual machine, storage type and size of volume and glance; Initialize a database, the database including a task information table and a deployment information table, the deployment information table is used to associate with the current OpenStack environment, and the task information table is used to record the ID of each task and its associated report ID; According to the test case of the Rally plug-in, call the Client API of the Rally plug-in to request the OpenStack service, issue a task request, and start the stability test; Verify the results of the stability test, generate a corresponding stability test report, and count the number of error records of the task; Update the database and write the task ID and stability test report ID into the task information table; The number of error records for each task is accumulated to get the total number of errors. If the total number of errors reaches the upper limit of the external configuration, the termination mechanism is triggered. If the total number of errors does not reach the upper limit of the external configuration, after the task is completed normally, recheck whether the configuration of the cluster environment file is normal, and perform the stability test of the next task.
2. A device for automatically testing the stability of an OpenStack cluster, characterized in that: The device comprises: A configuration module is used to pre-set the Rally plug-in according to the cluster environment; and configure the cluster environment file, wherein the cluster environment file includes: external component information, task information and plug-in information, the external component information includes execution time, number of concurrent executions, and error handling mechanism, the task information includes the waiting time for request and response, timeout time, the image required for nova to create a virtual machine, and the storage type and size of volume and glance; and is used to initialize the database, the database includes a task information table and a deployment information table, the deployment information table is used to associate the current OpenStack environment, and the task information table is used to record the ID of each task and its associated report ID; The test module is used to call the Client API of the Rally plug-in according to the test case of the Rally plug-in, request the OpenStack service, issue a task request, start the stability test, verify the result of the stability test, generate the corresponding stability test report, and count the number of error records of the task; The configuration module is also used to update the database, write the task ID and the stability test report ID into the task information table, and accumulate the number of error records for each task to obtain the total number of errors; If the total number of errors reaches the upper limit of the external configuration, the termination mechanism is triggered; if the total number of errors does not reach the upper limit of the external configuration, after the current task is completed normally, the configuration of the cluster environment file is rechecked to see if it is normal, and the stability test of the next task is performed.
3. An electronic device, characterized in that: include: at least one processor; as well as A memory storing instructions, wherein when the instructions are executed by the at least one processor, the at least one processor executes the method for automatically testing the stability of an OpenStack cluster as claimed in claim 1.
4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for automatically testing the stability of an OpenStack cluster as claimed in claim 1 are implemented.
