Cloud host cleaning method and device, electronic equipment and readable storage medium

By generating and executing interactive commands in a directed graph, the cloud server cleanup process is automated, solving the problem of low efficiency in cloud server cleanup and improving testing efficiency.

CN116225903BActive Publication Date: 2026-01-23CHINA TELECOM CLOUD TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211712280.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-01-23
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

The low efficiency of cloud server cleanup leads to reduced testing efficiency, especially when multiple cloud servers need to be cleaned up. Testers have to repeatedly enter passwords and confirmations, which is time-consuming and labor-intensive.

Method used

By traversing the directed graph of cloud hosts, commands for interacting with terminal devices are generated and added to the initial script to form a cloud host cleanup script, which automatically executes confirmation items and reduces manual intervention.

Benefits of technology

It improves the efficiency of cloud server cleanup, reduces the number of steps required for testers, and enhances testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225903B_ABST
    Figure CN116225903B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a cloud host cleaning method and device, electronic equipment and readable storage medium, the method comprises: traversing the directed graph of the cloud host, determining the current vertex of the directed graph, wherein the directed graph comprises a plurality of vertices, and the vertices have corresponding tuple information respectively; generating a command for interacting with a terminal device according to the tuple information of the vertex; adding the command for interacting with the terminal device to a preset initial script to obtain a cloud host cleaning script; and cleaning the cloud host according to the cloud host cleaning script. Embodiments of the present application improve the cleaning efficiency of the cloud host, thereby improving the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of cloud computing testing, in particular to a cloud host cleaning method, a cloud host cleaning device, an electronic device and a computer readable storage medium. BACKGROUND

[0002] In the field of cloud computing, a tester opens a cloud host on a test environment provided by a host machine, so as to perform requirement testing by using the opened cloud host. After the tester completes testing of a requirement, the tester needs to clean the opened cloud host in time, otherwise, the resources on the host machine will be occupied, resulting in that the cloud host cannot be normally opened when there is other requirement testing.

[0003] In actual application, a developer provides a script service to clean the cloud host in order to protect the data security of a user and facilitate online operation and maintenance. When the script service is triggered to clean a single cloud host, the tester needs to input a password and a confirmation item (for example, Y (yes) or N (no)) in a terminal device to interact with the terminal device. Although the script service has improved the cleaning efficiency of the cloud host to a certain extent, when there are many cloud hosts to be cleaned, it is time-consuming to execute the script service. Therefore, the tester still needs to repeatedly perform the interactive process of inputting the password and the confirmation item, resulting in that the tester has low cleaning efficiency of the cloud host, and further resulting in that the testing efficiency is reduced. SUMMARY

[0004] Embodiments of the present application provide a cloud host cleaning method, device, electronic device and computer readable storage medium to solve the problem of low cleaning efficiency of the cloud host.

[0005] Embodiments of the present application disclose a cloud host cleaning method, comprising:

[0006] traversing a directed graph of a cloud host to determine a current vertex of the directed graph; wherein the directed graph comprises a plurality of vertices, and the vertices respectively have corresponding tuple information;

[0007] generating a command for interacting with a terminal device according to the tuple information of the vertex;

[0008] adding the command for interacting with the terminal device to a preset initial script to obtain a cleaning cloud host script;

[0009] cleaning the cloud host according to the cleaning cloud host script.

[0010] Optionally, the tuple information comprises a vertex name of the vertex, a command description for interacting with the terminal device, a response description corresponding to the command description, a unique identifier and a unique identifier of an out-degree vertex of the vertex.

[0011] Optionally, the generating the command for interacting with the terminal device according to the tuple information of the vertex comprises:

[0012] When the out-degree of the current vertex in the directed graph is greater than or equal to a specified value, determining the out-degree vertex of the current vertex according to the unique identifier of the out-degree vertex in the tuple information of the current vertex;

[0013] generating the command for interacting with the terminal device according to the command description and the response description corresponding to the command description in the tuple information of the out-degree vertex of the current vertex, and returning to the step of determining the current vertex of the directed graph of the cloud host.

[0014] Optionally, the generating the command for interacting with the terminal device according to the tuple information of the vertex comprises:

[0015] When the out-degree of the current vertex in the directed graph is less than a specified value, stopping the step of traversing the directed graph of the cloud host.

[0016] Optionally, before the cleaning the cloud host according to the cleaning cloud host script, the method further comprises:

[0017] providing a visual interface for a user of the terminal device; wherein the content displayed in the visual interface comprises cloud host information of the cloud host.

[0018] Optionally, the cleaning the cloud host according to the cleaning cloud host script comprises:

[0019] When receiving a cleaning request submitted through the visual interface, determining a target cloud host corresponding to the cleaning request; wherein the target cloud host is one or more.

[0020] calling the cleaning cloud host script to clean the target cloud host.

[0021] Optionally, the cloud host information at least comprises a resource pool, a cloud host name, a cloud host uuid and a creator of the resource pool.

