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

By modifying the judgment logic of the Libvirt driver, the problem of abnormal termination caused by insufficient memory during virtual machine startup was resolved, ensuring the stability of virtual machines and the continuity of business systems, and reducing the workload of operation and maintenance.

CN120653369BActive Publication Date: 2025-11-04SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In heterogeneous environments, there is a problem where the virtual machine process is abnormally terminated when the virtual machine starts up due to insufficient actual remaining memory on the compute node.

Method used

By modifying the judgment logic of the Libvirt driver, the memory usage is judged according to the virtual machine type before the virtual machine starts, ensuring that the host node has sufficient available memory and avoiding virtual machine startup failure.

Benefits of technology

This effectively prevents abnormal termination of virtual machines, ensures the stability of existing virtual machines, improves user experience and business system continuity, and reduces maintenance workload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653369B_ABST
    Figure CN120653369B_ABST
Patent Text Reader

Abstract

The application discloses a virtual machine available memory detection method and device in a heterogeneous environment and a medium, belongs to the technical field of cloud computing, and aims to solve the technical problem that the actual residual memory of a computing node cannot meet the virtual machine starting, and the forced starting of the virtual machine leads to the memory overflow of the computing node triggering process, that is, leads to the termination of the virtual machine process. The technical scheme is that Libvirt driving involved in the cloud management platform computing component program is modified, the use condition of memory is judged according to the virtual machine type classification when the virtual machine starts, the virtual machine is not started when the available memory of the host node is insufficient, and classification processing is carried out according to different scenes, so that the stability of the virtual machine in stock is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of cloud computing, in particular to a virtual machine available memory detection method and device in a heterogeneous environment and a medium. BACKGROUND

[0002] Linux kernel has a mechanism OOM killer (Out Of Memory killer), which monitors processes that occupy too much memory, especially processes that occupy memory very quickly, and then prevents memory depletion and automatically kills the process. When the kernel detects that the system memory is insufficient, it selects and kills a process, and when the system memory is insufficient, out_of_memory() is triggered, and then through the default selection algorithm, the process that occupies the most memory will be killed.

[0003] OpenStack is an open-source cloud computing management platform designed to help enterprises and organizations quickly build and manage private clouds or public cloud infrastructures. It integrates computing, storage, network and other resources to provide flexible and scalable cloud services, and is widely used in data center virtualization, hybrid cloud management and other scenarios.

[0004] In Linux systems, KVM (Kernel-based Virtual Machine) is one of the mainstream virtualization solutions, which belongs to type 1 hypervisor, that is, it runs directly on physical hardware. KVM is based on the Linux kernel part mechanism to implement main functions including CPU virtualization, memory virtualization, peripheral virtualization, and virtual machine management. It is a bridge that supports software simulation of hardware and connection between modes. KVM was born in 2006, initially developed by Qumranet company, and contributed to the open source community after being acquired by Red Hat in 2007, and integrated into the Linux kernel mainline (version 2.6.20) in 2008. Its design is based on the hardware virtualization extension of the Linux kernel (such as Intel VT-x or AMD-V), which uses the virtualization instruction set provided by the CPU to achieve efficient virtualization support. QEMU is an emulator that provides a running hardware environment for virtual machines. It runs as a process in the user mode of the host machine, and based on the characteristics of KVM and the kernel, it can simulate CPU, memory, IO and other hardware for Guest OS to run in a process. QEMU supports full system emulation, full virtualization and semi-virtualization modes. Full system emulation and full virtualization are pure software simulation, which allows a process built on one CPU to execute on another CPU. The difference is that full system emulation allows the entire system to be emulated, including CPU and peripheral devices, while semi-virtualization mode uses QEMU and KVM in cooperation, simulating the CPU through KVM hardware-assisted virtualization. This method is efficient and is currently the most commonly used method.

