Virtual machine live migration function enhancement method and device, equipment and storage medium

By judging and translating unexecutable instructions on the target node, the virtual machine hot migration is successful when the CPU support feature of the target node does not completely cover the source node, which solves the problem of the virtual machine hot migration being limited by hardware conditions and improves the migration success rate and applicability.

CN119248422APending Publication Date: 2025-01-03CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411317769.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Virtual machine hot migration cannot be successfully implemented if the support characteristics of the target node CPU do not completely cover the CPU feature set of the source node, and is limited by the target node hardware conditions.

Method used

After the target node receives the virtual machine migration data, it judges and translates instructions that the target node cannot execute, making them executable instructions, thereby realizing hot migration of the virtual machine when the support characteristics do not match completely.

Benefits of technology

Improves the success rate and applicability of hot migration of virtual machines, allowing virtual machines to execute all instructions on the target node, free from hardware conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248422A_ABST
    Figure CN119248422A_ABST
Patent Text Reader

Abstract

The invention relates to a virtual machine live migration function enhancement method and device, equipment and a storage medium. According to the method and the device, after the target node receives all the live migration data of the virtual machine, the virtual machine instruction which cannot be supported by the physical CPU of the target node can be translated into the instruction which can be executed by the physical CPU of the target node, so that the virtual machine instruction can be translated into the instruction which can be executed by the physical CPU of the target node. When the support characteristic of the CPU of the target node does not completely contain the support characteristic of the CPU of the source node or the CPU characteristic set of the source node does not belong to the subset of the CPU characteristic set of the target node, the CPU of the target node can execute all instructions of the virtual machine, so that the live migration of the virtual machine from the source node to the target node is successfully realized; the live migration of the virtual machine is not limited by the hardware condition of the target node any more, and the success rate and applicability of the live migration of the virtual machine are greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for enhancing the hot migration function of a virtual machine. Background Art

[0002] With the development of computer technology, cloud computing has become an important foundation of the modern information technology industry. Virtual machines and containers are regarded as the cornerstones of cloud-native technology, which can more efficiently utilize system resources, ensure a consistent operating environment, and more easily migrate and expand business.

[0003] In order to make better use of hardware resources, the cloud platform needs to run virtual machines on appropriate hardware nodes. When business migration, load balancing, cluster node replacement and upgrade are required between nodes in the cluster, in order to ensure the normal operation of the business in the virtual machine on the target node, the virtual machine can be migrated between different cluster nodes through virtual machine hot migration. Virtual machine hot migration technology refers to the process of migrating a virtual machine from one physical host to another without stopping the operation of the virtual machine.

[0004] At present, hot migration of virtual machines can only be successfully achieved when the supported features of the target node CPU cover the supported features of the source node CPU or the source node CPU feature set is a subset of the target node CPU feature set. If the supported features of the target node CPU do not completely include the supported features of the source node CPU or the source node CPU feature set does not belong to the subset of the target node CPU feature set, the target node CPU cannot execute all the instructions of the virtual machine, resulting in the failure of hot migration of the virtual machine. In this case, hot migration of the virtual machine is seriously restricted by the hardware conditions of the target node and cannot be achieved. Summary of the invention

[0005] In order to solve the above technical problems, the present disclosure provides a method, device, equipment and storage medium for enhancing the hot migration function of a virtual machine.

[0006] A first aspect of the present disclosure provides a method for enhancing a virtual machine live migration function, comprising:

[0007] In response to the target node receiving all hot migration data of the virtual machine sent by the source node, the target node runs the to-be-executed instructions of the virtual machine;

[0008] When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, it is determined whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine, and the supported instruction of the virtual CPU is a supported instruction of the physical CPU of the source node;

[0009] If yes, perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node;

[0010] Otherwise, it is determined that the pending instruction cannot be executed.

[0011] A second aspect of the present disclosure provides a device for enhancing a virtual machine hot migration function, comprising:

[0012] An operation module, configured to execute the to-be-executed instructions of the virtual machine at the target node in response to the target node receiving all the hot migration data of the virtual machine sent by the source node;