[0022] Embodiments of the application also disclose a cloud host cleaning device, comprising:

[0023] a directed graph traversal module, configured to traverse a directed graph of a cloud host and determine a current vertex of the directed graph; wherein the directed graph comprises a plurality of vertices, and the vertices respectively have corresponding tuple information;

[0024] a command generation module, configured to generate a command for interacting with a terminal device according to the tuple information of the vertex;

[0025] The command adding module is configured to add the command for interacting with the terminal device to a preset initial script to obtain a cleaning cloud host script.

[0026] The cloud host cleaning module is configured to clean the cloud host according to the cleaning cloud host script.

[0027] Optionally, the tuple information comprises a vertex name of the vertex, a command description for interacting with a terminal device, a response description corresponding to the command description, a unique identifier, and a unique identifier of an out-degree vertex of the vertex.

[0028] Optionally, the command generating module is specifically configured to:

[0029] When the out-degree of the current vertex in the directed graph is greater than or equal to a specified value, the out-degree vertex of the current vertex is determined according to the unique identifier of the out-degree vertex in the tuple information of the current vertex.

[0030] The command for interacting with the terminal device is generated according to the command description for interacting with the terminal device and the response description corresponding to the command description in the tuple information of the out-degree vertex of the current vertex, and the step of executing the directed graph for cleaning the cloud host to determine the current vertex of the directed graph is returned.

[0031] Optionally, the command generating module is specifically configured to:

[0032] When the out-degree of the current vertex in the directed graph is less than a specified value, the execution of the directed graph for cleaning the cloud host is stopped.

[0033] Optionally, the apparatus further comprises a visual interface providing module configured to:

[0034] provide a visual interface for a user of the terminal device; wherein the content displayed in the visual interface comprises cloud host information of the cloud host.

[0035] Optionally, the cloud host cleaning module is specifically configured to:

[0036] When a cleaning request submitted through the visual interface is received, a target cloud host corresponding to the cleaning request is determined; wherein the target cloud host is one or more.

[0037] The cleaning cloud host script is called to clean the target cloud host.

[0038] Optionally, the cloud host information at least comprises a resource pool, a cloud host name, a cloud host uuid, and a creator of the resource pool.

[0039] The embodiment of the present application further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus.

[0040] The memory is used for storing a computer program.

[0041] The processor is used for executing the program stored on the memory, and realizes the method as described in the embodiment of the present application.

[0042] The embodiment of the present application further discloses a computer program product stored in a storage medium, and the computer program product is executed by at least one processor to realize the method as described in the embodiment of the present application.

[0043] The embodiment of the present application further discloses a computer readable storage medium, and instructions are stored on the computer readable storage medium, and when executed by one or more processors, the instructions make the processors execute the method as described in the embodiment of the present application.

[0044] The embodiment of the present application has the following advantages:

[0045] In the embodiment of the present application, the directed graph of the cloud host is traversed to determine the current vertex of the directed graph, wherein the directed graph comprises a plurality of vertices, and the vertices respectively have corresponding tuple information, then the command for interacting with the terminal device can be generated according to the tuple information of the vertex, and the command for interacting with the terminal device is added to the initial script to obtain the cleaning cloud host script, and then the cloud host can be cleaned according to the cleaning cloud host script. The embodiment of the present application can generate the command for interacting with the terminal device according to the tuple information of the vertex of the directed graph of the cloud host, and the command for interacting with the terminal device is the command for the confirmation item, after being added to the cleaning cloud host script, the command for interacting with the terminal device can be executed by executing the cleaning cloud host script, and then the confirmation of the confirmation item is completed. Since the test personnel do not need to confirm the confirmation items one by one, the cleaning efficiency of the cloud host is improved, and then the test efficiency is improved. BRIEF DESCRIPTION OF DRAWINGS

[0046] Figure 1 It is a schematic diagram of a script service execution process and a terminal device interaction flow provided in the embodiment of the present application;

[0047] Figure 2 It is a step flowchart of a cloud host cleaning method provided in the embodiment of the present application;

[0048] Figure 3 It is a schematic diagram of a directed graph provided in the embodiment of the present application;

[0049] Figure 4is a structural block diagram of a cloud host cleaning device provided in an embodiment of the present application.

[0050] Figure 5 is a hardware structure schematic diagram of an electronic device for implementing various embodiments of the present application. DETAILED DESCRIPTION

[0051] In order to make the above-mentioned objects, features and advantages of the present application more apparent, further detailed description of the present application will be given below with reference to the accompanying drawings and specific embodiments.

[0052] A cloud host, also known as a cloud server or a virtual machine (Virtual Machine), refers to a complete computer system simulated by software, having complete hardware system functions, and running in a completely isolated environment. In the field of cloud computing, a cloud host is one of the basic units of a cloud computing server provided by a cloud service provider for tenants.