[0005] However, when starting a virtual machine, some virtual machines occupy the memory defined in the specification within a short time, such as virtual machines with passthrough devices, Windows series virtual machines, etc. Since these virtual machines occupy all the memory defined in the virtual machine specification, it will cause the virtual machine to occupy a large amount of memory when starting, and in the case of low available memory capacity on the host machine, the start of such large-specification virtual machines will occupy a large amount of memory in a short time and trigger the OOM memory recycling mechanism. Due to the large amount of memory of the virtual machine and the low priority of the virtual machine process, the virtual machine process is recycled first, that is, the virtual machine is abnormally closed. SUMMARY

[0006] The technical task of the present application is to provide a virtual machine available memory detection method, device and medium in a heterogeneous environment, to solve the problem that the actual remaining memory of the computing node cannot meet the virtual machine startup, and the forced startup of the virtual machine will cause the computing node to trigger the memory overflow of the process, that is, the virtual machine process will be terminated.

[0007] The technical task of the present application is achieved in the following manner, a virtual machine available memory detection method in a heterogeneous environment, the method is by modifying the Libvirt driver involved in the cloud management platform computing component program, judging the use of memory 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 different scenarios are classified and processed, and the stability of the inventory virtual machine is guaranteed.

[0008] As preferred, the judgment logic of the modified Libvirt driver involved in the cloud management platform computing component program is as follows:

[0009] S1, judge whether the virtual machine needs to be started:

[0010] ① If the virtual machine is not started, skip the available memory capacity judgment;

[0011] ② If the virtual machine is started, execute step S2;

[0012] S2, judge whether the available memory capacity of the computing node is greater than the memory marked in the virtual machine specification:

[0013] ① If the available memory capacity of the computing node is greater than the memory marked in the virtual machine specification, the virtual machine is allowed to start;

[0014] ② If the available memory capacity of the computing node is not greater than the memory marked in the virtual machine specification, execute step S3;

[0015] S3, judge whether the virtual machine applies to use Hugepage memory:

[0016] ① If the virtual machine applies to use Hugepage memory, the virtual machine is allowed to start;

[0017] ② If the virtual machine does not apply to use Hugepage memory, execute step S4;

[0018] S4, judge whether the operating system of the virtual machine is Windows system:

[0019] ① If the operating system of the virtual machine is Windows system, execute step S5;

[0020] ② If the operating system of the virtual machine is not Windows system, the virtual machine is allowed to start;

[0021] S5, judge whether the virtual machine is mounted with network card, NVMe or GPU pass-through device:

[0022] ① If the virtual machine is mounted with network card, NVMe or GPU pass-through device, throw out a prompt information of resource insufficient exception to prohibit starting;

[0023] If the virtual machine is not mounted with a network card, an NVMe or a GPU pass-through device, the virtual machine is allowed to start.

[0024] More preferably, the method judges the memory in eight virtual machine core 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 system scene operation, virtual machine start, restart, hard restart, cancel shelving operation and virtual machine concurrent operation for the case that the virtual machine fails to start due to insufficient memory.

[0025] More preferably, for the virtual machine creation operation, specifically: when the virtual machine fails to start due to insufficient local memory of the computing node, the management and control service on the computing node captures the memory shortage exception when constructing the instance method, and converts the memory shortage exception into a re-scheduling. In the case of retry opportunity (default is 3), the request of virtual machine creation will be sent back to the management service of the control node, and the scheduling service of the control node selects another computing node for processing to complete the virtual machine creation operation.

[0026] More preferably, for the virtual machine cold migration and cold reconfiguration operation, specifically: when the virtual machine is in a running state during the execution of cold migration and cold reconfiguration, after the execution of cold migration and cold reconfiguration, the virtual machine will also start (if the original state is shutdown, the virtual machine will still remain in the shutdown state). When the virtual machine starts, if the available memory of the computing node is insufficient, the XML configuration file of the virtual machine is defined and returned, and the virtual machine remains in the shutdown state. The management and control service on the computing node prints a warning level log to prompt that the virtual machine cannot start due to insufficient memory on the computing node server.