[0013] A judgment module, used for judging whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine when the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, and the supported instruction of the virtual CPU is a supported instruction of the physical CPU of the source node;

[0014] A translation module, for performing instruction translation on the instruction to be executed, translating the instruction to be executed into a target instruction executable by the physical CPU of the target node, and executing the target instruction based on the physical CPU of the target node;

[0015] The determination module is used to determine that the instruction to be executed cannot be executed.

[0016] A third aspect of the present disclosure provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the virtual machine hot migration function enhancement method of the above-mentioned first aspect can be implemented.

[0017] A fourth aspect of the present disclosure provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method for enhancing the virtual machine hot migration function of the first aspect can be implemented.

[0018] Compared with the prior art, the technical solution provided by the present invention has the following advantages:

[0019] The present disclosure responds to the target node receiving all the hot migration data of the virtual machine sent by the source node, and the target node runs the to-be-executed instructions of the virtual machine; when the to-be-executed instructions belong to the illegal instructions that the physical CPU of the target node cannot execute, it is judged whether the to-be-executed instructions belong to the support instructions of the virtual CPU of the virtual machine, and the support instructions of the virtual CPU belong to the support instructions of the physical CPU of the source node; if so, the to-be-executed instructions are translated into target instructions that the physical CPU of the target node can execute, and the target instructions are executed based on the physical CPU of the target node; otherwise, it is determined that the to-be-executed instructions cannot be executed. The present disclosure can translate the virtual machine instructions into the instructions that the physical CPU of the target node cannot support after the target node receives all the hot migration data of the virtual machine, thereby, when the support characteristics of the CPU of the target node do not completely include the support characteristics of the CPU of the source node or the CPU feature set of the source node does not belong to the subset of the CPU feature set of the target node, the CPU of the target node can execute all the instructions of the virtual machine, and successfully realize the hot migration of the virtual machine from the source node to the target node, and the hot migration of the virtual machine is no longer restricted by the hardware conditions of the target node, which greatly improves the success rate and applicability of the hot migration of the virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0022] Figure 1 It is a flow chart of a method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure;

[0023] Figure 2 is a flow chart of another method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure;

[0024] Figure 3 is a flowchart of another method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure;

[0025] Figure 4 is a flow chart of another method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure;

[0026] Figure 5It is a structural schematic diagram of a device for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure;

[0027] Figure 6 It is a structural diagram of a computer device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0029] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0030] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0031] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0033] The method for enhancing the hot migration function of a virtual machine provided in the embodiments of the present disclosure may be executed by a computer device, which may be understood as any device with processing and computing capabilities. The device may be a target node for hot migration of a virtual machine, and the device may include but is not limited to electronic devices such as servers and computers.

[0034] In order to better understand the inventive concept of the embodiments of the present disclosure, the technical solutions of the embodiments of the present disclosure are described below in conjunction with exemplary embodiments.

[0035] Figure 1 is a flowchart of a method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure. The method can be executed by a computer device, which can be a target node for hot migration of a virtual machine, such as Figure 1 As shown, the method for enhancing the virtual machine hot migration function provided in this embodiment includes the following steps:

[0036] Step 110 : In response to the target node receiving all the hot migration data of the virtual machine sent by the source node, the target node runs the to-be-executed instructions of the virtual machine.

[0037] In the embodiment of the present disclosure, during the hot migration of a virtual machine from a source node to a target node, the source node may send all hot migration data in the virtual machine to the target node, and all hot migration data include the memory (RAM) data and device status data of the virtual machine. Specifically, the source node may mark the memory data of the virtual machine as dirty data, and then continuously send the memory data of the virtual machine to the target node until a preset stop condition is met. The preset stop condition may be set as needed, for example, if the rate at which dirty pages are generated in the memory of the virtual machine (RAM dirty-rate) is less than a preset threshold, the source node stops running the virtual machine and sends the remaining memory data of the virtual machine and the device status data of the virtual machine to the target node.

[0038] After receiving all the hot migration data of the virtual machine sent by the source node, the target node may execute the to-be-executed instructions of the migrated virtual machine in response to the target node receiving all the hot migration data of the virtual machine sent by the source node.

[0039] Step 120: When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, determine whether the instruction to be executed is a support instruction of the virtual CPU of the virtual machine, and the support instruction of the virtual CPU is a support instruction of the physical CPU of the source node.

[0040] In the embodiment of the present disclosure, when the instruction to be executed of the virtual machine does not belong to an illegal instruction (Undefined Instruction) that cannot be executed by the physical CPU of the target node, the target node can execute the instruction to be executed; when the instruction to be executed of the virtual machine belongs to an illegal instruction (Undefined Instruction) that cannot be executed by the physical CPU of the target node, the target node can determine whether the instruction to be executed belongs to a supported instruction of the virtual CPU of the virtual machine.

[0041] The support instructions of the virtual CPU of the virtual machine belong to the support instructions of the physical CPU of the source node corresponding to the virtual machine. The support instructions of the physical CPU of the source node can be understood as instructions executable by the physical CPU of the source node.

[0042] CPU (Central Processing Unit) is the central processing unit.

[0043] Step 130: If the instruction to be executed is a support instruction of the virtual CPU of the virtual machine, perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node.

[0044] In the disclosed embodiment, if the instruction to be executed is a support instruction of the virtual CPU of the virtual machine, it means that the instruction to be executed is an executable instruction of the physical CPU of the source node corresponding to the virtual machine, and the instruction to be executed needs to be executed in the physical CPU of the target node.

[0045] If the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine, the target node may perform instruction translation on the instruction to be executed, and translate the instruction to be executed into a target instruction executable by the physical CPU of the target node.

[0046] Instruction translation can be used to convert the instruction set of one hardware platform into the instruction set of another hardware platform so as to execute the instructions on the specific hardware platform.

[0047] In some embodiments, the target node may perform instruction translation on the instructions to be executed based on a virtual machine manager (VMM) in the kernel space, and translate the instructions to be executed into target instructions executable by the physical CPU of the target node.

[0048] The virtual machine manager VMM exists in the kernel space of the target node.

[0049] The virtual machine manager VMM can be understood as software used to manage global physical resources in system virtualization, also known as a virtual machine monitor. The VMM can allocate hardware resources among various virtual machines using time division multiplexing or space division multiplexing.

[0050] In some embodiments, the target node may perform instruction translation on the instructions to be executed based on a Quick Emulator (QEMU) in the user space, and translate the instructions to be executed into target instructions executable by the physical CPU of the target node.

[0051] For example, the fast simulator QEMU can use a Tiny Code Generator (TCG) to translate the instructions to be executed, and translate the instructions to be executed into target instructions executable by the physical CPU of the target node.

[0052] The fast emulator QEMU exists in the user space of the target node.

[0053] The fast simulator QEMU can be understood as an open source virtual machine software that can simulate a variety of different hardware platforms and can simulate a physical host into multiple virtual machines, providing users with an isolated environment to run different applications and operating systems. QEMU's flexibility and wide support make it a powerful tool for virtualization, simulation, and cross-platform development. It is widely used in the development and testing of new operating system kernels, application porting, virtualization research, and scenarios where code needs to be run on different hardware architectures.

[0054] Step 140: If the instruction to be executed does not belong to the supported instructions of the virtual CPU of the virtual machine, it is determined that the instruction to be executed cannot be executed.

[0055] In the disclosed embodiment, if the instruction to be executed does not belong to the supported instructions of the virtual CPU of the virtual machine, it means that the instruction to be executed does not belong to the executable instructions of the physical CPU of the source node corresponding to the virtual machine, and the instruction to be executed does not need to be executed in the physical CPU of the target node.

[0056] If the instruction to be executed does not belong to the supported instructions of the virtual CPU of the virtual machine, the target node may determine that the instruction to be executed cannot be executed.