[0053] The following describes the process of cleaning a cloud host through a script service by using a specific example. The test personnel log into a docker container of the script service, switch environment variables, and execute a python manage.py cleanres--uuid command to clean a single cloud host, where uuid (universally unique identifier) is the uuid of the cloud host. The script service execution process needs to interact with the terminal, and the specific Figure 1 As shown, in the process of interacting with the terminal device, in addition to entering a password to ensure data security, the test personnel also need to constantly confirm some confirmation items (for example, "No unsubscribing destruction work order found, do you want to destroy? (Y / N): Y", "Do you want to record the cleaning log? (Y / N): Y", "Do you want to clean? (Y / N): Y", and the like) in the script service execution process. It can be understood that since these confirmation items are submitted to the test personnel one by one through the script service, when the script service is applied to the online as an operation and maintenance tool, it can better protect user data. However, when applied to a test environment, since the existing cloud hosts can be batch cleaned after completing a round of demand testing, the above-mentioned multiple confirmation items such as "Do you want to record the cleaning log? (Y / N): Y" do not need to be confirmed one by one, so if the script service is continued to be used, it will greatly waste the time of the test personnel, reduce the cleaning efficiency of the cloud host, and further reduce the test efficiency.

[0054] Based on the above, an embodiment of the present application provides a cloud host cleaning method in a test environment provided by a host, which can batch clean cloud hosts, reduce the cleaning time of the cloud hosts, and further improve the test efficiency.

[0055] Referring toFigure 2 , a step flow chart of a cloud host cleaning method provided in an embodiment of the present application is shown, and can specifically include the following steps:

[0056] Step 201, traversing a directed graph of a cloud host to determine a current vertex of the directed graph; wherein the directed graph includes a plurality of vertices, and the vertices respectively have corresponding tuple information;

[0057] Step 202, generating a command for interacting with a terminal device according to the tuple information of the vertex;

[0058] Step 203, adding the command for interacting with the terminal device to a preset initial script to obtain a cleaning cloud host script;

[0059] Step 204, cleaning the cloud host according to the cleaning cloud host script.

[0060] In the above cloud host cleaning method, the directed graph of the cloud host is traversed to determine the current vertex of the directed graph, wherein the directed graph includes a plurality of vertices, and the vertices respectively have corresponding tuple information. Then, the command for interacting with the terminal device can be generated according to the tuple information of the vertex, and the command for interacting with the terminal device is added to the preset initial script to obtain the cleaning cloud host script, and then the cloud host can be cleaned according to the cleaning cloud host script. In the embodiment of the present application, the command for interacting with the terminal device can be generated according to the tuple information of the vertex of the directed graph of the cloud host, and the command for interacting with the terminal device is a command for the confirmation item. After being added to the cleaning cloud host script, the command for interacting with the terminal device can be executed by executing the cleaning cloud host script, and then the confirmation of the confirmation item is completed. Since the test personnel do not need to confirm the confirmation items one by one, the cleaning efficiency of the cloud host is improved, and then the test efficiency is improved.

[0061] Next, the cloud host cleaning method in the present exemplary embodiment will be described in detail.

[0062] In step 201, the directed graph of the cloud host is traversed to determine the current vertex of the directed graph; wherein the directed graph includes a plurality of vertices, and the vertices respectively have corresponding tuple information.

[0063] In the embodiment of the present application, the directed graph is used to represent the interaction process with the terminal device, and the interaction process includes the confirmation items that need to be confirmed by the test personnel, such as the confirmation items of “No unsubscribing destruction work order found, do you want to destroy? (Y / N): Y” and the like. The terminal device can refer to the host of the cloud host, and the cloud host test environment can be provided through the host, and then the cloud host test can be performed based on the cloud host test environment.

[0064] The directed graph includes a plurality of vertices, each of which has its corresponding tuple information. Specifically, the degree of a vertex refers to the number of edges connected to the vertex. For a directed graph, the number of outgoing edges of a vertex is referred to as the out-degree of the vertex, and the number of incoming edges of a vertex is referred to as the in-degree of the vertex. Thus, the out-degree vertex can refer to the vertex corresponding to the degree of the vertex.

[0065] As a specific example, the tuple information of each vertex is represented using a five-tuple, for example:

[0066] label key value id outid

[0067] where label is the vertex name (e.g., password confirmation), key is the key printed on the terminal when interacting with the terminal device (i.e., the command description for interacting with the terminal device, such as "No unsubscribed destroy work order found, do you want to destroy? (Y / N)"), value is the response given when the terminal device appears the key (the response description corresponding to the command description, such as "Y"), id is the unique identifier of the vertex (e.g., 1, 2, 3,...), and outid is the id set of the out-degree vertex of the vertex (e.g., 2). If a vertex has multiple out-degree vertices, the ids of the out-degree vertices in the id set can be separated by a comma or other symbol (e.g., 2, 3). Exemplarily, Figure 1 The script service shown in the terminal device interaction process can be represented using the directed graph shown in Figure 3 .

[0068] In step 202, a command for interacting with the terminal device is generated according to the tuple information of the vertex.

[0069] Optionally, the command for interacting with the terminal device can be an expect command. In an embodiment of the present application, based on the command for interacting with the terminal device, the confirmation of the confirmation item can be completed, for example, "No unsubscribed destroy work order found, do you want to destroy? (Y / N): Y", that is, confirming that the cloud host needs to destroy the work order.

[0070] In an optional embodiment of the present application, the step 202 of generating a command for interacting with the terminal device according to the tuple information of the vertex can include the following steps:

[0071] When the out-degree of the current vertex in the directed graph is greater than or equal to a specified value, the out-degree vertex of the current vertex is determined according to the unique identifier of the out-degree vertex in the tuple information of the current vertex.

[0072] The command for interacting with the terminal device is generated according to the command description for interacting with the terminal device and the response description corresponding to the command description in the tuple information of the out-degree vertex of the current vertex, and the step of executing the directed graph of the cloud host is returned to determine the current vertex of the directed graph.

[0073] In the embodiment of the application, an initialization script is defined, and the initialization script can be an empty string Str.

[0074] As an optional example, the specified value can be 1. In the embodiment of the application, the vertices of the directed graph can be sequentially traversed according to the order of the ids in the tuple information of the vertices (for example, starting from the vertex with an id of 0), the vertices are sequentially confirmed as the current vertices from the directed graph, and the values of the out-degrees of the current vertices are confirmed. If the out-degree of the current vertex is equal to 1, it is indicated that there is only one out-degree vertex after the current vertex in the directed graph, and an explicit expect command can be generated according to the tuple information of the out-degree vertex. Specifically, the expect command is: expect "key" {send "value\r"}, wherein the key is the key value in the tuple information of the out-degree vertex of the current vertex, and the value is the value in the tuple information of the out-degree vertex of the current vertex. Based on the key value and the value in the tuple information, a corresponding expect command can be generated. Then, the next vertex in the directed graph can be continuously traversed, and the process is repeated. If the out-degree of the current vertex is greater than 1, it is indicated that there are two or more out-degree vertices after the current vertex in the directed graph. The expect command can be generated according to the tuple information of all the out-degree vertices of the current vertex. For example, it is assumed that the current vertex has two out-degree vertices. The key value and the value in the tuple information of the two out-degree vertices are obtained, and a corresponding expect command is generated.

[0075] In an optional embodiment of the application, the step 202 of generating the command for interacting with the terminal device according to the tuple information of the vertex can further include the following steps:

[0076] When the out-degree of the current vertex in the directed graph is less than the specified value, the traversal of the directed graph of the cloud host is stopped.

[0077] In the embodiment of the application, if the out-degree of the current vertex is less than 1, it is indicated that there is no out-degree vertex after the current vertex in the directed graph, and the current vertex is the last vertex in the directed graph. Therefore, the traversal of the directed graph can be ended.

[0078] In step 203, the command for interacting with the terminal device is added to the preset initialization script to obtain the cleaning cloud host script.

[0079] In the embodiments of the present application, after the generated expect command, the generated expect command can be appended to the end of the string Str of the initialization script, and when all the expect commands generated based on the directed graph are added to the initialization script, the initialization script can be newly added to obtain a complete interactive cleaning cloud host script. Through the cleaning cloud host script, the input password and the input confirmation item and other interactive processes can be automatically input, i.e., the test personnel do not need to confirm one by one. Exemplarily, the front part of the initialization script added with the expect command is newly added with a default part, and the front part newly added with the default part is mainly the process of entering the docker container, and this part of the interaction is fixed and unchanged. Exemplarily, the front part of the initialization script newly added with the default part can be as follows:

[0080] / usr / bin / expect<<FLAGEOF

[0081] spawn sudo docker exec-it ecs_cloud bash

[0082] set timeout 180

[0083] expect"*@*"{send"source / var / www / ecscloud_web / .venv / bin / activate\r"

[0084] }

[0085] expect"*@*"{send"cd / var / www / ecscloud_web / \r"

[0086] }

[0087] expect"*@*"{send"python manage.py cleanres--uuid${1}\r"}

[0088] In addition, the back part of the initialization script added with the expect command also needs to be newly added with a default part, and the back part newly added with the default part is the syntax of expect and is also fixed. Exemplarily, the back part of the initialization script newly added with the default part can be as follows:

[0089] expect eof

[0090] FLAGEOF

[0091] In the embodiment of the present application, the cleaning cloud host script can be obtained after the initialization script after the default part is newly added, and the cleaning cloud host script can be placed in the server of the ticket service deployment and wait to be called to clean the cloud host.

[0092] In step 204, the cloud host is cleaned according to the cleaning cloud host script.

[0093] In the embodiment of the present application, when the cloud host needs to be cleaned, the cleaning cloud host script can be called from the server to clean the cloud host. When the cloud host to be cleaned is multiple, the cleaning cloud host script can be called to clean the cloud host. It should be noted that, since the cloud host is cleaned by calling the cleaning cloud host script in the embodiment of the present application, the tester does not need to confirm the confirmation items one by one, which improves the cleaning efficiency of the cloud host and further improves the test efficiency.

