CN116089015A - Method, device, equipment and medium for detecting locking of virtual machine operating system - Google Patents
Method, device, equipment and medium for detecting locking of virtual machine operating system Download PDFInfo
- Publication number
- CN116089015A CN116089015A CN202310113075.XA CN202310113075A CN116089015A CN 116089015 A CN116089015 A CN 116089015A CN 202310113075 A CN202310113075 A CN 202310113075A CN 116089015 A CN116089015 A CN 116089015A
- Authority
- CN
- China
- Prior art keywords
- nova
- virtual machine
- api
- basic information
- database
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 59
- 238000001514 detection method Methods 0.000 claims abstract description 113
- 230000000903 blocking effect Effects 0.000 claims abstract description 22
- 230000004044 response Effects 0.000 claims abstract description 21
- 238000004590 computer program Methods 0.000 claims description 16
- 230000008569 process Effects 0.000 description 11
- 238000004891 communication Methods 0.000 description 6
- 238000012423 maintenance Methods 0.000 description 6
- 230000002159 abnormal effect Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 3
- 238000013461 design Methods 0.000 description 2
- 230000036541 health Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000015556 catabolic process Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 210000001503 joint Anatomy 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45591—Monitoring or debugging support
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a method, a device, equipment and a medium for detecting the blocking of a virtual machine operating system, which relate to the technical field of computers and are applied to nova_computer of a computing node, and comprise the following steps: acquiring an RPC request generated by a nova_api of a control node by using a detection task; the detection task is a task which is acquired through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not; transmitting qga commands generated based on the RPC request to each virtual machine of the computing node in turn; if the response of the virtual machine based on the qga command is not obtained within the preset time, the basic information of the virtual machine is recorded into the database, so that the nova_api can obtain the basic information from the database and send the basic information to the user interface through the second interface after receiving the read request through the newly added second interface in the nova_api. According to the method and the device, the virtual machine with the virtual machine operating system in the blocking state can be detected rapidly, simply and conveniently.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for detecting a virtual machine operating system card.
Background
Currently, for a cloud management platform based on OpenStack, when a virtual machine is built, a storage mode is generally a distributed storage service system, the cloud platform does not directly provide storage capacity, a storage service of a third party is needed to be in butt joint to provide data storage capacity for the virtual machine, the virtual machine performs data read-write operation on the storage service of the rear end in a network mode, for the deployment mode, all data read-write operations of the virtual machine depend on network transmission, when a network responsible for storing the data transmission fails, or when the storage service of the rear end fails, if frequent read-write operations are performed in the virtual machine, the virtual machine operation system is likely to be blocked due to the fact that the virtual machine is in failure, and at the moment, a virtual machine console does not have any output content; in addition, based on the self service consideration, the virtual machine user can install some third-party drivers, or develop the drivers for the virtual machine service by himself, and the virtual machine operating system may be blocked due to the vulnerability or stability problem of the drivers, so that normal service cannot be provided.
After the virtual machine operating system is blocked, the virtual machine cannot respond to the input of a user, and the virtual machine process is in a normal running state from the level of the host machine, so that whether the internal operating system of the virtual machine is in a blocked state cannot be judged by a simple method.
In summary, how to quickly and simply detect a virtual machine in which the virtual machine operating system is in a locked state.
Disclosure of Invention
Accordingly, the present invention is directed to a method, apparatus, device and medium for detecting the locking of a virtual machine operating system, which can quickly and easily detect a virtual machine in which the virtual machine operating system is in a locked state. The specific scheme is as follows:
in a first aspect, the application discloses a method for detecting the blocking of an operating system of a virtual machine, which is applied to nova_computer of a computing node, and includes:
acquiring an RPC request generated by a nova_api of a control node by using a detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not;
generating qga commands based on the RPC requests and sending the qga commands to each virtual machine of the computing node in turn;
If the response, generated by the virtual machine based on the qga command, indicating that the operating system of the virtual machine is not blocked is not obtained within the preset time, recording basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api can obtain the basic information from the database and send the basic information to the user interface through the second interface after receiving a reading request from the user interface through the newly added second interface in the nova_api.
Optionally, the recording the basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api obtains the basic information from the database and sends the basic information to the user interface through the second interface after receiving a read request from the user interface through the newly added second interface in the nova_api, including:
recording the basic information of the virtual machine to a database corresponding to the nova_api;
after all the virtual machines of the computing nodes are detected, writing the execution completion information of the computing nodes into the database, so that the nova_api receives a reading request from the user interface through a newly added second interface in the nova_api, and when the execution completion information of all the computing nodes in the cloud platform is detected from the database, acquiring the basic information from the database and sending the basic information to the user interface.
Optionally, the recording the basic information of the virtual machine to the database corresponding to the nova_api includes:
recording the basic information of the virtual machine into a detection result record table which is added in advance in a database corresponding to the nova_api;
correspondingly, after all the virtual machines of the computing nodes are detected, writing execution completion information of the computing nodes into the database, so that the nova_api receives a reading request from the user interface through a second interface newly added in the nova_api, and when the execution completion information of all the computing nodes in the cloud platform is detected from the database, acquiring the basic information from the database and sending the basic information to the user interface, wherein the method comprises the following steps:
after all the virtual machines of the computing nodes are detected, recording the execution completion information of the computing nodes into a detection task record which is created in advance in the database, so that a newly added second interface in the nova_api acquires the basic information from the detection result record table and sends the basic information to the user interface after receiving a reading request from the user interface and when the execution completion information of all the computing nodes in the cloud platform is detected from the database; the detection task record is a record created by the nova_api for the detection task in a detection task record table; and the detection task record table is a record table added in advance in the database.
Optionally, the recording the basic information of the virtual machine in a detection result record table added in advance in a database corresponding to the nova_api includes:
recording the basic information of the virtual machine and the task identification corresponding to the detection task into a detection result record table which is added in advance in a database corresponding to the nova_api;
correspondingly, after all the virtual machines of the computing nodes are detected, the execution completion information of the computing nodes is recorded into a detection task record created in advance in the database, so that after a second interface newly added in the nova_api receives a reading request from the user interface, and when the execution completion information of all the computing nodes in the cloud platform is detected from the database, the basic information is obtained from the detection result record table and is sent to the user interface, and the method comprises the following steps:
after all the virtual machines of the computing nodes are detected, recording the execution completion information of the computing nodes and the task identification into a detection task record which is created in advance in the database, so that a newly added second interface in the nova_api acquires the basic information from the detection result record table and sends the basic information to the user interface based on the task identification after the task identification is received from the user interface and when the execution completion information of all the computing nodes in the cloud platform is detected from the database; the task identifier is an identifier created by the nova_api for the detection task.
Optionally, the task identifier is in uuid format.
Optionally, the obtaining the RPC request generated by the nova_api of the control node by using the detection task includes:
and acquiring an RPC request generated by the nova_api sent by the nova_api of the control node by using a detection task through the newly added RPC interface in the nova_computer.
In a second aspect, the application discloses a method for detecting the blocking of a virtual machine operating system, which is applied to a nova_api of a control node, and includes:
acquiring a detection task for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform are blocked or not from a user interface through a newly added first interface in the nova_api;
generating an RPC request based on the detection task, and sending the RPC request to the nova_computer so that the nova_computer generates a qga command based on the RPC request, sequentially sending the qga command to each virtual machine of the computing node corresponding to the nova_computer, and then sending basic information of the virtual machine which does not generate a response based on the qga command to a database corresponding to nova_api; the response is a response indicating that the virtual machine operating system of the virtual machine is not blocked;
And acquiring a reading request from a user interface through a newly added second interface in the nova_api, acquiring the basic information in the database based on the reading request, and then sending the basic information to the user interface through the second interface.
In a third aspect, the present application discloses a device for detecting a blocking of an operating system of a virtual machine, which is applied to a nova_computer of a computing node, and includes:
the RPC request acquisition module is used for acquiring an RPC request generated by a nova_api of the control node by using the detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not;
a command generation module for generating qga commands based on the RPC requests;
a command sending module, configured to send the qga command to each virtual machine of the computing node in sequence;
and the basic information recording module is used for recording the basic information of the virtual machine to a database corresponding to the nova_api if the response, generated by the virtual machine based on the qga command and indicating that the operating system of the virtual machine is not blocked, is not acquired within a preset time, so that the nova_api receives a reading request from the user interface through a newly added second interface in the nova_api, acquires the basic information from the database and sends the basic information to the user interface through the second interface.
In a fourth aspect, the present application discloses an electronic device comprising a processor and a memory; the processor implements the disclosed method for detecting the locking of the operating system of the virtual machine when executing the computer program stored in the memory.
In a fifth aspect, the present application discloses a computer-readable storage medium for storing a computer program; the method for detecting the blocking of the virtual machine operating system is characterized in that the computer program is executed by a processor.
As can be seen, the present application obtains the RPC request generated by the nova_api of the control node using the detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not; generating qga commands based on the RPC requests and sending the qga commands to each virtual machine of the computing node in turn; if the response, generated by the virtual machine based on the qga command, indicating that the operating system of the virtual machine is not blocked is not obtained within the preset time, recording basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api can obtain the basic information from the database and send the basic information to the user interface through the second interface after receiving a reading request from the user interface through the newly added second interface in the nova_api. Therefore, according to the method and the device, whether the operating system of the virtual machine is in the stuck state is presumed by utilizing the qga command which does not depend on the network, so that the stuck state of the operating system of the virtual machine can be detected under the condition that the network of the virtual machine is abnormal; in addition, interfaces are added to the nova_computer deployed at the computing node and the nova_api deployed at the control node, so that the virtual machine with the virtual machine operating system in a stuck state can be detected rapidly and conveniently.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for detecting the locking of a virtual machine operating system provided by the present application;
FIG. 2 is a flowchart of a method for detecting the locking of an operating system of a virtual machine;
FIG. 3 is a schematic flow chart of a virtual machine operating system card lock detection provided in the present application;
FIG. 4 is a detailed flowchart of the detection of the locking of the operating system of the virtual machine provided in the present application;
fig. 5 is a schematic structural diagram of a device for detecting locking of an operating system of a virtual machine provided in the present application;
FIG. 6 is a block diagram of an electronic device provided herein;
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
At present, after the virtual machine operating system is blocked, the virtual machine cannot respond to the input of a user, and the virtual machine process is in a normal running state from the level of the host machine, so that whether the internal operating system of the virtual machine is in a blocked state cannot be judged by a simple method.
In order to overcome the problems, the application provides a virtual machine operating system locking detection scheme which can rapidly, simply and conveniently detect a virtual machine with a virtual machine operating system in a locking state.
Referring to fig. 1, an embodiment of the present application discloses a method for detecting a blocking of an operating system of a virtual machine, which is applied to a nova_computer of a computing node, and includes:
step S11: acquiring an RPC request generated by a nova_api of a control node by using a detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not.
In this embodiment of the present application, the obtaining a RPC (Remote Procedure Call) request generated by a nova_api of a control node by using a detection task includes: and acquiring an RPC request generated by the nova_api sent by the nova_api of the control node by using a detection task through the newly added RPC interface in the nova_computer.
Step S12: a qga command is generated based on the RPC request and the qga command is sent to each virtual machine of the computing node in turn.
In the embodiment of the application, the qemu-ga process running inside the virtual machine is communicated with the outside of the virtual machine without depending on a network, and the communication is performed through the virtual machine virtual serial port device, so that the qemu-ga process can be utilized to detect the locking state of the operating system of the virtual machine under the condition that the network of the virtual machine is abnormal and the virtual machine console is not logged in. According to the method, whether the corresponding virtual machine is in a normal running state is detected by sending the command to the qemu-ga process, if qga command is responded within preset time, the virtual machine is considered to be in the normal running state, and if the command execution is overtime, the virtual machine operating system can be considered to be blocked.
Step S13: if the response, generated by the virtual machine based on the qga command, indicating that the operating system of the virtual machine is not blocked is not obtained within the preset time, recording basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api can obtain the basic information from the database and send the basic information to the user interface through the second interface after receiving a reading request from the user interface through the newly added second interface in the nova_api.
In the embodiment of the application, the basic information can be sent to the user interface in a list form.
In this embodiment of the present application, the recording the basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api obtains the basic information from the database and sends the basic information to the user interface through the second interface after receiving a read request from the user interface through the newly added second interface in the nova_api includes: recording the basic information of the virtual machine to a database corresponding to the nova_api; after all the virtual machines of the computing nodes are detected, writing the execution completion information of the computing nodes into the database, so that the nova_api receives a reading request from the user interface through a newly added second interface in the nova_api, and when the execution completion information of all the computing nodes in the cloud platform is detected from the database, acquiring the basic information from the database and sending the basic information to the user interface.
It should be noted that, when detecting the operating systems of the virtual machines of all the computing nodes in the cloud platform, the basic information of the virtual machines, which are blocked by the operating systems of the virtual machines of the computing nodes which are detected, can be obtained at any time, or the basic information of the virtual machines, which are blocked by the operating systems of the virtual machines of all the computing nodes in the cloud platform, can be obtained after the detection of the operating systems of the virtual machines of all the computing nodes in the cloud platform is completed; when the virtual machine basic information is acquired after all the computing nodes are detected, a limit is added to ensure that the virtual machine basic information can be acquired after all the computing nodes are detected.
It can be understood that the execution completion information of each computing node is recorded in the database, and when the execution completion information of all the computing nodes is detected, the virtual machine basic information of the virtual machine operating system blocked recorded in the database can be obtained.
In the embodiment of the application, the basic information of the virtual machine is recorded in a detection result record table which is added in advance in a database corresponding to the nova_api; after all the virtual machines of the computing nodes are detected, recording the execution completion information of the computing nodes into a detection task record which is created in advance in the database, so that a newly added second interface in the nova_api acquires the basic information from the detection result record table and sends the basic information to the user interface after receiving a reading request from the user interface and when the execution completion information of all the computing nodes in the cloud platform is detected from the database; the detection task record is a record created by the nova_api for the detection task in a detection task record table; and the detection task record table is a record table added in advance in the database.
It should be noted that, in the present application, in order to store the execution completion information of the computing node and the virtual machine basic information of the virtual machine operating system that is blocked, a detection task record table and a detection result record table are added in the database in advance, and after the nova_api acquires a detection task, a detection task record corresponding to the detection task is created in the detection task record table, which is specifically used for recording the virtual machine basic information of the virtual machine operating system that is blocked and obtained through detection of the detection task.
It is noted that a detection result record may also be created in the detection result record table to store the basic information.
In the embodiment of the application, the basic information of the virtual machine and the task identifier corresponding to the detection task are recorded in a detection result recording table which is added in advance in a database corresponding to the nova_api; after all the virtual machines of the computing nodes are detected, recording the execution completion information of the computing nodes and the task identification into a detection task record which is created in advance in the database, so that a newly added second interface in the nova_api acquires the basic information from the detection result record table and sends the basic information to the user interface based on the task identification after the task identification is received from the user interface and when the execution completion information of all the computing nodes in the cloud platform is detected from the database; the task identifier is an identifier created by the nova_api for the detection task.
It should be noted that, a task identifier is generated for the detection task through a nova_api, then the task identifier is associated with virtual machine basic information of virtual machine operating system blocking detected based on the detection task, the virtual machine basic information and the virtual machine basic information are stored together in a detection result record table, the nova_api sends the task identifier to a user interface when the task identifier is generated, so that a target user inputs the task identifier through the user interface, the nova_api obtains the task identifier through a second interface, and then virtual machine basic information of virtual machine operating system blocking detected based on the detection task is searched from the detection result record table based on the task identifier and sent to the user interface. It is understood that the task identity may be used as the read request. The task identification is in uuid format.
It should be noted that the task identity may be carried by the RPC request to the nova_computer.
In summary, in the present application, a new table is added to a database corresponding to a nova_api, an instance_fault_check table is used to record a task for detecting a virtual machine card, an instance_fault_record table is used to record a task detection result, then two new HTTP (Hyper Text Transfer Protocol ) interfaces are added to the nova_api, a first interface is used to call to create a new detection task, after the detection task is created successfully, the nova_api notifies all computing nodes to detect the health state of a virtual machine on the current node by means of RPC call, the nova_computer traverses all virtual machines of the current node, and sends qga commands to detect whether the virtual machine has been blocked, after traversing is completed, the detected blocked virtual machine list is updated to the instance_fault_record table of the corresponding database, and the task completion state of the current node is updated (i.e. the execution completion information corresponding to the computing node is stored in the instance_fault_check table). When all the computing nodes complete the detection task, the database records that all the node detection is completed, the HTTP interface (the second interface) can be called to acquire the result of the corresponding detection task, the nova_api directly reads the completion state of the task from the database after receiving the HTTP request, and if all the node tasks are completed, the second interface returns all the virtual machines which are detected to be in the blocking state in the form of a list, and an operation and maintenance engineer can perform operation and maintenance operation on the corresponding virtual machines through the returned result. In summary, according to the application, the cloud platform based on OpenStack is expanded, an HTTP interface is provided for detecting that the whole cloud platform is in a blocked state and is a virtual machine, an operation and maintenance manager can simply and conveniently acquire all the blocked virtual machine lists of the current cloud platform by calling the interface, and corresponding operation and maintenance measures are adopted for the blocked virtual machines according to specific service requirements.
As can be seen, the present application obtains the RPC request generated by the nova_api of the control node using the detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not; generating qga commands based on the RPC requests and sending the qga commands to each virtual machine of the computing node in turn; if the response, generated by the virtual machine based on the qga command, indicating that the operating system of the virtual machine is not blocked is not obtained within the preset time, recording basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api can obtain the basic information from the database and send the basic information to the user interface through the second interface after receiving a reading request from the user interface through the newly added second interface in the nova_api. Therefore, according to the method and the device, whether the operating system of the virtual machine is in the stuck state is presumed by utilizing the qga command which does not depend on the network, so that the stuck state of the operating system of the virtual machine can be detected under the condition that the network of the virtual machine is abnormal; in addition, interfaces are added to the nova_computer deployed at the computing node and the nova_api deployed at the control node, so that the virtual machine with the virtual machine operating system in a stuck state can be detected rapidly and conveniently.
Referring to fig. 2, an embodiment of the present application discloses a specific method for detecting a blocking of an operating system of a virtual machine, which is applied to a nova_api of a control node, and the method includes:
step S21: and acquiring a detection task for detecting whether the virtual machine operating systems corresponding to all the computing nodes in the cloud platform are blocked or not from a user interface through the newly added first interface in the nova_api.
In this embodiment of the present application, the first interface is an HTTP interface.
Step S22: generating an RPC request based on the detection task, and sending the RPC request to the nova_computer so that the nova_computer generates a qga command based on the RPC request, sequentially sending the qga command to each virtual machine of the computing node corresponding to the nova_computer, and then sending basic information of the virtual machine which does not generate a response based on the qga command to a database corresponding to nova_api; the response is a response indicating that the virtual machine operating system of the virtual machine itself is not stuck.
In the embodiment of the present application, by sending a command to the qemu-ga process, whether the corresponding virtual machine is in a normal running state is detected, if qga command is responded within a preset time, the virtual machine is considered to be in the normal running state, and if the command execution is overtime, the virtual machine operating system can be considered to be blocked.
Step S23: and acquiring a reading request from a user interface through a newly added second interface in the nova_api, acquiring the basic information in the database based on the reading request, and then sending the basic information to the user interface through the second interface.
In this embodiment of the present application, the second interface is an HTTP interface.
In the embodiment of the application, the basic information can be sent to the user interface in a list form.
Therefore, according to the method and the device, whether the operating system of the virtual machine is in the stuck state is presumed by utilizing the qga command which does not depend on the network, so that the stuck state of the operating system of the virtual machine can be detected under the condition that the network of the virtual machine is abnormal; in addition, interfaces are added to the nova_computer deployed at the computing node and the nova_api deployed at the control node, so that the virtual machine with the virtual machine operating system in a stuck state can be detected rapidly and conveniently.
Referring to fig. 3, a simple flow diagram of virtual machine operating system blocking detection is shown, where the HTTP PUT represents a first interface, the HTTP GET represents a second interface, the RPC represents an RPC interface, the nova_api and the nova_computer are components in nova, and nova is a component of the OpenStack cloud platform, and details of the specific flow in this figure are not specifically described any more, and can be seen in the detailed description of fig. 4.
Referring to fig. 4, a detailed flowchart of the detection of the locking of the operating system of the virtual machine is shown, wherein UI (User Interface Design) represents a user interface, VMs is the virtual machine, and database represents a database corresponding to nova_api; and adding an instance_fault_check table and an instance_fault_record table into the database in advance, wherein the instance_fault_check table and the instance_fault_record table are respectively used for storing the execution completion information and the detection result (the virtual machine basic information of the virtual machine operating system to be blocked) of the virtual machine to be blocked detection task, and realizing the operation functions of the two new table records in a nova project. In the figure, a user creates a virtual machine seizure detection task through a user interface; receiving a detection task (namely, 1 in the figure, a detection task for detecting the locking of a virtual machine system) sent by a user interface through a new HTTP interface (a first interface) added by an extended nova_api service; generating a task_id (task identifier) in a uuid format corresponding to the detection task; creating a corresponding detection task record in a database table instance_fault_check; reading all the computing node information and node states from the database (i.e., 2: obtain computing node information and 3: query computing node states); sending an RPC request (i.e., 4) to all computing nodes; returning the task identity to the user interface (i.e., 5: return task identity); expanding nova_computer service, adding an RPC interface of instance_fault_check, and reading all virtual machine information of the current node from a database when an RPC request sent by nova_api is received (namely, 6, obtaining virtual machine information in a computing node, and 7, returning the virtual machine information); sequentially sending qga commands to all virtual machines and waiting for virtual machine responses (i.e., query virtual machine power state at 8, and query qemu-ga process state at 9, 10 when state is good: send qga commands, then wait 11 for a preset time: whether to return a response); when the virtual machine is overtime and unresponsive, the basic information of the virtual machine is written into a database instance_fault_record table, and the record can be indexed through a task_id field carried when the nova_api sends an RPC request (namely, 12, the basic information of the virtual machine which is blocked by a writing system is written, 13, the end is reached); in addition, the information of the completion of the task execution of the node is written into a record managed by a task_id in a database table instance_fault_check, and the current node is marked to complete detection; the nova_api obtains the task_id (i.e., 14: task identification) entered by the user; the nova_api reads the corresponding task record information (i.e. 15: read basic information) from the instance_fault_check table of the database according to the task_id, and if the requested task is completed, all the blocking state virtual machine information (i.e. 16: return basic information) in the instance_fault_record table is queried through the task_id field index, and the result is returned to the interface caller (i.e. 17: return basic information).
In summary, in the present application, whether the virtual machine operating system is stuck is detected in batches by sending qga command, and the method is stable and efficient and does not depend on external network. The virtual machine is detected to be blocked in a mode of providing the HTTP interface, so that an operation and maintenance engineer can operate conveniently and rapidly, and the virtual machine list of all operation system blocking on the current cloud platform is obtained rapidly by calling the HTTP interface, so that the workload of the operation and maintenance engineer is greatly reduced.
It is pointed out that the cloud platform virtual machine health state can be checked regularly through a timing task mode, and long-time influence of virtual machine breakdown on user service can be effectively avoided.
Referring to fig. 5, an embodiment of the present application discloses a device for detecting a blocking of an operating system of a virtual machine, which is applied to a nova_computer of a computing node, and includes:
an RPC request obtaining module 11, configured to obtain an RPC request generated by a nova_api of the control node using the detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not;
A command generation module 12 for generating qga commands based on the RPC requests;
a command sending module 13, configured to send the qga command to each virtual machine of the computing node in sequence;
and the basic information recording module 14 is configured to record, if a response, generated by the virtual machine based on the qga command, indicating that the operating system of the virtual machine is not locked, in a preset time, the basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api receives a reading request from the user interface through a newly added second interface in the nova_api, acquire the basic information from the database, and send the basic information to the user interface through the second interface.
The more specific working process of each module may refer to the corresponding content disclosed in the foregoing embodiment, and will not be described herein.
As can be seen, the present application obtains the RPC request generated by the nova_api of the control node using the detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not; generating qga commands based on the RPC requests and sending the qga commands to each virtual machine of the computing node in turn; if the response, generated by the virtual machine based on the qga command, indicating that the operating system of the virtual machine is not blocked is not obtained within the preset time, recording basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api can obtain the basic information from the database and send the basic information to the user interface through the second interface after receiving a reading request from the user interface through the newly added second interface in the nova_api. Therefore, according to the method and the device, whether the operating system of the virtual machine is in the stuck state is presumed by utilizing the qga command which does not depend on the network, so that the stuck state of the operating system of the virtual machine can be detected under the condition that the network of the virtual machine is abnormal; in addition, interfaces are added to the nova_computer deployed at the computing node and the nova_api deployed at the control node, so that the virtual machine with the virtual machine operating system in a stuck state can be detected rapidly and conveniently.
Further, the embodiment of the present application further provides an electronic device, and fig. 6 is a structural diagram of the electronic device 20 according to an exemplary embodiment, where the content of the drawing is not to be considered as any limitation on the scope of use of the present application.
Fig. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, an input-output interface 24, a communication interface 25, and a communication bus 26. The memory 22 is configured to store a computer program, where the computer program is loaded and executed by the processor 21 to implement the relevant steps of the virtual machine operating system seizure detection method disclosed in any of the foregoing embodiments.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 24 is used for obtaining external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application needs, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the memory 22 may be a nonvolatile memory including a random access memory as a running memory and a storage purpose for an external memory, and the storage resources include an operating system 221, a computer program 222, and the like, and the storage may be temporary storage or permanent storage.
The operating system 221 is used to manage and control various hardware devices on the electronic device 20 and the computer program 222 on the source host, and the operating system 221 may be Windows, unix, linux or the like. The computer program 222 may further include a computer program capable of performing other specific tasks in addition to the computer program capable of performing the virtual machine operating system seizure detection method performed by the electronic device 20 as disclosed in any of the foregoing embodiments.
In this embodiment, the input/output interface 24 may specifically include, but is not limited to, a USB interface, a hard disk read interface, a serial interface, a voice input interface, a fingerprint input interface, and the like.
Further, the embodiment of the application also discloses a computer readable storage medium for storing a computer program; the method for detecting the blocking of the virtual machine operating system is characterized in that the computer program is executed by a processor.
For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
The computer readable storage medium as referred to herein includes random access Memory (Random Access Memory, RAM), memory, read-Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, magnetic or optical disk, or any other form of storage medium known in the art. The computer program realizes the method for detecting the jamming of the operating system of the virtual machine when being executed by the processor. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, the method for detecting the locking of the virtual machine operating system disclosed in the embodiment corresponds to the method for detecting the locking of the virtual machine operating system disclosed in the embodiment, so that the description is simpler, and relevant parts can be seen from the description of the method.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of an algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The method, the device, the equipment and the medium for detecting the blocking of the virtual machine operating system provided by the invention are described in detail, and specific examples are applied to the explanation of the principle and the implementation mode of the invention, and the explanation of the above examples is only used for helping to understand the method and the core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
Claims (10)
1. A method for detecting the blocking of a virtual machine operating system is characterized by being applied to nova_computer of a computing node and comprising the following steps:
acquiring an RPC request generated by a nova_api of a control node by using a detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not;
generating qga commands based on the RPC requests and sending the qga commands to each virtual machine of the computing node in turn;
if the response, generated by the virtual machine based on the qga command, indicating that the operating system of the virtual machine is not blocked is not obtained within the preset time, recording basic information of the virtual machine to a database corresponding to the nova_api, so that the nova_api can obtain the basic information from the database and send the basic information to the user interface through the second interface after receiving a reading request from the user interface through the newly added second interface in the nova_api.
2. The method for detecting the blocking of the operating system of the virtual machine according to claim 1, wherein the recording the basic information of the virtual machine to the database corresponding to the nova_api so that the nova_api obtains the basic information from the database and sends the basic information to the user interface through the second interface after receiving the read request from the user interface through the newly added second interface in the nova_api includes:
recording the basic information of the virtual machine to a database corresponding to the nova_api;
after all the virtual machines of the computing nodes are detected, writing the execution completion information of the computing nodes into the database, so that the nova_api receives a reading request from the user interface through a newly added second interface in the nova_api, and when the execution completion information of all the computing nodes in the cloud platform is detected from the database, acquiring the basic information from the database and sending the basic information to the user interface.
3. The method for detecting the blocking of the operating system of the virtual machine according to claim 2, wherein the recording the basic information of the virtual machine to the database corresponding to the nova_api includes:
Recording the basic information of the virtual machine into a detection result record table which is added in advance in a database corresponding to the nova_api;
correspondingly, after all the virtual machines of the computing nodes are detected, writing execution completion information of the computing nodes into the database, so that the nova_api receives a reading request from the user interface through a second interface newly added in the nova_api, and when the execution completion information of all the computing nodes in the cloud platform is detected from the database, acquiring the basic information from the database and sending the basic information to the user interface, wherein the method comprises the following steps:
after all the virtual machines of the computing nodes are detected, recording the execution completion information of the computing nodes into a detection task record which is created in advance in the database, so that a newly added second interface in the nova_api acquires the basic information from the detection result record table and sends the basic information to the user interface after receiving a reading request from the user interface and when the execution completion information of all the computing nodes in the cloud platform is detected from the database; the detection task record is a record created by the nova_api for the detection task in a detection task record table; and the detection task record table is a record table added in advance in the database.
4. The method for detecting the blocking of the operating system of the virtual machine according to claim 3, wherein the recording the basic information of the virtual machine in the detection result record table added in advance in the database corresponding to the nova_api includes:
recording the basic information of the virtual machine and the task identification corresponding to the detection task into a detection result record table which is added in advance in a database corresponding to the nova_api;
correspondingly, after all the virtual machines of the computing nodes are detected, the execution completion information of the computing nodes is recorded into a detection task record created in advance in the database, so that after a second interface newly added in the nova_api receives a reading request from the user interface, and when the execution completion information of all the computing nodes in the cloud platform is detected from the database, the basic information is obtained from the detection result record table and is sent to the user interface, and the method comprises the following steps:
after all the virtual machines of the computing nodes are detected, recording the execution completion information of the computing nodes and the task identification into a detection task record which is created in advance in the database, so that a newly added second interface in the nova_api acquires the basic information from the detection result record table and sends the basic information to the user interface based on the task identification after the task identification is received from the user interface and when the execution completion information of all the computing nodes in the cloud platform is detected from the database; the task identifier is an identifier created by the nova_api for the detection task.
5. The method of claim 4, wherein the task identifier is in uuid format.
6. The method for detecting the locking of the operating system of the virtual machine according to any one of claims 1 to 5, wherein the obtaining the RPC request generated by the nova_api of the control node by using the detection task includes:
and acquiring an RPC request generated by the nova_api sent by the nova_api of the control node by using a detection task through the newly added RPC interface in the nova_computer.
7. A method for detecting the blocking of a virtual machine operating system is characterized by being applied to a nova_api of a control node and comprising the following steps:
acquiring a detection task for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform are blocked or not from a user interface through a newly added first interface in the nova_api;
generating an RPC request based on the detection task, and sending the RPC request to the nova_computer so that the nova_computer generates a qga command based on the RPC request, sequentially sending the qga command to each virtual machine of the computing node corresponding to the nova_computer, and then sending basic information of the virtual machine which does not generate a response based on the qga command to a database corresponding to nova_api; the response is a response indicating that the virtual machine operating system of the virtual machine is not blocked;
And acquiring a reading request from a user interface through a newly added second interface in the nova_api, acquiring the basic information in the database based on the reading request, and then sending the basic information to the user interface through the second interface.
8. A virtual machine operating system card death detection device, applied to a nova_computer of a computing node, comprising:
the RPC request acquisition module is used for acquiring an RPC request generated by a nova_api of the control node by using the detection task; the detection task is a task which is acquired from a user interface through a newly added first interface in the nova_api and is used for detecting whether virtual machine operating systems corresponding to all computing nodes in a cloud platform where the computing nodes are located are blocked or not;
a command generation module for generating qga commands based on the RPC requests;
a command sending module, configured to send the qga command to each virtual machine of the computing node in sequence;
and the basic information recording module is used for recording the basic information of the virtual machine to a database corresponding to the nova_api if the response, generated by the virtual machine based on the qga command and indicating that the operating system of the virtual machine is not blocked, is not acquired within a preset time, so that the nova_api receives a reading request from the user interface through a newly added second interface in the nova_api, acquires the basic information from the database and sends the basic information to the user interface through the second interface.
9. An electronic device comprising a processor and a memory; the method for detecting the seizure of the operating system of the virtual machine according to any one of claims 1 to 7 is realized when the processor executes the computer program stored in the memory.
10. A computer-readable storage medium storing a computer program; wherein the computer program, when executed by a processor, implements the virtual machine operating system seizure detection method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310113075.XA CN116089015A (en) | 2023-02-10 | 2023-02-10 | Method, device, equipment and medium for detecting locking of virtual machine operating system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310113075.XA CN116089015A (en) | 2023-02-10 | 2023-02-10 | Method, device, equipment and medium for detecting locking of virtual machine operating system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116089015A true CN116089015A (en) | 2023-05-09 |
Family
ID=86202354
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310113075.XA Pending CN116089015A (en) | 2023-02-10 | 2023-02-10 | Method, device, equipment and medium for detecting locking of virtual machine operating system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116089015A (en) |
-
2023
- 2023-02-10 CN CN202310113075.XA patent/CN116089015A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102525502B1 (en) | Method and apparatus for storing auto-drive test data, electronic device, storage medium and program | |
US8024712B1 (en) | Collecting application logs | |
CN113407383B (en) | Main and standby system switching method and device, server and main and standby system | |
CN109923547B (en) | Program behavior monitoring device, distributed object generation management device, storage medium, and program behavior monitoring system | |
CN107566518B (en) | Method and device for managing equipment information in file installation process | |
CN112769652B (en) | Node service monitoring method, device, equipment and medium | |
CN101594376A (en) | The method and the corresponding device thereof of device are provided to the CIMOM registering CIM | |
CN108924043A (en) | System monitoring method, gateway communication, gateway apparatus, service processing equipment | |
CN111582824B (en) | Cloud resource synchronization method, device, equipment and storage medium | |
CN116708266A (en) | Cloud service topological graph real-time updating method, device, equipment and medium | |
CN114697191A (en) | Resource migration method, device, equipment and storage medium | |
CN111342986A (en) | Distributed node management method and device, distributed system and storage medium | |
CN111625264B (en) | Method, device, equipment and medium for upgrading multi-level management system | |
CN114726789A (en) | Method, device, equipment and medium for traffic management and traffic management policy configuration | |
CN110442636B (en) | Data reading and writing method and device and data reading and writing equipment | |
CN110798358B (en) | Distributed service identification method and device, computer readable medium and electronic equipment | |
CN109495298B (en) | Method and device for managing nodes in OpenStack system | |
CN113821333A (en) | Android application program migration method and device | |
CN108271420A (en) | Manage method, file system and the server system of file | |
CN116089015A (en) | Method, device, equipment and medium for detecting locking of virtual machine operating system | |
CN114817134A (en) | Snapshot task monitoring method, device, equipment and medium | |
CN112036828B (en) | Bare metal management method, device, equipment and medium | |
CN114328026A (en) | Virtual disk backup method, device, equipment and medium | |
CN113741912A (en) | Model management system, method, device and equipment | |
CN114625594A (en) | Configuration file generation method, log collection method, device, equipment and medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |