Method and device for detecting available memory of virtual machine in heterogeneous environment and medium

By modifying the judgment logic of the Libvirt driver and judging memory usage based on virtual machine type classification, the problem of insufficient memory when the virtual machine starts is solved, ensuring the stability of the virtual machine and user experience, and reducing the operation and maintenance workload.

CN120653369AActive Publication Date: 2025-09-16SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202511149387.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-18
Publication Date
2025-09-16
Estimated Expiration
2045-08-18

AI Technical Summary

Technical Problem

In a heterogeneous environment, when a virtual machine is started, the virtual machine process is abnormally shut down due to insufficient available memory on the computing node.

Method used

By modifying the judgment logic of the Libvirt driver, memory usage is judged according to the virtual machine type before the virtual machine is started, avoiding starting virtual machines when the host node has insufficient available memory. Classification processing is performed in different scenarios to ensure the stability of existing virtual machines.

Benefits of technology

It effectively avoids abnormal termination of virtual machines, improves user experience and business system continuity, reduces operation and maintenance workload, and ensures the stability and reliability of virtual machine operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653369A_ABST
    Figure CN120653369A_ABST
Patent Text Reader

Abstract

The invention discloses an available memory detection method and device for a virtual machine in a heterogeneous environment and a medium, belongs to the technical field of cloud computing, and aims to solve the technical problem that when the actual remaining memory amount of a computing node cannot meet the requirement for starting of the virtual machine, the memory of a computing node triggering process overflows due to the fact that the virtual machine is forcibly started. According to the technical scheme, a Libvirt driver involved in a computing component program based on a cloud management platform is modified, the use condition of a memory is judged according to the type classification of the virtual machine when the virtual machine is started, and when the available memory of a host node is insufficient, the virtual machine is not started, and classification processing is performed according to different scenes. And the stability of the stock virtual machine is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of cloud computing, and in particular to a method, device and medium for detecting available memory of a virtual machine in a heterogeneous environment. Background Art

[0002] The Linux kernel has an OOM killer (Out Of Memory Killer) mechanism that monitors processes that use excessive memory, especially those that use up memory quickly, and automatically kills them to prevent memory exhaustion. When the kernel detects low system memory, it selects and kills a process. When the system is low on memory, the out_of_memory() call is triggered, and the default selection algorithm selects the process that uses the most memory.

[0003] OpenStack is an open-source cloud computing management platform designed to help businesses and organizations quickly build and manage private or public cloud infrastructure. By integrating computing, storage, and networking resources, it provides flexible and scalable cloud services and is widely used in scenarios such as data center virtualization and hybrid cloud management.

[0004] In Linux, KVM (Kernel-based Virtual Machine) is a mainstream virtualization solution. It is a Type 1 hypervisor, meaning it runs directly on physical hardware. KVM leverages some of the Linux kernel's mechanisms to implement key functions, including CPU virtualization, memory virtualization, peripheral virtualization, and virtual machine management. It serves as a bridge between hardware emulation and the transition between different modes. KVM was originally developed by Qumranet in 2006. After being acquired by Red Hat in 2007, it was contributed to the open source community and integrated into the Linux kernel mainline (version 2.6.20) in 2008. Its design is based on hardware virtualization extensions in the Linux kernel (such as Intel VT-x or AMD-V), leveraging the CPU's virtualization instruction set for efficient virtualization support. QEMU is an emulator that provides a hardware environment for virtual machines. It runs as a process in user mode on the host machine. Leveraging the features of KVM and the kernel, it emulates the CPU, memory, I / O, and other hardware for guest operating systems, allowing them to run in-process. QEMU supports full-system emulation, full virtualization, and paravirtualization modes. Full-system emulation and full virtualization are pure software emulations that allow processes built on one CPU to be executed on another CPU. The difference is that full-system emulation allows the entire system to be emulated, including the CPU and its peripherals, while paravirtualization mode uses QEMU in conjunction with KVM to emulate the CPU through KVM hardware-assisted virtualization. This method is highly efficient and is currently the most commonly used method.

[0005] However, when starting a virtual machine, some virtual machines, such as virtual machines with passthrough devices and Windows-based virtual machines, will quickly fill up the memory defined in the specifications. Since these virtual machines occupy all the memory defined in the virtual machine specifications, they will occupy a high memory capacity when starting the virtual machine. If the host machine has low available memory capacity, starting such large-scale virtual machines will quickly occupy a large amount of memory and may trigger the OOM memory recycling mechanism. Due to the large amount of memory in the virtual machine and the low priority of the virtual machine process, the existing virtual machine process will be recycled first, and the virtual machine will be abnormally shut down. Summary of the Invention

[0006] The technical task of the present invention is to provide a method, device and medium for detecting the available memory of a virtual machine in a heterogeneous environment, so as to solve the problem that when the actual remaining memory of the computing node cannot meet the needs of the virtual machine startup, forcibly starting the virtual machine will cause the memory overflow of the computing node triggering the process, that is, the virtual machine process will be terminated.

[0007] The technical task of the present invention is achieved in the following way: a method for detecting available memory of virtual machines in a heterogeneous environment. The method is to modify the Libvirt driver involved in the computing component program based on the cloud management platform, and judge the memory usage according to the virtual machine type classification when starting the virtual machine. When the available memory of the host node is insufficient, the virtual machine is not started, and classified processing is performed according to different scenarios to ensure the stability of the existing virtual machines.

[0008] As a preferred embodiment, the modified judgment logic of the Libvirt driver involved in the cloud management platform computing component program is as follows: S1. Determine whether the virtual machine needs to be started: ① If the virtual machine is not started, skip the available memory capacity judgment; ② If the virtual machine is started, execute step S2; S2. Determine whether the available memory capacity of the compute node is greater than the memory specified in the virtual machine specifications: ① If the available memory capacity of the computing node is greater than the memory specified in the virtual machine specifications, the virtual machine is allowed to start; ② If the available memory capacity of the computing node is not greater than the memory specified in the virtual machine specifications, execute step S3; S3. Determine whether the virtual machine has requested the use of hugepage memory: ① If the virtual machine requests to use large page memory, the virtual machine is allowed to start; ② If the virtual machine does not apply to use large page memory, execute step S4; S4. Determine whether the operating system of the virtual machine is Windows: ① If the operating system of the virtual machine is Windows, execute step S5; ② If the virtual machine's operating system is not Windows, allow the virtual machine to start; S5. Determine whether the virtual machine has a network card, NVMe, or GPU pass-through device mounted: ① If the virtual machine is mounted with a network card, NVMe or GPU pass-through device, a prompt message indicating insufficient resources and prohibiting startup will be thrown; ② If the virtual machine does not have a network card, NVMe, or GPU pass-through device mounted, the virtual machine is allowed to start.

[0009] More preferably, when operating different types of virtual machines, the method judges the memory in eight core virtual machine operation scenarios, including virtual machine creation operations, virtual machine cold migration and cold reconfiguration operations, virtual machine online reconfiguration operations, virtual machine evacuation operations, virtual machine rescue and rescue recovery operations, virtual machine reset system scenario operations, virtual machine startup, restart, hard restart, unsuspend operations, and virtual machine concurrent operations, in response to the situation where the virtual machine fails to start due to insufficient memory.

[0010] More optimally, for virtual machine creation operations, specifically: when a virtual machine fails to start due to insufficient local memory on the compute node, the management service on the compute node captures the insufficient memory exception when constructing the instance method, and converts the insufficient memory exception into a rescheduling request. If there are retry opportunities (the default is 3), the virtual machine creation request will be sent back to the management service of the control node, and the scheduling service of the control node will select another compute node for processing to complete the virtual machine creation operation.