[0057] In the disclosed embodiment, after the target node receives all the hot migration data of the virtual machine, the virtual machine instructions that cannot be supported by the physical CPU of the target node can be translated into instructions executable by the physical CPU of the target node. Therefore, when the support characteristics of the target node CPU do not completely include the support characteristics of the source node CPU or the CPU feature set of the source node is not a subset of the CPU feature set of the target node, the CPU of the target node can execute all the instructions of the virtual machine and successfully realize the hot migration of the virtual machine from the source node to the target node. The hot migration of the virtual machine is no longer restricted by the hardware conditions of the target node, which greatly improves the success rate and applicability of the hot migration of the virtual machine.

[0058] Figure 2 is a flowchart of a method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure. The method can be executed by a computer device, which can be a target node for hot migration of a virtual machine, such as Figure 2 As shown, the method for enhancing the virtual machine hot migration function provided in this embodiment includes the following steps:

[0059] Step 210: In response to the target node receiving all the hot migration data of the virtual machine sent by the source node, the target node runs the to-be-executed instructions of the virtual machine.

[0060] Step 220: When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, it is determined that a non-maskable interrupt exception occurs in the virtual machine.

[0061] In the disclosed embodiment, when the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, the target node can determine that a non-maskable interrupt (NMI) exception occurs in the virtual machine, and the virtual machine is in an exit state (VM-Exit).

[0062] Step 230: The virtual machine manager VMM based on the kernel space calls a preset illegal instruction processing function to determine whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine.

[0063] In the disclosed embodiment, the target node may utilize the virtual machine manager VMM in the kernel space to call a preset illegal instruction processing function to determine whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine.

[0064] For example, the illegal instruction processing function may be functions such as handle_exception_nmi or handle_ud.

[0065] Step 240: If the instruction to be executed is a support instruction of the virtual CPU of the virtual machine, perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node.

[0066] Step 250: If the instruction to be executed does not belong to the supported instructions of the virtual CPU of the virtual machine, it is determined that the instruction to be executed cannot be executed.

[0067] In the embodiment of the present disclosure, when the physical CPU of the target node executes the target instruction or determines that the instruction to be executed cannot be executed, the virtual machine can change from the exit state to the entry state (VM-Enter).

[0068] Therefore, after the target node receives all the hot migration data of the virtual machine, the virtual machine instructions that cannot be supported by the physical CPU of the target node can be translated into instructions executable by the physical CPU of the target node. Therefore, when the support characteristics of the target node CPU do not completely include the support characteristics of the source node CPU or the CPU feature set of the source node is not a subset of the CPU feature set of the target node, the CPU of the target node can execute all the instructions of the virtual machine and successfully realize the hot migration of the virtual machine from the source node to the target node. The hot migration of the virtual machine is no longer restricted by the hardware conditions of the target node, which greatly improves the success rate and applicability of the hot migration of the virtual machine.

[0069] Figure 3 is a flowchart of a method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure. The method can be executed by a computer device, which can be a target node for hot migration of a virtual machine, such as Figure 3 As shown, the method for enhancing the virtual machine hot migration function provided in this embodiment includes the following steps:

[0070] Step 310: In response to the target node receiving all the hot migration data of the virtual machine sent by the source node, the target node runs the to-be-executed instructions of the virtual machine.

[0071] Step 320: When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, the virtual machine manager VMM based on the kernel space obtains the target feature set corresponding to the virtual CPU of the virtual machine, and the target feature set is a subset of the first feature set corresponding to the physical CPU of the source node. The target feature set consists of CPU features supported by the virtual CPU, and the first feature set consists of CPU features supported by the physical CPU of the source node.

[0072] In the disclosed embodiment, when the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, the target node can obtain a target feature set corresponding to the virtual CPU of the virtual machine based on the virtual machine manager VMM in the kernel space.

[0073] The target feature set may be composed of CPU features supported by the virtual CPU. The target feature set is a subset of the first feature set corresponding to the physical CPU of the source node. The first feature set may be composed of CPU features supported by the physical CPU of the source node.

[0074] CPU features can be understood as the hardware features supported by the CPU. Hardware features can include clock speed, number of cores, cache size, architecture, etc.

[0075] In some embodiments, all hot migration data of a virtual machine may include memory data of the virtual machine and device status information of the virtual machine, and the device status information may include a target CPUID corresponding to the virtual CPU of the virtual machine. The target CPUID may be stored in the virtual machine manager VMM of the target node. The target CPUID may include a CPU feature value (entry) corresponding to the CPU feature supported by the virtual CPU, and the CPU feature value may be understood as a parameter that can uniquely determine the CPU feature, and the CPU feature value corresponds to the CPU feature one by one. CPUID is essentially an instruction that allows software to discover detailed information about the processor, and each CPU corresponds to a CPUID.

[0076] The target node can obtain the target CPUID corresponding to the virtual CPU of the virtual machine based on the virtual machine manager VMM in the kernel space, and then determine the target feature set corresponding to the virtual CPU of the virtual machine based on the CPU features corresponding to each CPU feature value in the target CPUID.

[0077] Step 330: Determine whether there is a target CPU characteristic corresponding to the instruction to be executed in the target characteristic set.

[0078] In the embodiment of the present disclosure, after obtaining the target feature set corresponding to the virtual CPU of the virtual machine, the target node may determine whether there is a target CPU feature corresponding to the instruction to be executed in the target feature set.

[0079] In some embodiments, the target node may determine whether there is a target CPU characteristic value corresponding to the instruction to be executed in the target CPUID corresponding to the virtual CPU of the virtual machine;

[0080] If the target CPU characteristic value corresponding to the instruction to be executed exists in the target CPUID, it can be determined that the target CPU characteristic corresponding to the instruction to be executed exists in the target characteristic set;

[0081] If the target CPU characteristic value corresponding to the instruction to be executed does not exist in the target CPUID, it can be determined that the target CPU characteristic corresponding to the instruction to be executed does not exist in the target characteristic set.

[0082] Step 340: If the target CPU characteristic corresponding to the instruction to be executed exists in the target characteristic set, it is determined that the instruction to be executed is a support instruction of the virtual CPU.

[0083] In the disclosed embodiment, if the target characteristic set corresponding to the virtual CPU of the virtual machine contains the target CPU characteristic corresponding to the instruction to be executed, the target node may determine that the instruction to be executed belongs to a supported instruction of the virtual CPU.

[0084] Step 350: If the instruction to be executed is a support instruction of the virtual CPU of the virtual machine, perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node.

[0085] Step 360: If the target CPU characteristic corresponding to the instruction to be executed does not exist in the target characteristic set, it is determined that the instruction to be executed does not belong to the supported instructions of the virtual CPU.

[0086] In the embodiment of the present disclosure, if the target CPU characteristic corresponding to the to-be-executed instruction does not exist in the target characteristic set corresponding to the virtual CPU of the virtual machine, the target node may determine that the to-be-executed instruction does not belong to the supported instructions of the virtual CPU.

[0087] Step 370: If the instruction to be executed does not belong to the supported instructions of the virtual CPU of the virtual machine, it is determined that the instruction to be executed cannot be executed.

[0088] Therefore, after the target node receives all the hot migration data of the virtual machine, the virtual machine instructions that cannot be supported by the physical CPU of the target node can be translated into instructions executable by the physical CPU of the target node. Therefore, when the support characteristics of the target node CPU do not completely include the support characteristics of the source node CPU or the CPU feature set of the source node is not a subset of the CPU feature set of the target node, the CPU of the target node can execute all the instructions of the virtual machine and successfully realize the hot migration of the virtual machine from the source node to the target node. The hot migration of the virtual machine is no longer restricted by the hardware conditions of the target node, which greatly improves the success rate and applicability of the hot migration of the virtual machine.

[0089] Figure 4 is a flowchart of a method for enhancing the hot migration function of a virtual machine provided by an embodiment of the present disclosure. The method can be executed by a computer device, which can be a target node for hot migration of a virtual machine, such as Figure 4 As shown, the method for enhancing the virtual machine hot migration function provided in this embodiment includes the following steps:

[0090] Step 410: In response to the target node receiving all the hot migration data of the virtual machine sent by the source node, the target node runs the to-be-executed instructions of the virtual machine.

[0091] Step 420: When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, the virtual machine manager VMM based on the kernel space obtains the target CPUID corresponding to the virtual CPU of the virtual machine, and the target CPUID includes the CPU feature value corresponding to the CPU feature supported by the virtual CPU.

[0092] In the disclosed embodiment, all hot migration data of a virtual machine may include the memory data of the virtual machine and the device status information of the virtual machine, and the device status information may include the target CPUID corresponding to the virtual CPU of the virtual machine. The target CPUID may be stored in the virtual machine manager VMM of the target node. The target CPUID may include a CPU feature value (entry) corresponding to the CPU feature supported by the virtual CPU, and the CPU feature value may be understood as a parameter that can uniquely determine the CPU feature, and the CPU feature value corresponds one-to-one to the CPU feature. CPUID is essentially an instruction that allows software to discover detailed information about the processor, and each CPU corresponds to a CPUID.

[0093] Step 430, based on the CPU characteristics corresponding to each CPU characteristic value in the target CPUID, determine the target characteristic set corresponding to the virtual CPU of the virtual machine, the target characteristic set is a subset of the first characteristic set corresponding to the physical CPU of the source node, the target characteristic set consists of the CPU characteristics supported by the virtual CPU, and the first characteristic set consists of the CPU characteristics supported by the physical CPU of the source node.

[0094] Step 440: Determine whether there is a target CPU characteristic value corresponding to the instruction to be executed in the target CPUID.

[0095] Step 450: If the target CPU ID contains a target CPU characteristic value corresponding to the instruction to be executed, it is determined that the target CPU characteristic corresponding to the instruction to be executed exists in the target characteristic set, and it is determined that the instruction to be executed belongs to a support instruction of the virtual CPU.

[0096] Step 460: If the instruction to be executed is a support instruction of the virtual CPU of the virtual machine, perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node.

[0097] Step 470: If the target CPU characteristic value corresponding to the instruction to be executed does not exist in the target CPUID, it is determined that the target CPU characteristic corresponding to the instruction to be executed does not exist in the target characteristic set, and it is determined that the instruction to be executed does not belong to the supported instructions of the virtual CPU.

[0098] Step 480: If the instruction to be executed does not belong to the supported instructions of the virtual CPU of the virtual machine, it is determined that the instruction to be executed cannot be executed.

[0099] For relevant contents in the embodiments of the present disclosure, please refer to the above Figure 3 The relevant content in will not be repeated here.

[0100] Therefore, after the target node receives all the hot migration data of the virtual machine, the virtual machine instructions that cannot be supported by the physical CPU of the target node can be translated into instructions executable by the physical CPU of the target node. Therefore, when the support characteristics of the target node CPU do not completely include the support characteristics of the source node CPU or the CPU feature set of the source node is not a subset of the CPU feature set of the target node, the CPU of the target node can execute all the instructions of the virtual machine and successfully realize the hot migration of the virtual machine from the source node to the target node. The hot migration of the virtual machine is no longer restricted by the hardware conditions of the target node, which greatly improves the success rate and applicability of the hot migration of the virtual machine.

[0101] Figure 5 Schematic diagram of a virtual machine hot migration function enhancement device provided by an embodiment of the present disclosure, which can be understood as the above-mentioned computer device or a part of the functional modules in the above-mentioned computer device. Figure 5 As shown, the virtual machine hot migration function enhancement device 500 includes:

[0102] An operation module 510, configured to execute the to-be-executed instructions of the virtual machine at the target node in response to the target node receiving all the hot migration data of the virtual machine sent by the source node;

[0103] The judgment module 520 is used to judge whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine when the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, and the supported instruction of the virtual CPU is a supported instruction of the physical CPU of the source node;

[0104] The translation module 530 is used to perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node;

[0105] The determination module 540 is used to determine that the instruction to be executed cannot be executed otherwise.

[0106] Optionally, the judgment module includes:

[0107] The adjustment submodule is used to determine that a non-maskable interrupt exception occurs in the virtual machine when the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node;

[0108] A calling submodule is used for a virtual machine manager VMM based on the kernel space to call a preset illegal instruction processing function to determine whether the instruction to be executed belongs to a supported instruction of the virtual CPU of the virtual machine;

[0109] Optionally, the above-mentioned judgment module includes:

