Virtual machine operating system lockup detection method, apparatus, device and medium
Patent Information
- Application Number
- CN202310113075.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-10
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-02-10
AI Technical Summary
[0035]可见,本申请获取控制节点的nova_api利用检测任务生成的RPC请求;所述检测任务为通过所述nova_api中新添加的第一接口从用户界面获取的用于检测所述计算节点所在云平台中所有计算节点对应的虚拟机操作系统是否卡死的任务;基于所述RPC请求生成qga命令,并将所述qga命令依次发送至所述计算节点的每个虚拟机;若在预设时间内,未获取到所述虚拟机基于所述qga命令产生的表示自身虚拟机操作系统未卡死的响应,则将所述虚拟机的基本信息记录至所述nova_api对应的数据库,以便所述nova_api通过所述nova_api中新添加的第二接口在从所述用户界面接收到读取请求后,从所述数据库中获取所述基本信息并将所述基本信息通过所述第二接口发送至所述用户界面。由此可见,本申请利用不依赖于网络的qga命令来推测虚拟机的操作系统是否处于卡死状态,保证了在虚拟机网络异常的情况下,能够对虚拟机操作系统的卡死状态进行检测;另外,对部署于计算节点的nova_compute和部署于控制节点的nova_api增加接口,以快速便捷的检测出虚拟机操作系统处于卡死状态的虚拟机。
Smart Images

Figure CN116089015B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for detecting virtual machine operating system freezes. Background Technology
[0002] Currently, for OpenStack-based cloud management platforms, the storage method used when building virtual machines is generally a distributed storage service system. The cloud platform does not directly provide storage capabilities and needs to connect to third-party storage services to provide data storage capabilities for the virtual machines. The virtual machines perform data read and write operations on the backend storage service via the network. In this deployment method, all data read and write operations of the virtual machine rely on network transmission. When the network responsible for storage data transmission fails, or when the backend storage service fails, if the virtual machine is performing frequent read and write operations, it may cause a failure that leads to the virtual machine operating system freezing. At this time, the virtual machine console will not output any content. In addition, virtual machine users may install some third-party drivers or develop their own drivers for virtual machine business based on their own business considerations. Due to the vulnerabilities or stability issues of the drivers themselves, the virtual machine operating system may also freeze, making it impossible to provide normal business.
[0003] When a virtual machine's operating system freezes, the virtual machine becomes unresponsive to user input. From the host machine's perspective, the virtual machine's processes appear to be running normally, making it impossible to determine whether the operating system inside the virtual machine is frozen using simple methods.
[0004] In summary, this article describes how to quickly and easily detect a virtual machine whose operating system is frozen. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a method, apparatus, device, and medium for detecting virtual machine operating system freezes, which can quickly and easily detect virtual machines whose operating systems are in a frozen state. The specific solution is as follows:
[0006] Firstly, this application discloses a virtual machine operating system freeze detection method, applied to the nova_compute of a compute node, including:
[0007] The nova_api of the control node is obtained using the RPC request generated by the detection task; the detection task is a task obtained from the user interface through the newly added first interface of the nova_api to detect whether the virtual machine operating system corresponding to all computing nodes in the cloud platform where the computing node is located is frozen.
[0008] Based on the RPC request, a qga command is generated, and the qga command is sent sequentially to each virtual machine on the compute node;
[0009] If no response indicating that the virtual machine's operating system is not frozen is received from the virtual machine based on the qga command within a preset time, the basic information of the virtual machine is recorded in the database corresponding to nova_api. This allows nova_api to retrieve the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api, and send the basic information to the user interface through the second interface.
[0010] Optionally, recording the basic information of the virtual machine into the database corresponding to the nova_api, so that the nova_api, after receiving a read request from the user interface through the newly added second interface in the nova_api, retrieves the basic information from the database and sends the basic information to the user interface through the second interface, includes:
[0011] Record the basic information of the virtual machine into the database corresponding to nova_api;
[0012] After all virtual machines on the compute node have been detected, the execution completion information of the compute node is written to the database. This allows the nova_api, through the newly added second interface in the nova_api, to obtain the basic information from the database and send it to the user interface when it receives a read request from the user interface and detects the execution completion information of all compute nodes in the cloud platform from the database.
[0013] Optionally, recording the basic information of the virtual machine into the database corresponding to the nova_api includes:
[0014] Record the basic information of the virtual machine into the detection result record table that was pre-added in the database corresponding to the nova_api;
[0015] Accordingly, after all virtual machines on the computing node have been detected, the execution completion information of the computing node is written to the database. This allows the nova_api, through the newly added second interface in the nova_api, to retrieve the basic information from the database and send it to the user interface after receiving a read request from the user interface and detecting the execution completion information of all computing nodes in the cloud platform from the database. This includes:
[0016] After all virtual machines on the compute node have been detected, the execution completion information of the compute node is recorded in a pre-created detection task record in the database. This allows the newly added second interface in nova_api to retrieve the basic information from the detection result record table and send it to the user interface when it receives a read request from the user interface and detects the execution completion information of all compute nodes in the cloud platform from the database. The detection task record is a record created by nova_api for the detection task in the detection task record table. The detection task record table is a pre-added record table in the database.
[0017] Optionally, recording the basic information of the virtual machine into a pre-added detection result record table in the database corresponding to the nova_api includes:
[0018] Record the basic information of the virtual machine and the task identifier corresponding to the detection task into the detection result record table pre-added in the database corresponding to nova_api;
[0019] Accordingly, after all the virtual machines on the computing node have been detected, the execution completion information of the computing node is recorded in the pre-created detection task record in the database. This allows the newly added second interface in nova_api, upon receiving a read request from the user interface and detecting the execution completion information of all computing nodes in the cloud platform from the database, to retrieve the basic information from the detection result record table and send the basic information to the user interface, including:
[0020] After all virtual machines on the compute node have been detected, the execution completion information of the compute node and the task identifier are recorded in the pre-created detection task record in the database. This allows the newly added second interface in nova_api to receive the task identifier from the user interface and, upon detecting the execution completion information of all compute nodes in the cloud platform from the database, retrieve the basic information from the detection result record table based on the task identifier and send the basic information to the user interface. The task identifier is an identifier created by nova_api for the detection task.
[0021] Optionally, the task identifier is in UUID format.
[0022] Optionally, obtaining the nova_api of the control node using the RPC request generated by the detection task includes:
[0023] The newly added RPC interface in nova_compute is used to obtain the RPC request generated by the nova_api using the detection task sent by the nova_api of the control node.
[0024] Secondly, this application discloses a virtual machine operating system freeze detection method, applied to the nova_api of the control node, including:
[0025] Through the newly added first interface in nova_api, a detection task for detecting whether the virtual machine operating system corresponding to all computing nodes in the cloud platform is frozen is obtained from the user interface.
[0026] An RPC request is generated based on the detection task, and the RPC request is sent to the nova_compute. The nova_compute then generates a qga command based on the RPC request and sends the qga command sequentially to each virtual machine on the compute node corresponding to the nova_compute. The basic information of the virtual machines that do not respond to the qga command is then sent to the database corresponding to nova_api. The response indicates that the virtual machine's own operating system is not frozen.
[0027] The user interface obtains a read request through the newly added second interface in the nova_api, and the user obtains the basic information in the database based on the read request. Then, the user interface sends the basic information to the user interface through the second interface.
[0028] Thirdly, this application discloses a virtual machine operating system freeze detection device, applied to the nova_compute of a compute node, comprising:
[0029] The RPC request acquisition module is used to acquire the RPC request generated by the nova_api of the control node using the detection task; the detection task is a task obtained from the user interface through the newly added first interface of the nova_api to detect whether the virtual machine operating system corresponding to all computing nodes in the cloud platform where the computing node is located is frozen.
[0030] The command generation module is used to generate qga commands based on the RPC request;
[0031] The command sending module is used to send the qga command sequentially to each virtual machine of the computing node;
[0032] The basic information recording module is used to record the basic information of the virtual machine to the database corresponding to nova_api if no response indicating that the virtual machine's operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time. This allows nova_api to retrieve the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api and send the basic information to the user interface through the second interface.
[0033] Fourthly, this application discloses an electronic device, including a processor and a memory; wherein, when the processor executes a computer program stored in the memory, it implements the aforementioned virtual machine operating system freeze detection method.
[0034] Fifthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned virtual machine operating system freeze detection method.
[0035] As can be seen, this application obtains the control node's nova_api using an RPC request generated by a detection task. The detection task is a task obtained from the user interface through a newly added first interface in nova_api, used to detect whether the virtual machine operating systems corresponding to all computing nodes in the cloud platform where the computing node is located are frozen. A qga command is generated based on the RPC request, and the qga command is sent sequentially to each virtual machine of the computing node. If no response indicating that its own virtual machine operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time, the basic information of the virtual machine is recorded in the database corresponding to nova_api, so that nova_api can obtain the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api, and send the basic information to the user interface through the second interface. Therefore, this application utilizes the network-independent qga command to infer whether the virtual machine's operating system is in a frozen state, ensuring that the frozen state of the virtual machine's operating system can be detected even when the virtual machine's network is abnormal. In addition, interfaces are added to nova_compute deployed on the compute node and nova_api deployed on the control node to quickly and conveniently detect virtual machines whose operating systems are in a frozen state. Attached Figure Description
[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0037] Figure 1 A flowchart of a virtual machine operating system freeze detection method provided in this application;
[0038] Figure 2 A flowchart of a virtual machine operating system freeze detection method provided in this application;
[0039] Figure 3 A simplified flowchart illustrating a virtual machine operating system freeze detection method provided in this application;
[0040] Figure 4 A detailed flowchart illustrating a virtual machine operating system freeze detection method provided in this application;
[0041] Figure 5 This application provides a schematic diagram of the structure of a virtual machine operating system freeze detection device;
[0042] Figure 6 A structural diagram of an electronic device provided in this application; Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] Currently, when a virtual machine's operating system freezes, the virtual machine cannot respond to user input. From the host machine's perspective, the virtual machine processes are running normally, so it is impossible to determine whether the operating system inside the virtual machine is frozen using simple methods.
[0045] To overcome the above problems, this application provides a virtual machine operating system freeze detection scheme, which can quickly and easily detect virtual machines whose operating systems are in a frozen state.
[0046] See Figure 1 As shown in the figure, this application discloses a method for detecting virtual machine operating system freezes, applied to the nova_compute of a compute node. The method includes:
[0047] Step S11: Obtain the RPC request generated by the nova_api detection task of the control node; the detection task is a task obtained from the user interface through the newly added first interface in the nova_api to detect whether the virtual machine operating system corresponding to all computing nodes in the cloud platform where the computing node is located is frozen.
[0048] In this embodiment of the application, obtaining the RPC (Remote Procedure Call) request generated by the detection task using the nova_api of the control node includes: obtaining the RPC request generated by the detection task sent by the nova_api of the control node through the newly added RPC interface in nova_compute.
[0049] Step S12: Generate a qga command based on the RPC request, and send the qga command sequentially to each virtual machine of the computing node.
[0050] In this embodiment, the qemu-ga process running inside the virtual machine communicates with the outside world not through the network, but through the virtual machine's virtio serial port device. Therefore, the qemu-ga process can be used to detect the virtual machine operating system's frozen state even when the virtual machine network is abnormal and the virtual machine console is not logged in. This application detects whether the corresponding virtual machine is in a normal operating state by sending commands to the qemu-ga process. If the qga command responds within a preset time, the virtual machine is considered to be in a normal operating state; if the command execution times out, the virtual machine operating system is considered to be frozen.
[0051] Step S13: If no response indicating that the virtual machine's operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time, the basic information of the virtual machine is recorded in the database corresponding to nova_api, so that nova_api can obtain the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api and send the basic information to the user interface through the second interface.
[0052] In this embodiment of the application, the basic information can be sent to the user interface in list form.
[0053] In this embodiment of the application, the step of recording the basic information of the virtual machine into the 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 newly added in the nova_api after receiving a read request from the user interface, includes: recording the basic information of the virtual machine into the database corresponding to the nova_api; after all the virtual machines of the computing node have been detected, writing the execution completion information of the computing node 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 after receiving a read request from the user interface through the second interface newly added in the nova_api and detecting the execution completion information of all computing nodes in the cloud platform from the database.
[0054] It should be noted that when testing the operating systems of virtual machines on all computing nodes in the cloud platform, basic information about virtual machines whose operating systems are stuck can be obtained at any time after the testing of the operating systems of virtual machines on all computing nodes in the cloud platform is completed. However, if the information is obtained after all computing nodes have been tested, restrictions need to be added to ensure that the basic information about virtual machines can only be obtained after all computing nodes have been tested.
[0055] It is understood that this application records the execution completion information of each computing node in the database. When the execution completion information of all computing nodes is detected, the basic information of the virtual machine whose virtual machine operating system is stuck can be obtained from the database.
[0056] In this embodiment, the basic information of the virtual machine is recorded in a pre-added detection result record table in the database corresponding to the nova_api; after all the virtual machines on the computing node are detected, the execution completion information of the computing node is recorded in a pre-created detection task record in the database, so that when the newly added second interface in nova_api receives a read request from the user interface and detects the execution completion information of all computing nodes in the cloud platform from the database, it can obtain the basic information from the detection result record table and send the basic information to the user interface; the detection task record is the record created by nova_api for the detection task in the detection task record table; the detection task record table is a record table pre-added in the database.
[0057] It should be noted that, in order to store the execution completion information of the computing node and the basic information of the virtual machine whose operating system is stuck, this application pre-added a detection task record table and a detection result record table to the database. After the nova_api obtains the detection task, a detection task record corresponding to the detection task is created in the detection task record table, which is specifically used to record the basic information of the virtual machine whose operating system is stuck, obtained through the detection task.
[0058] It should be noted that test result records can also be created in the test result record table to store the aforementioned basic information.
[0059] In this embodiment, the basic information of the virtual machine and the task identifier corresponding to the detection task are recorded in a pre-added detection result record table in the database corresponding to nova_api. After all the virtual machines on the computing node are detected, the execution completion information of the computing node and the task identifier are recorded in a pre-created detection task record in the database. This allows the newly added second interface in nova_api to receive the task identifier from the user interface and, upon detecting the execution completion information of all computing nodes in the cloud platform from the database, retrieve the basic information from the detection result record table based on the task identifier and send the basic information to the user interface. The task identifier is an identifier created by nova_api for the detection task.
[0060] It should be noted that a task identifier is generated for the detection task via nova_api. This task identifier is then linked with the basic information of the virtual machine whose operating system is frozen, as detected by the detection task, and both are saved in the detection result record table. Upon generating the task identifier, nova_api sends it to the user interface so that the target user can input it. After obtaining the task identifier through a second interface, nova_api retrieves the basic information of the virtual machine whose operating system is frozen, as detected by the detection task, from the detection result record table based on the task identifier and sends it to the user interface. It can be understood that the task identifier can serve as the read request. The task identifier is in UUID format.
[0061] It should be noted that the task identifier can be carried to nova_compute in the RPC request.
[0062] In summary, this application adds new tables to the database corresponding to nova_api: the instance_fault_check table records tasks for detecting virtual machine freezes, and the instance_fault_record table records task detection results. Then, it adds two new HTTP (Hypertext Transfer Protocol) interfaces to nova_api. The first interface is used to create new detection tasks. After a detection task is successfully created, nova_api will notify all compute nodes via RPC calls to check the health status of virtual machines on the current node. nova_compute checks whether a virtual machine has frozen by traversing all virtual machines on the current node and sending qga commands. After the traversal is complete, it updates the list of detected frozen virtual machines in the corresponding instance_fault_record table in the database, and simultaneously updates the task completion status of the current node (i.e., the execution completion information corresponding to the compute node is stored in the instance_fault_check table). Once all computing nodes have completed their detection tasks, the database records that all node detections are complete. The HTTP interface (second interface) can then be called to retrieve the results of the corresponding detection tasks. After receiving the HTTP request, `nova_api` directly reads the task completion status from the database. If all node tasks are complete, the second interface returns a list of all detected frozen virtual machines. Operations engineers can then use this list to perform maintenance operations on the corresponding virtual machines. In summary, this application extends the OpenStack cloud platform by providing an HTTP interface for detecting frozen virtual machines across the entire cloud platform. Operations administrators can easily obtain a list of all frozen virtual machines on the current cloud platform by calling this interface and take appropriate maintenance measures for these frozen virtual machines according to specific business requirements.
[0063] As can be seen, this application obtains the control node's nova_api using an RPC request generated by a detection task. The detection task is a task obtained from the user interface through a newly added first interface in nova_api, used to detect whether the virtual machine operating systems corresponding to all computing nodes in the cloud platform where the computing node is located are frozen. A qga command is generated based on the RPC request, and the qga command is sent sequentially to each virtual machine of the computing node. If no response indicating that its own virtual machine operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time, the basic information of the virtual machine is recorded in the database corresponding to nova_api, so that nova_api can obtain the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api, and send the basic information to the user interface through the second interface. Therefore, this application utilizes the network-independent qga command to infer whether the virtual machine's operating system is in a frozen state, ensuring that the frozen state of the virtual machine's operating system can be detected even when the virtual machine's network is abnormal. In addition, interfaces are added to nova_compute deployed on the compute node and nova_api deployed on the control node to quickly and conveniently detect virtual machines whose operating systems are in a frozen state.
[0064] See Figure 2 As shown in the figure, this application discloses a specific method for detecting virtual machine operating system freezes, applied to the nova_api of the control node. The method includes:
[0065] Step S21: Obtain a detection task from the user interface through the newly added first interface in nova_api to detect whether the virtual machine operating system corresponding to all computing nodes in the cloud platform is stuck.
[0066] In this embodiment of the application, the first interface is an HTTP interface.
[0067] Step S22: Generate an RPC request based on the detection task and send the RPC request to the nova_compute, so that the nova_compute generates a qga command based on the RPC request and sends the qga command sequentially to each virtual machine of the compute node corresponding to the nova_compute. Then, send the basic information of the virtual machine that does not respond based on the qga command to the database corresponding to nova_api; the response is a response indicating that the virtual machine's own virtual machine operating system is not frozen.
[0068] In this embodiment, the virtual machine is detected as being in normal operation by sending a command to the qemu-ga process. If the qga command responds within a preset time, the virtual machine is considered to be in normal operation. If the command execution times out, the virtual machine operating system is considered to be frozen.
[0069] Step S23: Obtain a read request from the user interface through the newly added second interface in nova_api, obtain the basic information in the database based on the read request, and then send the basic information to the user interface through the second interface.
[0070] In this embodiment of the application, the second interface is an HTTP interface.
[0071] In this embodiment of the application, the basic information can be sent to the user interface in list form.
[0072] As can be seen, this application uses the network-independent qga command to infer whether the virtual machine's operating system is in a frozen state, ensuring that the frozen state of the virtual machine's operating system can be detected even when the virtual machine's network is abnormal. In addition, interfaces are added to nova_compute deployed on the compute node and nova_api deployed on the control node to quickly and conveniently detect virtual machines whose operating systems are in a frozen state.
[0073] See Figure 3 The diagram shown is a simplified flowchart for detecting virtual machine operating system freezes. HTTP PUT represents the first interface, HTTP GET represents the second interface, RPC represents the RPC interface, and nova_api and nova_compute are components within nova, which is a component of the OpenStack cloud platform. Specific process details are not elaborated upon in this diagram but can be found elsewhere. Figure 4 See the detailed explanation below.
[0074] See Figure 4The diagram shows a detailed flowchart of virtual machine operating system freeze detection. UI (User Interface Design) represents the user interface, VMs represents virtual machines, and database represents the database corresponding to nova_api. The instance_fault_check and instance_fault_record tables are added to the database in advance to store the execution completion information and detection results (basic information of the virtual machine whose operating system is frozen) of the virtual machine freeze detection task, respectively. The operation functions of the records in the above two new tables are implemented in the nova project.In the diagram, the user creates a virtual machine crash detection task through the user interface; receives the detection task sent by the user interface (i.e., 1 in the diagram: a detection task to detect virtual machine system crashes) through a new HTTP interface (the first interface) added by extending the nova_api service; generates a task_id (task identifier) in UUID format corresponding to the detection task; creates a corresponding detection task record in the instance_fault_check database table; reads all compute node information and node status from the database (i.e., 2: obtaining compute node information and 3: querying compute node status); and sends RPs to all compute nodes. Request C (i.e., 4); return the task identifier to the user interface (i.e., 5: return the task identifier); extend the nova_compute service, add the instance_fault_check RPC interface, and when it receives the RPC request sent by nova_api, read all virtual machine information of the current node from the database (i.e., 6: get virtual machine information in the compute node, and 7: return virtual machine information); send the qga command to all virtual machines in sequence, and wait for the virtual machine response (i.e., in 8: query the virtual machine power status, and 9: query the qemu-ga process status, if the status is good). 10: Send the qga command, then wait for a preset time (11: whether a response is returned); when the virtual machine times out and does not respond, write the basic information of the virtual machine into the instance_fault_record table in the database. This record can be indexed by the task_id field carried when sending the RPC request via nova_api (that is, 12: write the basic information of the virtual machine that is stuck in the system, 13: end); in addition, the information of the completion of the task execution of this node also needs to be written into the record managed by task_id in the instance_fault_check table in the database to identify the current The node has completed the detection; nova_api obtains the task_id passed by the user (i.e., 14: task identifier); nova_api reads the corresponding task record information from the instance_fault_check table in the database based on the task_id (i.e., 15: read basic information). If the requested task has been completed, it queries all the frozen virtual machine information in the instance_fault_record table through the task_id field index (i.e., 16: return basic information) and returns the result to the interface caller (i.e., 17: return basic information).
[0075] In summary, this application utilizes a method of batch detecting virtual machine operating systems for freezing by sending qga commands. This method is stable, efficient, and does not rely on external networks. Providing an HTTP interface for detecting virtual machine freezing allows operations engineers to perform operations conveniently and quickly, rapidly obtaining a list of all frozen virtual machines on the current cloud platform by calling the HTTP interface, significantly reducing their workload.
[0076] It should be noted that this application can periodically check the health status of virtual machines on the cloud platform through scheduled tasks, which can effectively prevent virtual machine crashes from causing long-term impact on user businesses.
[0077] See Figure 5 As shown in the figure, this application discloses a virtual machine operating system freeze detection device, applied to the nova_compute of a compute node, including:
[0078] RPC request acquisition module 11 is used to acquire RPC requests generated by the nova_api of the control node using the detection task; the detection task is a task obtained from the user interface through the newly added first interface in the nova_api to detect whether the virtual machine operating system corresponding to all computing nodes in the cloud platform where the computing node is located is stuck.
[0079] Command generation module 12 is used to generate qga commands based on the RPC request;
[0080] Command sending module 13 is used to send the qga command sequentially to each virtual machine of the computing node;
[0081] The basic information recording module 14 is used to record the basic information of the virtual machine to the database corresponding to the nova_api if no response indicating that the virtual machine's operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time. This allows the nova_api to obtain the basic information from the database after receiving a read request from the user interface through the newly added second interface in the nova_api and send the basic information to the user interface through the second interface.
[0082] For more detailed information on the working process of each of the above modules, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0083] As can be seen, this application obtains the control node's nova_api using an RPC request generated by a detection task. The detection task is a task obtained from the user interface through a newly added first interface in nova_api, used to detect whether the virtual machine operating systems corresponding to all computing nodes in the cloud platform where the computing node is located are frozen. A qga command is generated based on the RPC request, and the qga command is sent sequentially to each virtual machine of the computing node. If no response indicating that its own virtual machine operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time, the basic information of the virtual machine is recorded in the database corresponding to nova_api, so that nova_api can obtain the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api, and send the basic information to the user interface through the second interface. Therefore, this application utilizes the network-independent qga command to infer whether the virtual machine's operating system is in a frozen state, ensuring that the frozen state of the virtual machine's operating system can be detected even when the virtual machine's network is abnormal. In addition, interfaces are added to nova_compute deployed on the compute node and nova_api deployed on the control node to quickly and conveniently detect virtual machines whose operating systems are in a frozen state.
[0084] Furthermore, embodiments of this application also provide an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0085] Figure 6 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this 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 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the virtual machine operating system freeze detection method disclosed in any of the foregoing embodiments.
[0086] In this embodiment, the power supply 23 is used to provide 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 external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 24 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0087] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The memory 22 can be a random access memory that can be used as running memory and a non-volatile memory used for external memory storage. The storage resources on it include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0088] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 on the source host and the computer program 222. The operating system 221 can be Windows, Unix, Linux, etc. In addition to the computer program that can be used to perform the virtual machine operating system freeze detection method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to perform other specific tasks.
[0089] In this embodiment, the input / output interface 24 may 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, etc.
[0090] Furthermore, embodiments of this application also disclose a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned virtual machine operating system freeze detection method.
[0091] For the specific steps of this method, please refer to the relevant content disclosed in the foregoing embodiments, which will not be repeated here.
[0092] The computer-readable storage medium referred to herein includes random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, magnetic disks, optical disks, or any other form of storage medium known in the art. When the computer program is executed by a processor, it implements the aforementioned virtual machine operating system freeze detection method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0093] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the virtual machine operating system freeze detection method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0094] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0095] The steps of the algorithm described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0096] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0097] The present invention provides a detailed description of a virtual machine operating system freeze detection method, apparatus, device, and medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for detecting virtual machine operating system freezes, characterized in that, The nova_compute applied to compute nodes includes: The nova_api of the control node is obtained using the RPC request generated by the detection task; the detection task is a task obtained from the user interface through the newly added first interface of the nova_api to detect whether the virtual machine operating system corresponding to all computing nodes in the cloud platform where the computing node is located is frozen. Based on the RPC request, a qga command is generated, and the qga command is sent sequentially to each virtual machine on the compute node; If no response indicating that the virtual machine's operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time, the basic information of the virtual machine is recorded in the database corresponding to nova_api, so that nova_api can obtain the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api and send the basic information to the user interface through the second interface; The step of recording the basic information of the virtual machine into the database corresponding to the nova_api, so that the nova_api, after receiving a read request from the user interface through the newly added second interface in the nova_api, can retrieve the basic information from the database and send the basic information to the user interface through the second interface, includes: The basic information of the virtual machine is recorded in a pre-added detection result record table in the database corresponding to nova_api. After all the virtual machines on the compute node are detected, the execution completion information of the compute node is recorded in a pre-created detection task record in the database. This allows the newly added second interface in nova_api to retrieve the basic information from the detection result record table and send it to the user interface when it receives a read request from the user interface and detects the execution completion information of all compute nodes in the cloud platform from the database. The detection task record is a record created by nova_api for the detection task in the detection task record table. The detection task record table is a pre-added record table in the database. Sending the basic information to the user interface includes: The basic information is sent to the user interface in list form.
2. The virtual machine operating system freeze detection method according to claim 1, characterized in that, The step of recording the basic information of the virtual machine into a pre-added detection result record table in the database corresponding to the nova_api includes: Record the basic information of the virtual machine and the task identifier corresponding to the detection task into the detection result record table pre-added in the database corresponding to nova_api; Accordingly, after all the virtual machines on the computing node have been detected, the execution completion information of the computing node is recorded in the pre-created detection task record in the database. This allows the newly added second interface in nova_api, upon receiving a read request from the user interface and detecting the execution completion information of all computing nodes in the cloud platform from the database, to retrieve the basic information from the detection result record table and send the basic information to the user interface, including: After all virtual machines on the compute node have been detected, the execution completion information of the compute node and the task identifier are recorded in the pre-created detection task record in the database. This allows the newly added second interface in nova_api to receive the task identifier from the user interface and, upon detecting the execution completion information of all compute nodes in the cloud platform from the database, retrieve the basic information from the detection result record table based on the task identifier and send the basic information to the user interface. The task identifier is an identifier created by nova_api for the detection task.
3. The virtual machine operating system freeze detection method according to claim 2, characterized in that, The task identifier is in UUID format.
4. The virtual machine operating system freeze detection method according to any one of claims 1 to 3, characterized in that, The acquisition of the control node's nova_api utilizes the RPC request generated by the detection task, including: The newly added RPC interface in nova_compute is used to obtain the RPC request generated by the nova_api using the detection task sent by the nova_api of the control node.
5. A method for detecting virtual machine operating system freezes, characterized in that, The nova_api applied to the control node includes: Through the newly added first interface in nova_api, a detection task for detecting whether the virtual machine operating system corresponding to all computing nodes in the cloud platform is frozen is obtained from the user interface. An RPC request is generated based on the detection task and sent to nova_compute. nova_compute then generates a qga command based on the RPC request and sends the qga command sequentially to each virtual machine on the compute node corresponding to nova_compute. Basic information of virtual machines that do not respond to the qga command is then sent to a pre-added detection result record table in the database corresponding to nova_api. After all virtual machines on the compute node have been detected, the execution completion information of the compute node is recorded in a pre-created detection task record in the database. The response indicates that the virtual machine's operating system is not frozen. The detection task record is the record created by nova_api for the detection task in the detection task record table, which is a pre-added record table in the database. The user interface obtains a read request through the newly added second interface in the nova_api, and when the execution completion information of all computing nodes in the cloud platform is detected from the database, the basic information in the database is obtained from the detection result record table based on the read request, and then the basic information is sent to the user interface in list form through the second interface.
6. A virtual machine operating system freeze detection device, characterized in that, The nova_compute applied to the compute node is used to implement the steps of the virtual machine operating system freeze detection method as described in any one of claims 1 to 4, including: The RPC request acquisition module is used to acquire the RPC request generated by the nova_api of the control node using the detection task; the detection task is a task obtained from the user interface through the newly added first interface of the nova_api to detect whether the virtual machine operating system corresponding to all computing nodes in the cloud platform where the computing node is located is frozen. The command generation module is used to generate qga commands based on the RPC request; The command sending module is used to send the qga command sequentially to each virtual machine of the computing node; The basic information recording module is used to record the basic information of the virtual machine to the database corresponding to nova_api if no response indicating that the virtual machine's operating system is not frozen is obtained from the virtual machine based on the qga command within a preset time. This allows nova_api to retrieve the basic information from the database after receiving a read request from the user interface through the newly added second interface in nova_api and send the basic information to the user interface through the second interface.
7. An electronic device, characterized in that, It includes a processor and a memory; wherein, when the processor executes a computer program stored in the memory, it implements the virtual machine operating system freeze detection method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, Used to store computer programs; wherein, when the computer program is executed by a processor, it implements the virtual machine operating system freeze detection method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method for calling qemu guest agent interface through nova
CN111274053A