[0027] For the virtual machine online reconfiguration operation, specifically: by modifying the instance online resource size change method in the Libvirt driver, before modifying the upper limit of the available memory of the virtual machine, check whether the available memory of the computing node is greater than the difference between the memory of the new specification of the virtual machine and the memory of the old specification. If the available memory capacity of the computing node is insufficient, terminate the hot reconfiguration process.

[0028] More preferably, for the virtual machine evacuation operation, specifically: during the execution of the virtual machine evacuation, the state of the virtual machine before and after the evacuation needs to remain consistent. If the virtual machine starts on the target computing node after the evacuation, first judge whether the available memory capacity of the computing node meets the requirement of supporting the virtual machine to run before starting. If not, do not start the virtual machine, and the evacuation process ends normally. Output a warning level log in the management and control service of the target computing node to prompt that the virtual machine is not started due to insufficient memory, and the virtual machine is moved to another computing node with sufficient resources through the cold migration operation.

[0029] For the virtual machine startup, restart, hard restart, cancel the shelving operation, specifically: before performing the startup, restart, hard restart, cancel the shelving operation, check the available memory, if the memory is insufficient, do not start the virtual machine, only complete the XML file and output warning level log defined by the virtual machine.

[0030] More preferably, for the virtual machine rescue and rescue recovery operation, specifically: the virtual machine rescue is a mechanism for mounting the rescue system to repair the abnormal volume when the virtual machine system disk is abnormal, after performing the rescue operation, the virtual machine will be directly started, if the target computing node memory is insufficient, OOM will occur (since the rescue operation is operated in the local computing node, it generally will not occur), so the available memory capacity is verified before starting, and the virtual machine is prevented from starting when the memory is insufficient; the virtual machine state remains off, and the virtual machine performs the rescue recovery operation to recover, and the available memory capacity is noted during the recovery process, and the virtual machine cannot be started when the memory is insufficient, at this time the virtual machine is in the off state.

[0031] For the virtual machine reset system scenario operation, specifically: if there is a situation of switching from Linux to Windows, and the computing node where the virtual machine is located does not change before and after the switching, the available memory of the computing node still needs to be checked before starting, when the memory is insufficient, the virtual machine remains in the off state after the virtual machine is rebuilt.

[0032] More preferably, for two or more concurrent virtual machine operations in the 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, cancel the shelving operation, a task control queue is constructed, and the concurrent request tasks are put into the queue, so that the task control queue satisfies: when the memory space is sufficient (the available memory is greater than the specification of the concurrent virtual machine), the fast distribution is supported, and when the memory space is insufficient, the memory availability verification is performed in sequence through the queue tasks, so as to avoid the virtual machine process memory overflow fault caused by the actual insufficient node memory.

[0033] An electronic device, comprising: a memory and at least one processor;

[0034] The memory stores computer execution instructions;

[0035] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the virtual machine available memory detection method in the heterogeneous environment as described above.

[0036] A computer readable storage medium, the computer readable storage medium stores computer execution instructions, when the processor executes the computer execution instructions, the virtual machine available memory detection method in the heterogeneous environment as described above is realized.

[0037] The virtual machine available memory detection method, device and medium in the heterogeneous environment of the application have the following advantages:

[0038] (I) The application checks the virtual machine configuration and identifies the virtual machine with high memory usage in the case of low available memory in the host machine before starting the virtual machine, and prevents the start of this type of virtual machine, avoiding the abnormal termination of the virtual machine due to insufficient memory;

[0039] (II) The application designs 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 before starting, judging whether starting the virtual machine will cause a memory overflow exception on the node according to the type of the virtual machine;

[0040] (III) The application classifies the use of memory according to the type of the virtual machine when starting the virtual machine, and does not start the virtual machine when the available memory of the host node is insufficient, and classifies and processes different virtual machine operation scenarios to ensure the stability of the existing virtual machine, ensure user experience, improve the continuity of the operation of the business system in the virtual machine, and also reduce the maintenance workload caused by virtual machine failure due to memory overflow;

[0041] (IV) The application modifies the Libvirt driver involved in the cloud management platform computing component program, and classifies the use of memory according to the type of the virtual machine when starting the virtual machine, and does not start the virtual machine when the available memory of the host node is insufficient, and classifies and processes different scenarios to ensure the stability of the existing virtual machine to ensure user experience;

[0042] (V) The application provides a memory available resource detection process for multi-scenario virtual machine operation and start under a KVM virtualization cloud platform, which specifically involves the detection process of available memory resources for different virtual machine types when starting the virtual machine in the scenarios of virtual machine creation, virtual machine cold migration, virtual machine cold configuration change, virtual machine start, virtual machine rescue, virtual machine online configuration change, and virtual machine evacuation, thereby improving user experience. BRIEF DESCRIPTION OF DRAWINGS

[0043] The application will be further described below with reference to the accompanying drawings.

[0044] The application is attached Figure 1 A flowchart of the judgment logic of the modified Libvirt driver involved in the cloud management platform computing component program. DETAILED DESCRIPTION

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

[0046] Embodiment 1: The embodiment provides a method for detecting available memory of a virtual machine in a heterogeneous environment. The method is to modify a Libvirt driver involved in a cloud management platform computing component program, judge the use of memory according to the type classification of the virtual machine when starting the virtual machine, and not start the virtual machine when the available memory of the host node is insufficient, and classify and process according to different scenarios to ensure the stability of the inventory virtual machine.

[0047] As shown in the accompanying Figure 1 In the embodiment, the judgment logic of the modified Libvirt driver involved in the cloud management platform computing component program is as follows:

[0048] S1, judge whether to start the virtual machine:

[0049] ① If the virtual machine is not started, skip the available memory capacity judgment;

[0050] ② If the virtual machine is started, execute step S2;

[0051] S2, judge whether the available memory capacity of the computing node is greater than the memory marked in the virtual machine specification:

[0052] ① If the available memory capacity of the computing node is greater than the memory marked in the virtual machine specification, allow the virtual machine to start;

[0053] ② If the available memory capacity of the computing node is not greater than the memory marked in the virtual machine specification, execute step S3;

[0054] S3, judge whether the virtual machine applies to use Hugepage memory:

[0055] ① If the virtual machine applies to use Hugepage memory, allow the virtual machine to start;

[0056] ② If the virtual machine does not apply to use Hugepage memory, execute step S4;

[0057] S4, judge whether the operating system of the virtual machine is a Windows system:

[0058] ① If the operating system of the virtual machine is a Windows system, execute step S5;

[0059] ② If the operating system of the virtual machine is not a Windows system, allow the virtual machine to start;

[0060] S5, judge whether the virtual machine is mounted with a network card, NVMe or GPU pass-through device:

[0061] ①If the virtual machine is mounted with a pass-through device of a network card, NVMe or GPU, a prompt message of insufficient resources exception is thrown to prohibit starting;

[0062] ②If the virtual machine is not mounted with a pass-through device of a network card, NVMe or GPU, the virtual machine is allowed to start.

[0063] In this embodiment, when different types of virtual machines are operated and processed, for the case that the virtual machine fails to start due to insufficient memory, the memory in eight virtual machine core operation situations 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 system scene operation, virtual machine start, restart, hard restart, cancel shelving operation and virtual machine concurrent operation is judged, and the specific process is as follows:

[0064] ①For the virtual machine creation operation, specifically: when the virtual machine fails to start due to insufficient local memory of the computing node, the management and control service on the computing node captures the memory insufficient exception when building the instance method, and converts the memory insufficient exception into re-scheduling. In the case of retry opportunity (default is 3), the request of virtual machine creation will be sent back to the management service of the control node, and the scheduling service of the control node selects another computing node for processing to complete the virtual machine creation operation.

[0065] ②For the virtual machine cold migration and cold reconfiguration operation, specifically: when the state of the virtual machine is running during the execution of cold migration and cold reconfiguration, after the cold migration and cold reconfiguration are executed, the virtual machine will also start (if the original state is shutdown, the virtual machine will still remain in the shutdown state). When the virtual machine starts, if the available memory of the computing node is insufficient, the XML configuration file of the virtual machine is defined and returned, and the virtual machine remains in the shutdown state. The management and control service on the computing node prints a warning level log to prompt that the virtual machine cannot start due to insufficient memory on the computing node server.

[0066] ③For the virtual machine online reconfiguration operation, specifically: by modifying the instance online resource size change method in the Libvirt driver, before modifying the upper limit of the available memory of the virtual machine, it is checked whether the available memory of the computing node is greater than the difference between the memory of the new specification of the virtual machine and the memory of the old specification. When the available memory capacity of the computing node is insufficient, the hot reconfiguration process is terminated.

[0067] (4) For the virtual machine evacuation operation, specifically: when performing the virtual machine evacuation, the state of the virtual machine before and after the evacuation needs to be consistent, if the virtual machine is started on the target computing node after the evacuation, it is first judged whether the available memory capacity of the computing node meets the support for the virtual machine running before the start, if not, the virtual machine is not started, the evacuation process is normally ended, and a warning level log is output in the management and control service of the target computing node, prompting that the virtual machine is not started due to insufficient memory, and the virtual machine is moved to other computing nodes with sufficient resources through the cold migration operation;

[0068] (5) For the virtual machine start, restart, hard restart and cancel shelving operations, specifically: before performing the start, restart, hard restart and cancel shelving operations, the available memory is checked, if the memory is insufficient, the virtual machine is not started, and only the XML file defining the virtual machine and the warning level log are output;

[0069] (6) For the virtual machine rescue and rescue recovery operations, specifically: the virtual machine rescue is a mechanism for mounting a rescue system to repair an abnormal volume when the virtual machine system disk is abnormal, after performing the rescue operation, the virtual machine will be directly started, if the target computing node is insufficient in memory, OOM (Out Of Memory) will occur (since the rescue operation is operated on the local computing node, OOM generally does not occur), therefore, the available memory capacity is verified before the start, and the virtual machine is prevented from starting when the memory is insufficient; the state of the virtual machine remains off, and the virtual machine performs the rescue recovery operation for recovery, and the available memory capacity is noted during the recovery process, and the virtual machine cannot be started when the memory is insufficient, in which case the virtual machine is in an off state;

[0070] (7) For the virtual machine reset system scenario operation, specifically: if there is a situation of switching from Linux to Windows, and the computing node where the virtual machine is located does not change before and after the switching, the available memory of the computing node still needs to be checked before the start, and when the memory is insufficient, the virtual machine remains in an off state after the virtual machine is rebuilt;

[0071] (8) For two or more concurrent virtual machine operations in the virtual machine creation operation, the virtual machine cold migration and cold reconfiguration operation, the virtual machine online reconfiguration operation, the virtual machine evacuation operation, the virtual machine rescue and rescue recovery operation, the virtual machine reset system scenario operation, the virtual machine start, restart, hard restart and cancel shelving operation, a task control queue is constructed, and the concurrent request tasks are put into the queue, so that the task control queue meets the following conditions: when the memory space is sufficient (the available memory is greater than the specification of the concurrent virtual machine), the quick distribution is supported, and when the memory space is insufficient, the memory availability verification is sequentially performed on the queue tasks, so as to avoid the virtual machine process memory overflow fault caused by the actual insufficient memory of the node.

[0072] Embodiment 2: The embodiment also provides an electronic device, comprising: a memory and at least one processor;

[0073] The memory stores computer-executable instructions.

[0074] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method for detecting available memory of a virtual machine in a heterogeneous environment according to any one of the embodiments of the present application.

[0075] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), programmable logic devices (PLD) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor can be a microprocessor or the processor can also be any conventional processor.

[0076] The memory can be used to store computer programs and / or modules, and the processor can realize various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory and calling data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store operating systems, application programs required by at least one function, etc.; and the data storage area can store data created according to the use of the terminal, etc. In addition, the memory can also include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a secure digital (SD) card, a flash memory card, at least one disk storage period, a flash memory device, or other volatile solid-state memory devices.

[0077] Embodiment 3: The embodiment also provides a computer-readable storage medium, wherein a plurality of instructions are stored, the instructions are loaded by a processor, so that the processor executes the method for detecting available memory of a virtual machine in a heterogeneous environment according to any one of the embodiments of the present application. Specifically, a system or device provided with a storage medium can be provided, and software program code for realizing the functions of any one of the above embodiments is stored on the storage medium, and the computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.

[0078] In this case, the program code read from the storage medium can realize the functions of any one of the above embodiments, and therefore the program code and the storage medium storing the program code constitute a part of the present application.

[0079] The storage medium for providing the program code includes floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, nonvolatile memory cards and ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0080] Further, it should be clear that not only the program code read by the computer is executed, but also the operating system or the like operating on the computer is caused to perform part or all of the actual operations based on the instructions of the program code, thereby realizing the functions of any one of the above-described embodiments.

[0081] Further, it should be understood that the program code read by the storage medium is written into the memory provided in the expansion board inserted into the computer or the memory provided in the expansion unit connected to the computer, and then the CPU or the like mounted on the expansion board or the expansion unit is caused to perform part or all of the actual operations based on the instructions of the program code, thereby realizing the functions of any one of the above-described embodiments.

[0082] Finally, it should be noted that the above-described embodiments are merely used to illustrate the technical solutions of the present application, rather than limit the same; although the present application has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that the technical solutions recorded in the above-described embodiments can still be modified, or part or all of the technical features can be replaced equivalently; and these modifications or replacements do not make the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for detecting available memory in a virtual machine under heterogeneous conditions, characterized in that, This method modifies the Libvirt driver involved in the computing component program based on the cloud management platform. When starting a virtual machine, it judges the memory usage according to the virtual machine type. When the available memory on the host node is insufficient, the virtual machine is not started. The method is classified and handled according to different scenarios to ensure the stability of existing virtual machines. The modified Libvirt driver's judgment logic in the cloud management platform computing component program is as follows: S1. Determine if the virtual machine needs to be started: ① If the virtual machine is not started, the available memory capacity check will be skipped; ②If the virtual machine is started, proceed to step S2; S2. Determine if the available memory capacity of the compute node is greater than the memory specified in the virtual machine specification: ① If the available memory capacity of the compute node is greater than the memory specified in the virtual machine specification, then the virtual machine is allowed to start; ②If the available memory capacity of the compute node is not greater than the memory specified in the virtual machine specification, then proceed to step S3; S3. Determine if the virtual machine requests the use of large page memory: ① If the virtual machine requests to use large page memory, then allow the virtual machine to start; ②If the virtual machine does not request the use of large page memory, then proceed to step S4; S4. Determine if the virtual machine's operating system is Windows: ①If the virtual machine's operating system is Windows, then proceed to step S5; ② If the virtual machine's operating system is not Windows, then allow the virtual machine to start; S5. Determine if the virtual machine has a network card, NVMe, or GPU passthrough device mounted: ① If the virtual machine is connected to a network card, NVMe or GPU passthrough device, an error message indicating insufficient resources will be thrown and startup will be prohibited. ② If the virtual machine is not connected to a network card, NVMe or GPU passthrough device, then allow the virtual machine to start; When operating different types of virtual machines, for cases where virtual machines fail to start due to insufficient memory, memory is assessed under eight core virtual machine operation scenarios, including virtual machine creation, cold migration and cold reconfiguration, online reconfiguration, evacuation, rescue and recovery, system reset, startup, restart, hard reboot, cancellation of pending operations, and concurrent operations. Specifically, for virtual machine creation operations: when a virtual machine fails to start due to insufficient local memory on the compute node, the management service on the compute node catches the insufficient memory exception when constructing the instance method, and transforms the insufficient memory exception into a reschedule. If there is a chance to retry, 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 to process and complete the virtual machine creation operation. For virtual machine cold migration and cold reconfiguration operations, the specific steps are as follows: when the virtual machine is in the running state during cold migration or cold reconfiguration, the virtual machine will also start after the cold migration or cold reconfiguration is performed. If the available memory on the compute node is insufficient when the virtual machine starts, it will return after defining the virtual machine's XML configuration file, 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 online reconfiguration of virtual machines, the specific steps are as follows: Before modifying the method for changing the resource size of instances online in the Libvirt driver, it checks whether the available memory of the compute node is greater than the difference between the new and old memory specifications of the virtual machine before modifying the upper limit of available memory of the virtual machine. If the available memory capacity on the compute node is insufficient, the hot reconfiguration process is terminated. For virtual machine evacuation operations, the specific steps are as follows: When performing virtual machine evacuation, the state of the virtual machine before and after evacuation must remain consistent. If the virtual machine is started on the target compute node after evacuation, it is first determined whether the available memory capacity of the compute node is sufficient to support the virtual machine's operation before starting. If it is not sufficient, the virtual machine will not be started, the evacuation process will end normally, and a warning-level log will be output in the management service of the target compute node, indicating that the virtual machine will not be started due to insufficient memory. The virtual machine will be moved to other compute nodes with sufficient resources through a cold migration operation. For virtual machine startup, restart, hard reboot, and cancellation of shelving operations, specifically: before performing startup, restart, hard reboot, or cancellation of shelving operations, check available memory. If memory is insufficient, do not start the virtual machine, and only complete the definition of the virtual machine's XML file and output warning level logs. For virtual machine rescue and recovery operations, the specific steps are as follows: Virtual machine rescue is a mechanism to mount a rescue system to repair the abnormal volume when the virtual machine system disk is abnormal. After the rescue operation is performed, the virtual machine will start directly. If the target compute node has insufficient memory, an OutOfMemoryError (OOM) will occur. Therefore, the available memory capacity is checked before starting, and the virtual machine should not be started when memory is insufficient. The virtual machine is kept in a shutdown state, and the virtual machine performs a rescue recovery operation to recover. During the recovery process, attention should be paid to the available memory capacity. The virtual machine should not be started when memory is insufficient, and the virtual machine should remain in a shutdown state at this time. For virtual machine system reset scenarios, the specific operation is as follows: If there is a switch from Linux to Windows, and although the compute node where the virtual machine is located remains the same before and after the switch, it is still necessary to check the available memory of the compute node before starting. When the memory is insufficient, after the virtual machine is rebuilt, the virtual machine remains in a shut-down state. For concurrent virtual machine operations involving two or more virtual machines, including virtual machine creation, cold migration and cold reconfiguration, online reconfiguration, evacuation, rescue and recovery, system reset, startup, restart, hard reboot, and cancellation of pending operations, a task control queue is constructed to place concurrent request tasks into the queue. The task control queue satisfies the following requirements: when memory space is sufficient, it supports rapid distribution; when memory space is insufficient, it verifies memory availability sequentially through queued tasks, thus avoiding virtual machine process memory overflow failures caused by insufficient node memory.

2. An electronic device, characterized in that, include: Memory and at least one processor; The memory stores computer-executed instructions; The at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the virtual machine available memory detection method in a heterogeneous environment as described in claim 1.

3. 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, it implements the virtual machine available memory detection method in a heterogeneous environment as described in claim 1.

Citation Information

Patent Citations

  • Virtualization energy-saving system in Cloud computing

    CN104657215A

  • A method and system for automatically starting a virtual machine

    CN109814982A

  • Cloud platform virtual machine operating system anomaly detection and recovery method, equipment and medium

    CN119806745A