[0110] An acquisition submodule is used for a virtual machine manager VMM based on a kernel space to acquire a target feature set corresponding to a virtual CPU of a virtual machine, the target feature set consisting of CPU features supported by the virtual CPU, the target feature set being a subset of a first feature set corresponding to a physical CPU of a source node, the first feature set consisting of CPU features supported by the physical CPU of the source node;

[0111] A judgment submodule, used to judge whether there is a target CPU characteristic corresponding to the instruction to be executed in the target characteristic set;

[0112] A first determination submodule, for determining that the instruction to be executed belongs to a supported instruction of the virtual CPU, if any;

[0113] The second determining submodule is used to determine that the instruction to be executed does not belong to the supported instructions of the virtual CPU.

[0114] Optionally, the acquisition submodule includes:

[0115] An acquisition unit, used for acquiring a target CPUID corresponding to a virtual CPU of a virtual machine based on a virtual machine manager VMM in a kernel space, wherein the target CPUID includes a CPU feature value corresponding to a CPU feature supported by the virtual CPU;

[0116] A first determining unit, configured to determine a target characteristic set corresponding to a virtual CPU of a virtual machine based on CPU characteristics corresponding to each CPU characteristic value in a target CPUID;

[0117] Optionally, the above judgment submodule includes:

[0118] A determination unit, used to determine whether there is a target CPU characteristic value corresponding to the instruction to be executed in the target CPUID;

[0119] a second determining unit, configured to determine that a target CPU characteristic corresponding to the instruction to be executed exists in the target characteristic set, if any;

[0120] The third determining unit is configured to determine that, otherwise, there is no target CPU characteristic corresponding to the to-be-executed instruction in the target characteristic set.

[0121] Optionally, the above translation module includes:

[0122] The first translation submodule is used for performing instruction translation on the instruction to be executed based on the virtual machine manager VMM in the kernel space, and translating the instruction to be executed into a target instruction executable by the physical CPU of the target node.

[0123] Optionally, the above translation module includes:

[0124] The second translation submodule is used for performing instruction translation on the to-be-executed instruction based on the fast simulator QEMU in the user space, and translating the to-be-executed instruction into a target instruction executable by the physical CPU of the target node.

[0125] Optionally, all of the above hot migration data includes memory data of the virtual machine and device status information of the virtual machine, and the device status information includes a target CPUID corresponding to the virtual CPU of the virtual machine.

[0126] The virtual machine hot migration function enhancement device provided in the embodiments of the present disclosure can implement the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.

[0127] The embodiments of the present disclosure also provide a computer device, which includes a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method of any of the above embodiments can be implemented, and its execution method and beneficial effects are similar and will not be repeated here.

[0128] The computer device in the embodiments of the present disclosure may be understood as any device with processing and computing capabilities. The device may be a target node for hot migration of a virtual machine. The device may include but is not limited to electronic devices such as servers and computers.

[0129] Figure 6 is a schematic diagram of the structure of a computer device provided by an embodiment of the present disclosure, such as Figure 6 As shown, the computer device 600 may include a processor 610 and a memory 620, wherein the memory 620 stores a computer program 621, and when the computer program 621 is executed by the processor 610, the method provided by any of the above embodiments can be implemented, and its execution method and beneficial effects are similar and will not be repeated here.

[0130] Of course, to simplify, Figure 6 Only some of the components related to the present invention in the computer device 600 are shown, and components such as a bus, an input / output interface, an input device, and an output device are omitted. In addition, according to specific application conditions, the computer device 600 may also include any other appropriate components.

[0131] An embodiment of the present disclosure provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments can be implemented. The execution method and beneficial effects are similar and will not be repeated here.

[0132] The above-mentioned computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0133] The computer program may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer device, partially on the user's device, as a separate software package, partially on the user's computer device and partially on a remote computer device, or entirely on a remote computer device or server.

[0134] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0135] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0136] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for enhancing the hot migration function of a virtual machine, characterized in that: include: In response to the target node receiving all hot migration data of the virtual machine sent by the source node, the target node runs the to-be-executed instructions of the virtual machine; When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, determine whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine, and the supported instruction of the virtual CPU is a supported instruction of the physical CPU of the source node; If yes, perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node; Otherwise, it is determined that the instruction to be executed cannot be executed.