[0094] In an optional embodiment of the present application, the method can further include the following steps:

[0095] A visual interface is provided for the user of the terminal device, and the content displayed in the visual interface includes cloud host information of the cloud host.

[0096] In the embodiment of the present application, the visual interface can be provided for the user of the terminal device by the cleaning cloud host tool, and the content displayed in the visual interface includes the cloud host information of the cloud host. Specifically, the cloud host information can at least include resource pool, cloud host name, cloud host uuid, resource pool creator and the like.

[0097] In an optional embodiment of the present application, the step 204, cleaning the cloud host according to the cleaning cloud host script, can include:

[0098] When the cleaning request submitted through the visual interface is received, the target cloud host corresponding to the cleaning request is determined, and the target cloud host is one or more.

[0099] The cleaning cloud host script is called to clean the target cloud host.

[0100] In practical application, the cloud host script can be used to clean up cloud hosts in batch, for example, to clean up all cloud hosts in a certain host, but actually some cloud hosts in the host need to be reserved. Therefore, in the embodiment of the present application, the user of the terminal device can filter out the cloud hosts to be cleaned up through the visual interface. Specifically, the user of the terminal device can set the filtering condition through the visual interface, and then the cloud hosts to be cleaned up in the host can be filtered according to the filtering condition. As an optional example, the cloud host information of the cloud host is displayed in the visual interface in the form of a list, the list displays resource pool, cloud host name, cloud host uuid, creator and the like, and the user of the terminal device can set the filtering condition according to the cloud host information. The data of the cloud host information of the cloud host is derived from the test environment database table.

[0101] In order for those skilled in the art to better understand the embodiments of the present application, the following is described with one specific example.

[0102] Input: directed graph using five-tuple;

[0103] Output: command (expect command) interacting with the terminal device;

[0104] Start traversing the directed graph from the node with id 0, and define the initial script as an empty string Str. The steps for specifically generating the expect script (cleaning up cloud host script) include:

[0105] Step 1: Determine the number of out-degree vertices of the current vertex. If the number of out-degree vertices of the current vertex is equal to 1, execute Step 2; if the number of out-degree vertices of the current vertex is less than 1, terminate and return Str; if the number of out-degree vertices of the current vertex is greater than 1, execute Step 3.

[0106] Step 2: Generate an explicit expect command.

[0107] The expect command is: expect "key" {send "value\r"}, wherein key is the key value in the tuple information of the out-degree vertex of the current vertex in Step 1, and value is the value in the tuple information of the out-degree vertex of the current vertex in Step 1. Then, the generated expect command can be appended to the end of the string Str, and returned to Step 1.

[0108] Step 3: Loop through all out-degree vertices of the current vertex in Step 1, and sequentially append the expect command:

[0109] set key

[0110] expect{

[0111] "key1" {send "value1\r" ; key=key1}

[0112] "key2" {send "value2\r" ; key=key2} ...

[0114] }

[0115] wherein, the key1 is a key value in the tuple information of the first out-degree vertex of the current vertex in Step 1, the value1 is a value in the tuple information of the first out-degree vertex of the current vertex in Step 1, the key2 is a key value in the tuple information of the second out-degree vertex of the current vertex in Step 1, the value2 is a value in the tuple information of the second out-degree vertex of the current vertex in Step 1, and so on. Then, the generated expect command can be appended to the end of the string Str.

[0116] Step 4: loop through all out-degree vertices of Step 2, and determine which vertex of the directed graph to go to according to the key matched in Step 3.

[0117] For example, if {key==key1}, the expect command is appended to the end of the string Str, and then the number of out-degree vertices of the vertex where key1 is located is determined; if the number of out-degree vertices of the vertex where key1 is located is equal to 1, Step 2 is executed, if the number of out-degree vertices of the vertex where key1 is located is less than 1, it is terminated and the string Str is returned; if the number of out-degree vertices of the vertex where key1 is located is greater than 1, Step 3 is executed.

[0118] For example, according to the above steps, for the interaction process with the terminal device Figure 1 , the directed graph corresponding to the interaction process can be as shown in Figure 3 , and correspondingly, the expect script generated for the directed graph described in Figure 3 is as follows:

[0119]

[0120]

[0121] The application has at least the following advantages: 1. The directed graph using the tuple information is used to represent the part needing interaction with the terminal device when the test environment cloud host is manually cleaned up, and the tuple information in the directed graph can be read to be accepted by people faster and better, and the interaction process can be more intuitive and clear; 2. An algorithm for automatically converting the interaction process with the terminal device in the directed graph into an expect command automatic interaction script is proposed, and can be applied to various directed graphs representing terminal device interaction; 3. A tool for cleaning up the test environment cloud host in batches is proposed, which is more efficient than cleaning up the cloud host one by one by manual work, saves test time, and improves test efficiency.

[0122] It should be noted that, for the method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the application are not limited by the action sequence described, because according to the embodiments of the application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the embodiments of the application.