[0011] More optimally, for virtual machine cold migration and cold reconfiguration operations, specifically: if the virtual machine is in the running state when performing cold migration or cold reconfiguration, the virtual machine will also be started after the cold migration or cold reconfiguration (if the original state is shut down, the virtual machine will remain in the shut down state). When the virtual machine is started, if the compute node has insufficient available memory, the virtual machine will return after defining the XML configuration file of the virtual machine, and the virtual machine will remain in the shut down state. The management service on the compute node will print a warning-level log to indicate that the virtual machine cannot be started due to insufficient memory on the compute node server. For virtual machine online reconfiguration operations, specifically: by modifying the instance online resource size change method in the Libvirt driver, before changing the upper limit of the virtual machine's available memory, check whether the available memory of the computing node is greater than the difference between the new memory specification of the virtual machine and the old memory specification. If the available memory capacity on the computing node is insufficient, the hot reconfiguration process is terminated.

[0012] More preferably, for the virtual machine evacuation operation, specifically: when performing a virtual machine evacuation, the state of the virtual machine before and after the evacuation must be consistent. If the virtual machine is started on the target computing node after the evacuation, before starting it, it is first determined whether the available memory capacity of the computing node is sufficient to support the operation of the virtual machine. If not, the virtual machine is not started. The evacuation process ends normally, and a warning-level log is output in the control service of the target computing node, prompting that the virtual machine will not be started due to insufficient memory, and the virtual machine is moved to another computing node with sufficient resources through a cold migration operation; For virtual machine startup, restart, hard restart, and unsuspend operations, specifically: Before executing the startup, restart, hard restart, and unsuspend operations, check the available memory. If the memory is insufficient, the virtual machine will not be started. Only the XML file defining the virtual machine will be completed and the warning level log will be output.

[0013] More preferably, for virtual machine rescue and rescue recovery operations, specifically: virtual machine rescue is a mechanism for mounting a rescue system to repair abnormal volumes when the virtual machine system disk is abnormal. After executing the rescue operation, the virtual machine will start directly. If the target computing node does not have enough memory, OOM will occur (because the rescue operation is performed on the local computing node, it generally does not occur). Therefore, the available memory capacity is checked before startup, and the virtual machine is avoided from starting when the memory is insufficient; the virtual machine state remains in shutdown, and the virtual machine executes the rescue recovery operation for recovery. During the recovery process, pay attention to the available memory capacity. The virtual machine cannot be started when the memory is insufficient. At this time, the virtual machine is in shutdown state.

[0014] For virtual machine system reset scenarios, specifically: If you switch from Linux to Windows, and although the compute node where the virtual machine resides remains unchanged before and after the switch, you still need to check the available memory on the compute node before starting it. If the memory is insufficient, the virtual machine remains in the shutdown state after the virtual machine is rebuilt.

[0015] More preferably, for two or more concurrent virtual machine operations among virtual machine creation operations, virtual machine cold migration and cold reconfiguration operations, virtual machine online reconfiguration operations, virtual machine evacuation operations, virtual machine rescue and rescue recovery operations, virtual machine reset system scenario operations, virtual machine startup, restart, hard restart, and unsuspend operations, a task control queue is constructed and concurrent request tasks are placed in the queue, so that the task control queue meets the following requirements: when memory space is sufficient (when the available memory is greater than the specifications of the concurrent virtual machines), fast distribution is supported; when memory space is insufficient, memory availability is verified in sequence through queue tasks to avoid virtual machine process memory overflow failures caused by insufficient node memory.

[0016] An electronic device comprising: a memory and at least one processor; wherein the memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the above-mentioned method for detecting available memory of a virtual machine in a heterogeneous environment.

[0017] A computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method for detecting available memory of a virtual machine in a heterogeneous environment as described above is implemented.

[0018] The method, device, and medium for detecting available memory of a virtual machine in a heterogeneous environment of the present invention have the following advantages: (1) The present invention checks the virtual machine configuration and identifies virtual machines that use a lot of memory before starting a virtual machine when the host machine's available memory is low, and blocks the startup of such virtual machines, thereby avoiding abnormal termination of virtual machines due to insufficient memory. (2) The present invention designs and modifies a method for creating a virtual machine with a virtual network in the Libvirt driver used by the computing component and a method for creating a virtual machine to determine, before starting the virtual machine, whether starting the virtual machine will cause a memory overflow exception on the node according to the virtual machine type; (3) The present invention classifies memory usage based on the virtual machine type when starting a virtual machine. When the host node has insufficient available memory, the virtual machine is not started. The virtual machine is classified and processed according to different operating scenarios. This ensures the stability of existing virtual machines, guarantees user experience, and improves the continuity of business system operations within the virtual machine. At the same time, it also reduces the operation and maintenance workload caused by virtual machine failures due to memory overflow. (4) This invention modifies the Libvirt driver involved in the cloud management platform computing component program. When starting a virtual machine, it determines memory usage based on the virtual machine type. If the host node has insufficient available memory, the virtual machine will not be started. This classification is performed according to different scenarios to ensure the stability of existing virtual machines and guarantee a good user experience. (5) The present invention provides a process for detecting available memory resources during multi-scenario virtual machine operations and startup based on a KVM virtualization cloud platform. Specifically, it involves a process for detecting available memory resources for different virtual machine types during virtual machine startup in scenarios such as virtual machine creation, virtual machine cold migration, virtual machine cold reconfiguration, virtual machine startup, virtual machine rescue, virtual machine online reconfiguration, and virtual machine evacuation, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The present invention will be further described below with reference to the accompanying drawings.

[0020] Attachment Figure 1 This is a flowchart of the modified Libvirt-driven judgment logic involved in the cloud management platform computing component program. DETAILED DESCRIPTION

[0021] The method, device and medium for detecting available memory of a virtual machine in a heterogeneous environment of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments.

[0022] Example 1: This example provides a method for detecting available memory of a virtual machine in a heterogeneous environment. The method is to modify the Libvirt driver involved in the computing component program based on the cloud management platform, and to judge the memory usage according to the virtual machine type classification when starting the virtual machine. When the available memory of the host node is insufficient, the virtual machine is not started, and classification processing is performed according to different scenarios to ensure the stability of the existing virtual machines.

[0023] As attached Figure 1 As shown, in this embodiment, the modified judgment logic of the Libvirt driver involved in the cloud management platform computing component program is as follows: S1. Determine whether the virtual machine needs to be started: ① If the virtual machine is not started, skip the available memory capacity judgment; ② If the virtual machine is started, execute step S2; S2. Determine whether the available memory capacity of the compute node is greater than the memory specified in the virtual machine specifications: ① If the available memory capacity of the computing node is greater than the memory specified in the virtual machine specifications, the virtual machine is allowed to start; ② If the available memory capacity of the computing node is not greater than the memory specified in the virtual machine specifications, execute step S3; S3. Determine whether the virtual machine has requested the use of hugepage memory: ① If the virtual machine requests to use large page memory, the virtual machine is allowed to start; ② If the virtual machine does not apply to use large page memory, execute step S4; S4. Determine whether the operating system of the virtual machine is Windows: ① If the operating system of the virtual machine is Windows, execute step S5; ② If the virtual machine's operating system is not Windows, allow the virtual machine to start; S5. Determine whether the virtual machine has a network card, NVMe, or GPU pass-through device mounted: ① If the virtual machine is mounted with a network card, NVMe or GPU pass-through device, a prompt message indicating insufficient resources and prohibiting startup will be thrown; ② If the virtual machine does not have a network card, NVMe, or GPU pass-through device mounted, the virtual machine is allowed to start.