2. The method according to claim 1, characterized in that When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, determining whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine includes: When the instruction to be executed is an illegal instruction that cannot be executed by the physical CPU of the target node, determining that a non-maskable interrupt exception occurs in the virtual machine; The virtual machine manager VMM based on the kernel space calls a preset illegal instruction processing function to determine whether the instruction to be executed belongs to a supported instruction of the virtual CPU of the virtual machine.

3. The method according to claim 1 or 2, characterized in that: The determining whether the instruction to be executed is a supported instruction of the virtual CPU of the virtual machine includes: A virtual machine manager VMM based on the kernel space obtains a target feature set corresponding to the virtual CPU of the virtual machine, the target feature set consisting of CPU features supported by the virtual CPU, the target feature set belonging to a subset of a first feature set corresponding to the physical CPU of the source node, the first feature set consisting of CPU features supported by the physical CPU of the source node; Determine whether there is a target CPU characteristic corresponding to the instruction to be executed in the target characteristic set; If so, determining that the instruction to be executed belongs to a support instruction of the virtual CPU; Otherwise, it is determined that the instruction to be executed does not belong to the supported instructions of the virtual CPU.

4. The method according to claim 3, characterized in that The kernel space-based virtual machine manager VMM obtains a target feature set corresponding to the virtual CPU of the virtual machine, including: A virtual machine manager VMM based on the kernel space obtains a target CPUID corresponding to the virtual CPU of the virtual machine, wherein the target CPUID includes a CPU feature value corresponding to a CPU feature supported by the virtual CPU; Determine a target characteristic set corresponding to the virtual CPU of the virtual machine based on the CPU characteristics corresponding to each of the CPU characteristic values ​​in the target CPUID; The determining whether the target CPU characteristic corresponding to the instruction to be executed exists in the target characteristic set includes: Determine whether there is a target CPU characteristic value corresponding to the instruction to be executed in the target CPUID; If so, determining that the target CPU characteristic corresponding to the instruction to be executed exists in the target characteristic set; Otherwise, it is determined that the target CPU characteristic corresponding to the to-be-executed instruction does not exist in the target characteristic set.

5. The method according to claim 1, characterized in that The translating the to-be-executed instruction into a target instruction executable by the physical CPU of the target node includes: Based on the virtual machine manager VMM in the kernel space, the instructions to be executed are translated, and the instructions to be executed are translated into target instructions executable by the physical CPU of the target node.

6. The method according to claim 1, characterized in that The translating the to-be-executed instruction into a target instruction executable by the physical CPU of the target node includes: Based on the fast simulator QEMU in the user space, the instructions to be executed are translated, and the instructions to be executed are translated into target instructions executable by the physical CPU of the target node.

7. The method according to claim 1, characterized in that The entire hot migration data includes memory data of the virtual machine and device status information of the virtual machine, and the device status information includes a target CPUID corresponding to the virtual CPU of the virtual machine.

8. A device for enhancing the hot migration function of a virtual machine, characterized in that: include: An operation module, configured to respond to the target node receiving all hot migration data of the virtual machine sent by the source node, and the target node executing the to-be-executed instructions of the virtual machine; A judgment module, used for judging whether the instruction to be executed belongs to a supported instruction of the virtual CPU of the virtual machine, and the supported instruction of the virtual CPU belongs to a supported instruction of the physical CPU of the source node, when the instruction to be executed belongs to an illegal instruction that cannot be executed by the physical CPU of the target node; A translation module, configured to, if yes, perform instruction translation on the instruction to be executed, translate the instruction to be executed into a target instruction executable by the physical CPU of the target node, and execute the target instruction based on the physical CPU of the target node; The determination module is used to determine that the to-be-executed instruction cannot be executed otherwise.

9. A computer device, characterized in that: include: A memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method for enhancing the hot migration function of a virtual machine as described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the method for enhancing the hot migration function of a virtual machine according to any one of claims 1 to 7 is implemented.