[0123] Referring to Figure 4 , a structure block diagram of a cloud host cleaning device provided in the embodiments of the application is shown, which can specifically include the following modules:

[0124] The directed graph traversal module 401 is configured to traverse a directed graph of a cloud host, and determine a current vertex of the directed graph; wherein the directed graph includes a plurality of vertices, and the vertices have corresponding tuple information respectively;

[0125] The command generation module 402 is configured to generate a command for interaction with a terminal device according to the tuple information of the vertex;

[0126] The command adding module 403 is configured to add the command for interaction with the terminal device to a preset initial script to obtain a cloud host cleaning script;

[0127] The cloud host cleaning module 404 is configured to clean the cloud host according to the cloud host cleaning script.

[0128] In an optional embodiment of the application, the tuple information includes a vertex name of the vertex, a command description for interaction with the terminal device, a response description corresponding to the command description, a unique identifier, and a unique identifier of an out-degree vertex of the vertex.

[0129] In an optional embodiment of the application, the command generation module is specifically configured to:

[0130] When the current vertex has an out-degree greater than or equal to a specified value in the directed graph, determine the out-degree vertex of the current vertex according to the unique identifier of the out-degree vertex in the tuple information of the current vertex;

[0131] According to the command description for interacting with a terminal device and the response description corresponding to the command description in the tuple information of the out-degree vertex of the current vertex, generate a command for interacting with a terminal device, and return to the step of executing the directed graph of the cloud host to determine the current vertex of the directed graph.

[0132] In an optional embodiment of the present application, the command generation module is specifically configured to:

[0133] When the current vertex has an out-degree less than a specified value in the directed graph, stop executing the directed graph of the cloud host.

[0134] In an optional embodiment of the present application, the device further comprises a visualization interface providing module configured to:

[0135] Provide a visualization interface for a user of a terminal device; wherein the content displayed in the visualization interface comprises cloud host information of a cloud host.

[0136] In an optional embodiment of the present application, the cloud host cleaning module is specifically configured to:

[0137] Upon receiving a cleaning request submitted through the visualization interface, determine a target cloud host corresponding to the cleaning request; wherein the target cloud host is one or more;

[0138] Call the cleaning cloud host script to clean the target cloud host.

[0139] In an optional embodiment of the present application, the cloud host information at least comprises a resource pool, a cloud host name, a cloud host uuid, and a resource pool creator.

[0140] In the embodiment of the present application, the directed graph of the cloud host is traversed to determine a current vertex of the directed graph, wherein the directed graph includes a plurality of vertices, and each vertex has corresponding tuple information; then, a command for interacting with the terminal device can be generated according to the tuple information of the vertex, and the command for interacting with the terminal device is added to a preset initial script to obtain a cleaning cloud host script, and the cloud host can be cleaned according to the cleaning cloud host script. In the embodiment of the present application, the command for interacting with the terminal device can be generated according to the tuple information of the vertex of the directed graph of the cloud host, and the command for interacting with the terminal device is a command for the confirmation item. After being added to the cleaning cloud host script, the command for interacting with the terminal device can be executed by executing the cleaning cloud host script, and the confirmation of the confirmation item is completed. Since the test personnel do not need to confirm the confirmation items one by one, the cleaning efficiency of the cloud host is improved, and the test efficiency is improved.

[0141] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the related parts refer to the part of the method embodiment.

[0142] In addition, the embodiment of the present application also provides an electronic device, which comprises a processor, a memory, a computer program stored in the memory and executable on the processor, and the computer program implements the processes of the cloud host cleaning method embodiments and achieves the same technical effects when executed by the processor. To avoid repetition, this will not be repeated here.

[0143] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program implements the processes of the cloud host cleaning method embodiments and achieves the same technical effects when executed by the processor. To avoid repetition, this will not be repeated here. The computer readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0144] The embodiment of the present application also provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the processes of the cloud host cleaning method embodiments and achieve the same technical effects. To avoid repetition, this will not be repeated here.

[0145] Figure 5 A hardware structure diagram of an electronic device for implementing the embodiments of the present application.

[0146] The electronic device 500 includes, but is not limited to, a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and a power supply 511, etc. Those skilled in the art can understand that the electronic device structure shown in the figure is not a limitation on the electronic device, and the electronic device can include more or less components than the figure, or combine certain components, or different component arrangements. In the embodiments of the present application, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle terminal, a wearable device, and a pedometer, etc. Figure 5 The electronic device structure shown in the figure is not a limitation on the electronic device, and the electronic device can include more or less components than the figure, or combine certain components, or different component arrangements. In the embodiments of the present application, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle terminal, a wearable device, and a pedometer, etc.

[0147] It should be understood that in the embodiments of the present application, the radio frequency unit 501 can be used for receiving and transmitting signals in the process of information or call, specifically, receiving downlink data from a base station for the processor 510 to process, and transmitting uplink data to the base station. Generally, the radio frequency unit 501 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 501 can also communicate with the network and other devices through a wireless communication system.