[0024] In this embodiment, when operating different types of virtual machines, in the event that a virtual machine fails to start due to insufficient memory, memory usage is determined in eight core virtual machine operation scenarios, including virtual machine creation, virtual machine cold migration and cold reconfiguration, virtual machine online reconfiguration, virtual machine evacuation, virtual machine rescue and rescue recovery, virtual machine system reset scenario operation, virtual machine startup, restart, hard restart, unsuspend operation, and virtual machine concurrent operation. The details are as follows: ① Regarding virtual machine creation operations, specifically: when a virtual machine fails to start due to insufficient local memory on the compute node, the control service on the compute node captures the out-of-memory exception when constructing the instance method and converts the out-of-memory exception into a rescheduling request. If there are retry opportunities (the default is 3), the virtual machine creation request will be sent back to the management service of the control node. The scheduling service of the control node will select another compute node for processing, completing the virtual machine creation operation. ② Regarding virtual machine cold migration and cold reconfiguration operations, specifically: If the virtual machine is in the running state when performing cold migration or cold reconfiguration, it will also be started after the cold migration or cold reconfiguration (if the original state is shut down, the virtual machine will remain in the shut down state). When the virtual machine is started, if the compute node has insufficient available memory, it will return after defining the virtual machine's XML configuration file, and the virtual machine will remain in the shut down state. The management service on the compute node will print a warning-level log, indicating that the virtual machine cannot be started due to insufficient memory on the compute node server; ③ Regarding the online reconfiguration of virtual machines, specifically: by modifying the instance online resource size change method in the Libvirt driver, before changing the upper limit of the virtual machine's available memory, check whether the available memory of the computing node is greater than the difference between the new memory size of the virtual machine and the old memory size. If the available memory capacity on the computing node is insufficient, the hot reconfiguration process is terminated; ④ Regarding the virtual machine evacuation operation, specifically: when performing a virtual machine evacuation, the state of the virtual machine before and after the evacuation must remain consistent. If the virtual machine is started on the target computing node after the evacuation, the available memory capacity of the computing node is first determined before startup to determine whether it can support the operation of the virtual machine. If not, the virtual machine will not be started. The evacuation process ends normally, and a warning-level log is output in the control service of the target computing node, indicating that the virtual machine will not be started due to insufficient memory. The virtual machine is moved to another computing node with sufficient resources through cold migration. ⑤ Regarding virtual machine startup, restart, hard restart, and unsuspend operations, specifically: before executing startup, restart, hard restart, and unsuspend operations, check the available memory. If the memory is insufficient, the virtual machine will not be started, and only the XML file defining the virtual machine and the warning level log will be output; ⑥ Regarding virtual machine rescue and rescue recovery operations, specifically: virtual machine rescue is a mechanism that mounts a rescue system to repair abnormal volumes when the virtual machine system disk is abnormal. After the rescue operation is executed, the virtual machine will start directly. If the target computing node has insufficient memory, OOM will occur (because the rescue operation is performed on the local computing node, it generally does not occur). Therefore, the available memory capacity is checked before startup, and the virtual machine is prevented from starting when the memory is insufficient. The virtual machine state remains in shutdown, and the virtual machine performs the rescue recovery operation to recover. During the recovery process, pay attention to the available memory capacity. If the memory is insufficient, the virtual machine cannot be started and is in shutdown state at this time. ⑦ For virtual machine system reset scenarios, specifically: if you switch from Linux to Windows, and the compute node where the virtual machine is located remains unchanged before and after the switch, you still need to check the available memory of the compute node before starting it. If the memory is insufficient, the virtual machine will remain in the shutdown state after the virtual machine is rebuilt; ⑧For two or more concurrent virtual machine operations among virtual machine creation operations, virtual machine cold migration and cold reconfiguration operations, virtual machine online reconfiguration operations, virtual machine evacuation operations, virtual machine rescue and rescue recovery operations, virtual machine reset system scenario operations, virtual machine startup, restart, hard restart, and unsuspend operations, a task control queue is constructed and concurrent request tasks are placed in the queue. The task control queue meets the following requirements: when there is sufficient memory space (when the available memory is greater than the specifications of the concurrent virtual machines), fast distribution is supported. When memory space is insufficient, memory availability is verified in sequence through queue tasks to avoid virtual machine process memory overflow failures caused by insufficient node memory.

[0025] Embodiment 2: This embodiment further provides an electronic device, including: a memory and at least one processor; wherein the memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method for detecting available memory of a virtual machine in a heterogeneous environment according to any one of the present inventions.

[0026] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor may be a microprocessor or any conventional processor, etc.

[0027] The memory can be used to store computer programs and / or modules. The processor implements various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and accessing the data stored in the memory. The memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system and at least one application required for the function; the data storage area can store data generated based on the use of the terminal. In addition, the memory can also include high-speed random access memory and non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a smart card (SMC), a secure digital (SD) card, a flash memory card, at least one disk storage device, a flash memory device, or other volatile solid-state memory devices.