[0148] The electronic device provides wireless broadband Internet access for users through the network module 502, such as helping users to send and receive emails, browse web pages, and access streaming media, etc.

[0149] The audio output unit 503 can convert audio data received by the radio frequency unit 501 or the network module 502 or stored in the memory 509 into an audio signal and output as a sound. Moreover, the audio output unit 503 can also provide audio output related to a specific function performed by the electronic device 500 (for example, a call signal receiving sound, a message receiving sound, etc.). The audio output unit 503 includes a speaker, a buzzer, and a receiver, etc.

[0150] The input unit 504 is configured to receive audio or video signals. The input unit 504 can include a graphics processor (GPU) 5041 and a microphone 5042. The graphics processor 5041 processes image data of a still picture or a video obtained by an image capture device (e.g., a camera) in a video capture mode or an image capture mode. Processed image frames can be displayed on the display unit 506. Processed image frames can be stored in the memory 509 (or other storage medium) or transmitted via the radio frequency unit 501 or the network module 502. The microphone 5042 can receive sound and can process such sound as audio data. Processed audio data can be converted into a format that can be transmitted to a mobile communication base station via the radio frequency unit 501 in a telephone call mode.

[0151] The electronic device 500 further includes at least one sensor 505, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 5061 according to the brightness of ambient light, and the proximity sensor can turn off the display panel 5061 and / or the backlight when the electronic device 500 is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when at rest, and can be used to identify the electronic device posture (such as screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, knock), and the like. The sensor 505 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, which will not be described here.

[0152] The display unit 506 is configured to display information input by a user or information provided to the user. The display unit 506 can include a display panel 5061, which can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0153] The user input unit 507 can be used to receive inputted digital or character information, and to generate key signal input related to user settings of the electronic device and function control. Specifically, the user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071, also called a touch screen, can collect a user's touch operation (such as a user's operation on or near the touch panel 5071 using a finger, a stylus, or any suitable object or accessory) on or near it. The touch panel 5071 can include two parts, a touch detection device and a touch controller. The touch detection device detects the user's touch position and detects a signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch coordinates, and sends it to the processor 510, receives commands from the processor 510 and executes them. In addition, the touch panel 5071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 5071, the user input unit 507 can also include other input devices 5072. Specifically, the other input devices 5072 can include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, on / off buttons, etc.), trackballs, mice, joysticks, and the like, which will not be described here.

[0154] Further, the touch panel 5071 can be overlaid on the display panel 5061, and when the touch panel 5071 detects a touch operation on or near it, it transmits to the processor 510 to determine the type of touch event, and then the processor 510 provides corresponding visual output on the display panel 5061 according to the type of touch event. Although in the Figure 5 In some embodiments, the touch panel 5071 and the display panel 5061 can be integrated to realize the input and output functions of the electronic device, which is not limited here.

[0155] The interface unit 508 is an interface for connecting external devices to the electronic device 500. For example, the external devices can include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and the like. The interface unit 508 can be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the electronic device 500, or can be used to transmit data between the electronic device 500 and external devices.

[0156] The memory 509 can be used to store software programs and various data. The memory 509 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), and the like. In addition, the memory 509 can include a high-speed random access memory, and can also include a nonvolatile memory, for example, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.

[0157] The processor 510 is the control center of the electronic device, connects all parts of the electronic device through various interfaces and lines, executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 509 and calling data stored in the memory 509, and thus monitors the whole electronic device. The processor 510 can include one or more processing units; preferably, the processor 510 can integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the like, and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 510.

[0158] The electronic device 500 can also include a power supply 511 (such as a battery) for supplying power to various components; preferably, the power supply 511 can be logically connected to the processor 510 through a power management system, so as to realize the functions of managing charging, discharging, and power consumption management, and the like through the power management system.

[0159] In addition, the electronic device 500 includes some functional modules that are not shown here and will not be described here.

[0160] It should be noted that, in this document, the term “comprising” or “including” or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article, or device. Without more limitations, the element defined by the statement “including a…” does not exclude the presence of additional identical elements in the process, method, article, or device including the element.

[0161] Those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal (which can be a mobile phone, computer, server, air conditioner, or network device) execute the method described in each embodiment of the present application.

[0162] The embodiments of the present application are described above with reference to the accompanying drawings, but the present application is not limited to the above-mentioned specific embodiments, and the above-mentioned specific embodiments are only illustrative, not restrictive. Those skilled in the art can make many forms without departing from the purpose of the present application and the scope protected by the claims under the inspiration of the present application, which all belong to the protection of the present application.

[0163] Those skilled in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solutions. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0164] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-mentioned system, device and unit can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0165] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0166] The units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0167] In addition, each functional unit in each embodiment of the application can be integrated in one processing unit, or each unit can be physically present alone, or two or more units can be integrated in one unit.

[0168] The functions, if realized in the form of software functional units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the application or the part of the application that contributes to the prior art in essence or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the application. The foregoing storage medium includes various storage media that can store program codes, such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk.

[0169] The above is only a specific embodiment of the application, but the protection scope of the application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the application, which should be covered within the protection scope of the application. Therefore, the protection scope of the application should be subject to the protection scope of the claims.

Claims

1. A method for cleaning up cloud servers, characterized in that, include: Traverse the directed graph of the cloud host to determine the current vertex of the directed graph; wherein, the directed graph includes a number of vertices, each of which has corresponding tuple information; the tuple information of each vertex is represented by a 5-tuple, including the vertex name of the vertex, the command description for interacting with the terminal device, the response description corresponding to the command description, a unique identifier, and the unique identifier of the vertex's out-degree vertex. Generate commands for interaction with the terminal device based on the tuple information of the vertices; Adding the commands that interact with the terminal device to a preset initial script to obtain a cloud host cleanup script includes: appending the generated commands that interact with the terminal device to the end of the string of the initial script; after all the commands that interact with the terminal device generated based on the directed graph have been added to the initial script, adding new elements to the initial script to obtain the cloud host cleanup script; the initial script is an empty string. Clean up the cloud server according to the cloud server cleanup script.

2. The method according to claim 1, characterized in that, The step of generating commands for interaction with the terminal device based on the tuple information of the vertices includes: When the out-degree of the current vertex in the directed graph is greater than or equal to a specified value, the out-degree vertex of the current vertex is determined according to the unique identifier of the out-degree vertex in the tuple information of the current vertex. The process involves generating a command for interacting with the terminal device based on the command description and the corresponding response description in the tuple information of the out-degree vertex of the current vertex, and then returning to execute the step of traversing the directed graph of the cloud host to determine the current vertex of the directed graph.

3. The method according to claim 2, characterized in that, The step of generating commands for interaction with the terminal device based on the tuple information of the vertices includes: When the out-degree of the current vertex in the directed graph is less than a specified value, the traversal of the directed graph of the cloud host is stopped.

4. The method according to claim 1, characterized in that, Before cleaning the cloud server according to the cloud server cleanup script, the method further includes: Provide a visual interface for users of terminal devices; wherein, the content displayed in the visual interface includes cloud host information of the cloud host.

5. The method according to claim 4, characterized in that, The step of cleaning up the cloud server according to the cloud server cleanup script includes: Upon receiving a cleanup request submitted through the visual interface, the target cloud host corresponding to the cleanup request is determined; wherein, the target cloud host may be one or more. The script for cleaning up cloud hosts is invoked to clean up the target cloud host.

6. The method according to claim 4, characterized in that, The cloud host information includes at least the resource pool, cloud host name, cloud host UUID, and the creator of the resource pool.

7. A cloud server cleaning device, characterized in that, include: A directed graph traversal module is used to traverse the directed graph of the cloud host and determine the current vertex of the directed graph; wherein, the directed graph includes a number of vertices, and each vertex has corresponding tuple information; the tuple information includes the vertex name of the vertex, the command description for interaction with the terminal device, the response description corresponding to the command description, a unique identifier, and the unique identifier of the out-degree vertex of the vertex. The command generation module is used to generate commands for interaction with the terminal device based on the tuple information of the vertex; A command addition module is used to add the commands interacting with the terminal device to a preset initial script to obtain a cloud host cleanup script. This includes: appending the generated commands interacting with the terminal device to the end of the string in the initial script; after all the commands interacting with the terminal device generated based on the directed graph have been added to the initial script, adding new elements to the initial script to obtain the cloud host cleanup script; the initial script is an empty string. The cloud server cleanup module is used to clean up the cloud server according to the cloud server cleanup script.

8. The apparatus according to claim 7, characterized in that, The command generation module is specifically used for: When the out-degree of the current vertex in the directed graph is greater than or equal to a specified value, the out-degree vertex of the current vertex is determined according to the unique identifier of the out-degree vertex in the tuple information of the current vertex. The process involves generating a command for interacting with the terminal device based on the command description and the corresponding response description in the tuple information of the out-degree vertex of the current vertex, and then returning to execute the step of traversing the directed graph of the cloud host to determine the current vertex of the directed graph.

9. The apparatus according to claim 8, characterized in that, The command generation module is specifically used for: When the out-degree of the current vertex in the directed graph is less than a specified value, the traversal of the directed graph of the cloud host is stopped.

10. The apparatus according to claim 7, characterized in that, The device further includes a visualization interface providing module for: Provide a visual interface for users of terminal devices; wherein, the content displayed in the visual interface includes cloud host information of the cloud host.

11. The apparatus according to claim 10, characterized in that, The cloud server cleanup module is specifically used for: Upon receiving a cleanup request submitted through the visual interface, the target cloud host corresponding to the cleanup request is determined; wherein, the target cloud host may be one or more. The script for cleaning up cloud hosts is invoked to clean up the target cloud host.

12. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-6.

13. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method and device for generating test script based on flow chart

    CN110825628A