[0028] Embodiment 3: This embodiment further provides a computer-readable storage medium storing a plurality of instructions. The instructions are loaded by a processor, causing the processor to execute the method for detecting available memory for a virtual machine in a heterogeneous environment according to any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided. The storage medium stores software program code that implements the functions of any of the above embodiments, and the computer (or CPU or MPU) of the system or device can read and execute the program code stored in the storage medium.

[0029] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute part of the present invention.

[0030] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (e.g., CD-ROMs, CD-Rs, CD-RWs, DVD-ROMs, DVD-RAMs, DVD-RWs, and DVD+RWs), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer via a communications network.

[0031] In addition, it should be clear that the functions of any of the above embodiments can be achieved not only by executing the program code read by the computer, but also by enabling the operating system operating on the computer to complete part or all of the actual operations based on the instructions of the program code.

[0032] In addition, it can be understood that the program code read from the storage medium is written into the memory provided in the expansion board inserted into the computer or into the memory provided in the expansion unit connected to the computer, and then based on the instructions of the program code, the CPU installed on the expansion board or expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above embodiments.

[0033] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting available memory of a virtual machine in a heterogeneous environment, characterized in that: This method is to modify the Libvirt driver involved in the computing component program based on the cloud management platform, and judge the memory usage according to the virtual machine type classification when starting the virtual machine. When the host node has insufficient available memory, the virtual machine will not be started, and classified processing will be performed according to different scenarios to ensure the stability of the existing virtual machines.

2. The method for detecting available memory of a virtual machine in a heterogeneous environment according to claim 1, wherein: The modified judgment logic of the Libvirt driver involved in the cloud management platform computing component program is as follows: S1. Determine whether the virtual machine needs to be started: ① If the virtual machine is not started, skip the available memory capacity judgment; ② If the virtual machine is started, execute step S2; S2. Determine whether the available memory capacity of the compute node is greater than the memory specified in the virtual machine specifications: ① If the available memory capacity of the computing node is greater than the memory specified in the virtual machine specifications, the virtual machine is allowed to start; ② If the available memory capacity of the computing node is not greater than the memory specified in the virtual machine specifications, execute step S3; S3. Determine whether the virtual machine has requested the use of large page memory: ① If the virtual machine requests to use large page memory, the virtual machine is allowed to start; ② If the virtual machine does not apply to use large page memory, execute step S4; S4. Determine whether the operating system of the virtual machine is Windows: ① If the operating system of the virtual machine is Windows, execute step S5; ② If the virtual machine's operating system is not Windows, allow the virtual machine to start; S5. Determine whether the virtual machine has a network card, NVMe, or GPU pass-through device mounted: ① If the virtual machine is mounted with a network card, NVMe or GPU pass-through device, a prompt message indicating insufficient resources and prohibiting startup will be thrown; ② If the virtual machine does not have a network card, NVMe, or GPU pass-through device mounted, the virtual machine is allowed to start.

3. The method for detecting available memory of a virtual machine in a heterogeneous environment according to claim 1 or 2, wherein: When operating different types of virtual machines, this method judges the memory in eight core virtual machine operation scenarios, including virtual machine creation operation, virtual machine cold migration and cold reconfiguration operation, virtual machine online reconfiguration operation, virtual machine evacuation operation, virtual machine rescue and rescue recovery operation, virtual machine reset system scenario operation, virtual machine startup, restart, hard restart, unsuspend operation and virtual machine concurrent operation, in response to the situation where the virtual machine fails to start due to insufficient memory.

4. The method for detecting available memory of a virtual machine in a heterogeneous environment according to claim 3, wherein: Regarding the virtual machine creation operation, specifically: when the virtual machine fails to start due to insufficient local memory on the computing node, the management service on the computing node captures the insufficient memory exception when building the instance method, and converts the insufficient memory exception into a rescheduling. If there is a retry opportunity, the virtual machine creation request will be sent back to the management service of the control node, and the scheduling service of the control node will select another computing node for processing to complete the virtual machine creation operation.

5. The method for detecting available memory of a virtual machine in a heterogeneous environment according to claim 3, wherein: For virtual machine cold migration and cold reprovisioning operations, specifically: If the virtual machine is in the running state when performing cold migration or cold reprovisioning, the virtual machine will also be started after the cold migration or cold reprovisioning. When the virtual machine starts, if the compute node has insufficient available memory, the virtual machine will return after defining the XML configuration file of the virtual machine, and the virtual machine will remain in the shutdown state. The management service on the compute node will print a warning-level log, indicating that the virtual machine cannot start due to insufficient memory on the compute node server. For virtual machine online reconfiguration operations, specifically: by modifying the instance online resource size change method in the Libvirt driver, before changing the upper limit of the virtual machine's available memory, check whether the available memory of the computing node is greater than the difference between the new memory specification of the virtual machine and the old memory specification. If the available memory capacity on the computing node is insufficient, the hot reconfiguration process is terminated.

6. The method for detecting available memory of a virtual machine in a heterogeneous environment according to claim 3, wherein: The specific steps for virtual machine evacuation are as follows: When performing a virtual machine evacuation, the virtual machine status before and after the evacuation must remain consistent. If the virtual machine is started on the target compute node after the evacuation, the available memory capacity of the compute node is first determined before startup to determine whether it is sufficient to support the virtual machine operation. If not, the virtual machine will not be started. The evacuation process ends normally, and a warning-level log is output in the control service of the target compute node, indicating that the virtual machine will not be started due to insufficient memory. The virtual machine is moved to another compute node with sufficient resources through cold migration. For virtual machine startup, restart, hard restart, and unsuspend operations, specifically: Before executing the startup, restart, hard restart, and unsuspend operations, check the available memory. If the memory is insufficient, the virtual machine will not be started. Only the XML file defining the virtual machine will be completed and the warning level log will be output.

7. The method for detecting available memory of a virtual machine in a heterogeneous environment according to claim 3, wherein: Regarding virtual machine rescue and rescue recovery operations, specifically: virtual machine rescue is a mechanism that mounts a rescue system to repair abnormal volumes when the virtual machine system disk is abnormal. After executing the rescue operation, the virtual machine will start directly. If the target computing node has insufficient memory, OOM will occur. Therefore, the available memory capacity is checked before startup, and the virtual machine is prevented from starting when the memory is insufficient. The virtual machine state remains in shutdown, and the virtual machine performs rescue recovery operations to recover. During the recovery process, pay attention to the available memory capacity. If the memory is insufficient, the virtual machine cannot be started and is in shutdown state. For virtual machine system reset scenarios, specifically: If you switch from Linux to Windows, and although the compute node where the virtual machine resides remains unchanged before and after the switch, you still need to check the available memory on the compute node before starting it. If the memory is insufficient, the virtual machine remains in the shutdown state after the virtual machine is rebuilt.

8. The method for detecting available memory of a virtual machine in a heterogeneous environment according to claim 3, wherein: For two or more concurrent virtual machine operations including virtual machine creation, virtual machine cold migration and cold reconfiguration, virtual machine online reconfiguration, virtual machine evacuation, virtual machine rescue and rescue recovery, virtual machine reset system scenario, virtual machine startup, restart, hard restart, and unsuspend operations, a task control queue is constructed and concurrent request tasks are placed in the queue to ensure that the task control queue meets the following requirements: fast distribution is supported when memory space is sufficient, and memory availability is verified in sequence through queue tasks when memory space is insufficient, to avoid virtual machine process memory overflow failures caused by insufficient node memory.

9. An electronic device, characterized in that: include: memory and at least one processor; wherein the memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method for detecting available memory of a virtual machine in a heterogeneous environment according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method for detecting available memory of a virtual machine in a heterogeneous environment as claimed in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Virtualization energy-saving system in Cloud computing

    CN104657215A

  • Method for converting vmware virtual machine into kvm virtual machine

    CN106201653A

  • Setting method and device of available memory space of host

    CN107766122A

  • A method and system for automatically starting a virtual machine

    CN109814982A

  • Cluster DPDK stability test method and system, terminal and storage medium

    CN111475349A