A virtual machine control method, device and medium

CN116225616BActive Publication Date: 2026-10-30JINAN INSPUR DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310140294.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-16
Publication Date
2026-10-30
Estimated Expiration
2043-02-16

AI Technical Summary

Technical Problem

但不同服务器节点的硬件设备和软件环境均不相同,在使用虚拟设备网卡的虚拟机设备的虚拟机工作过程中对虚拟机进行迁移可能会导致虚拟机故障,影响虚拟机和服务器的正常工作

Benefits of technology

[0039]此外,本申请还提供了一种虚拟机控制方法,包括:获取用户发送的虚拟机迁移指令,并解析虚拟机迁移指令,以获取待迁移虚拟机、源主机和目标主机,以便于根据用户指令将待迁移虚拟机从源主机迁移至目标主机;其中,源主机为待迁移虚拟机所在的主机,目标主机为待迁移虚拟机即将迁移的主机;判断源主机与目标主机的虚拟网卡是否一致;若不一致,则更新目标主机的网卡驱动,并向目标主机发送虚拟资源分配请求,将待迁移虚拟机迁移至目标设备分配的虚拟资源,以保证虚拟机迁移前后在不同的主机节点中均能够正常工作。由此可见,本申请所提供的技术方案,通过在源主机与目标主机的虚拟网卡不一致时,更新待迁移虚拟机的网卡驱动,并向目标主机申请虚拟资源,以保证待迁移虚拟机能够在目标主机中正常工作,防止对使用虚拟设备网卡的虚拟机进行热迁移操作的过程中虚拟机故障,从而提高云计算系统的稳定性和可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225616B_ABST
    Figure CN116225616B_ABST
Patent Text Reader

Abstract

The application relates to the field of cloud computing, and discloses a virtual machine control method, device and medium, which comprises the following steps: obtaining a virtual machine migration instruction sent by a user, and analyzing the virtual machine migration instruction to obtain a to-be-migrated virtual machine, a source host and a target host; determining whether the virtual network cards of the source host and the target host are consistent; if not, updating the network card driver of the target host, and sending a virtual resource allocation request to the target host, and migrating the to-be-migrated virtual machine to the virtual resource allocated by the target device, so that the to-be-migrated virtual machine can normally work in different host nodes before and after migration. According to the application, when the virtual network cards of the source host and the target host are inconsistent, the network card driver of the to-be-migrated virtual machine is updated, and the target host is applied for virtual resources, so that the to-be-migrated virtual machine can normally work in the target host, the virtual machine is prevented from failing during a hot migration operation, and therefore the stability and reliability of a cloud computing system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing, and in particular to a virtual machine control method, apparatus, and medium. Background Technology

[0002] With the development of cloud computing technology, more and more enterprises are providing cloud computing services to users. In a cloud computing server cluster, multiple virtual machines are mounted on each physical server node, thereby providing computing resources to users through virtual machines. To reduce the hardware cost of virtual machines, the network interface cards (NICs) of virtual machines are usually virtual NICs. During the operation of virtual machines, SR-IOV technology is used to associate a single physical NIC with each virtual machine, enabling each virtual machine to communicate directly with the physical NIC. SR-IOV devices can support two categories of functions: Physical Functions (PF) and Virtual Functions (VF).

[0003] In the operation of cloud computing servers, to ensure the efficient utilization of virtual machines, virtual machines may need to be migrated between multiple physical device nodes. However, the hardware and software environments of different server nodes are different. Migrating virtual machines while they are operating on virtual machine devices using virtual network interface cards (NICs) may cause virtual machine failures, affecting the normal operation of both the virtual machines and the server.

[0004] Therefore, it is evident that providing a virtual machine control method to prevent virtual machine failures during hot migration of virtual machines using virtual network interface cards is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a virtual machine control method, apparatus, and medium to prevent virtual machine failures during hot migration operations of virtual machines using virtual device network cards, thereby improving the stability and reliability of cloud computing systems.

[0006] To address the aforementioned technical problems, this application provides a virtual machine control method, comprising:

[0007] Retrieve virtual machine migration commands sent by the user;

[0008] The virtual machine migration instruction is parsed to obtain the virtual machine to be migrated, the source host, and the target host, wherein the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated;

[0009] Determine whether the virtual network interface cards of the source host and the target host are the same;

[0010] If there is a discrepancy, update the network card driver of the virtual machine to be migrated and send a virtual resource allocation request to the target host;

[0011] The virtual machine to be migrated is migrated to the virtual resources allocated to the target device.

[0012] Preferably, after the step of determining whether the virtual network interface cards of the source host and the target host are consistent, the method further includes:

[0013] If the source host and the target host have the same virtual network interface card, then a virtual resource allocation request is sent to the target host.

[0014] Preferably, before the step of determining whether the virtual network interface cards of the source host and the target host are the same, the method further includes:

[0015] It is determined that both the source host and the target host belong to the same SR-IOV virtual switch;

[0016] If they belong to the same SR-IOV virtual switch, then the step of determining whether the virtual network interface cards of the source host and the target host are consistent is executed.

[0017] Preferably, sending a virtual resource allocation request to the target host includes:

[0018] The virtual resource allocation request is generated based on the resource information of the virtual machine to be migrated;

[0019] The virtual resource allocation request is sent to the target host so that the target host can allocate virtual resources to the virtual machine to be migrated.

[0020] Preferably, after the step of migrating the virtual machine to be migrated to the virtual resources allocated by the target device, the method further includes:

[0021] Determine whether the virtual machine to be migrated has been successfully migrated;

[0022] If the migration is successful, the virtual resources corresponding to the device to be migrated in the source host will be released;

[0023] If the migration is unsuccessful, the virtual resources pre-allocated for the device to be migrated in the target host will be released.

[0024] Preferably, updating the network card driver of the virtual machine to be migrated includes:

[0025] Obtain the operating system type of the virtual machine to be migrated;

[0026] Identify the target network card driver corresponding to the operating system type, and install the target network card driver in the virtual machine to be migrated.

[0027] Preferably, obtaining the operating system type of the virtual machine to be migrated includes:

[0028] The operation type of the virtual machine to be migrated is determined using virtual machine enhancement tools.

[0029] To address the aforementioned technical problems, this application also provides a virtual machine control device, comprising:

[0030] The acquisition module is used to acquire virtual machine migration commands sent by the user;

[0031] The parsing module is used to parse the virtual machine migration instruction to obtain the virtual machine to be migrated, the source host, and the target host, wherein the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated;

[0032] The judgment module is used to determine whether the virtual network interface cards of the source host and the target host are the same;

[0033] The update module is used to update the network card driver of the virtual machine to be migrated if there is a discrepancy, and send a virtual resource allocation request to the target host.

[0034] The migration module is used to migrate the virtual machine to be migrated to the virtual resources allocated by the target device.

[0035] To address the aforementioned technical problems, this application also provides a virtual machine control device, including a memory for storing computer programs;

[0036] A processor is used to implement the steps of the virtual machine control method when executing the computer program.

[0037] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the virtual machine control method described above.

[0038] This application provides a virtual machine control method, comprising: acquiring a virtual machine migration command sent by a user and parsing the virtual machine migration command to obtain the virtual machine to be migrated, the source host, and the target host, so as to migrate the virtual machine to be migrated from the source host to the target host according to the user command; wherein, the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated; determining whether the virtual network interface cards (NICs) of the source host and the target host are consistent; if they are inconsistent, updating the NIC driver of the target host and sending a virtual resource allocation request to the target host to migrate the virtual machine to be migrated to the virtual resources allocated by the target device, so as to ensure that the virtual machine can work normally on different host nodes before and after migration. Therefore, the technical solution provided by this application, by updating the NIC driver of the virtual machine to be migrated and requesting virtual resources from the target host when the virtual NICs of the source host and the target host are inconsistent, ensures that the virtual machine to be migrated can work normally on the target host, prevents virtual machine failure during hot migration of virtual machines using virtual device NICs, and thus improves the stability and reliability of the cloud computing system.

[0039] Furthermore, this application also provides a virtual machine control method, including: obtaining a virtual machine migration instruction sent by a user and parsing the virtual machine migration instruction to obtain the virtual machine to be migrated, the source host, and the target host, so as to migrate the virtual machine to be migrated from the source host to the target host according to the user instruction; wherein, the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated; determining whether the virtual network interface cards (NICs) of the source host and the target host are consistent; if they are inconsistent, updating the NIC driver of the target host and sending a virtual resource allocation request to the target host to migrate the virtual machine to be migrated to the virtual resources allocated by the target device, so as to ensure that the virtual machine can work normally on different host nodes before and after migration. Therefore, the technical solution provided by this application, by updating the NIC driver of the virtual machine to be migrated and requesting virtual resources from the target host when the virtual NICs of the source host and the target host are inconsistent, ensures that the virtual machine to be migrated can work normally on the target host, prevents virtual machine failure during hot migration operations of virtual machines using virtual device NICs, and thus improves the stability and reliability of the cloud computing system. Attached Figure Description

[0040] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 This is a schematic diagram of a server working scenario provided in an embodiment of this application;

[0042] Figure 2 A flowchart illustrating a virtual machine control method provided in an embodiment of this application;

[0043] Figure 3 This is a structural diagram of a virtual machine control device provided in an embodiment of this application;

[0044] Figure 4 This is a structural diagram of another virtual machine control device provided in an embodiment of this application;

[0045] The attached diagram is labeled as follows: 1 is the source host, 2 is the target host, and 3 is the virtual machine to be migrated. Detailed Implementation

[0046] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0047] The core of this application is to provide a virtual machine control method, device, and medium to prevent virtual machine failures during hot migration operations of virtual machines using virtual network interface cards, thereby improving the stability and reliability of cloud computing systems.

[0048] Figure 1 This is a schematic diagram of a server working scenario provided in an embodiment of this application, such as... Figure 1As shown, the source host and target host each have physical network interface card (NIC) a and physical NIC b, respectively, and both belong to the same SR-IOV virtual switch. The virtual machine to be migrated is deployed on the original host and operates through the virtual NIC allocated to physical NIC a. Because the hardware and software environments of different server nodes are different, when migrating a virtual machine using a virtual device NIC, if the systems of the source and target hosts are incompatible, or if the target host cannot allocate the corresponding computing resources for the virtual machine to be migrated, it may lead to virtual machine failure, affecting the normal operation of the virtual machine and the server. To address this issue, this application provides a virtual machine control method, comprising: acquiring a virtual machine migration command sent by a user and parsing the command to obtain the virtual machine to be migrated, the source host, and the target host, so as to migrate the virtual machine to be migrated from the source host to the target host according to the user command; wherein, the source host is the host where the virtual machine to be migrated resides, and the target host is the host to which the virtual machine will be migrated; determining whether the virtual network interface cards (NICs) of the source host and the target host are consistent; if they are inconsistent, updating the NIC driver of the target host and sending a virtual resource allocation request to the target host to migrate the virtual machine to be migrated to the virtual resources allocated by the target device, thereby ensuring that the virtual machine can work normally on different host nodes before and after migration. Therefore, the technical solution provided by this application, by updating the NIC driver of the virtual machine to be migrated and requesting virtual resources from the target host when the virtual NICs of the source host and the target host are inconsistent, ensures that the virtual machine to be migrated can work normally on the target host, preventing virtual machine failures during hot migration operations of virtual machines using virtual device NICs, thereby improving the stability and reliability of the cloud computing system.

[0049] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0050] Figure 1 A flowchart of a virtual machine control method provided in an embodiment of this application is shown below. Figure 1 As shown, the method includes:

[0051] S10: Obtain the virtual machine migration command sent by the user.

[0052] S11: Parse the virtual machine migration command to obtain the virtual machine to be migrated, the source host, and the target host. The source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated will be migrated.

[0053] It should be noted that the virtual machine control method provided in this application is applied to virtual machines using virtual network cards allocated with SR-IOV technology, and is used to realize the hot migration of virtual machines.

[0054] Migration refers to the process of moving a virtual machine from one host or storage location to another. In practice, virtual machine migration includes two types: hot migration and cold migration. Cold migration involves migrating a virtual machine that has been powered off or suspended; it can migrate the virtual machine's disk files to another host disk or to shared storage; and it can be used to move a virtual machine from one data center to another. Hot migration moves a powered-on virtual machine to a new host, but currently, virtual machines using virtual network adapters allocated by the SR-IOV system do not support hot migration.

[0055] It is understandable that user-sent virtual machine migration commands can be targeted at a single virtual machine or multiple virtual machines. Virtual machine migration commands can originate from servers or other virtual machines; this is not limited to these specific commands.

[0056] S12: Determine whether the virtual network cards of the source host and the target host are the same.

[0057] S13: If there is a discrepancy, update the network card driver of the virtual machine to be migrated and send a virtual resource allocation request to the target host.

[0058] In practice, virtual network adapters (NICs) are created based on physical NICs using SR-IOV technology. Therefore, depending on the physical NIC and the creation method, virtual NICs come in different versions and types. To ensure the virtual machine to be migrated can function correctly on the target host, it's necessary to determine if the virtual NICs on the source and target hosts are identical. If they are inconsistent, the NIC driver for the virtual machine to be migrated should be updated promptly. This ensures the virtual machine can use the virtual NIC allocated by the target host after migration, improving system stability.

[0059] Understandably, to ensure the server system functions properly, the live virtual machine needs to operate normally before and after the migration. Ensuring the virtual machine functions normally requires the physical host to provide the necessary computing resources. Therefore, before performing a live virtual machine migration, a virtual resource allocation request needs to be sent to the target host based on the device information of the virtual machine to be migrated, so that the target host can allocate virtual resources for the virtual machine in advance.

[0060] S14: Migrate the virtual machine to be migrated to the virtual resources allocated to the target device.

[0061] In practice, the steps for migrating virtual machines include: collecting device information of all physical devices where the virtual machines to be migrated reside and resource information of the virtual machines to be migrated. The device information includes hardware information and software information.

[0062] The process of collecting resource information for the virtual machines to be migrated includes: collecting virtual machine hardware and software information; and based on the collected hardware and software information, generating virtual machine configuration options and virtual machine migration options. The virtual machine configuration options involve the current configuration information of the virtual machine, including the hardware and software resources it occupies, while the virtual machine migration options involve the hardware and software resources required by the physical machine after migration.

[0063] Furthermore, virtual machine migration files can be created based on the collected virtual machine resource information. In practice, the server writes virtual machine configuration options and migration options into a virtual machine migration template, forming a virtual machine migration file. The virtual machine migration template is a pre-saved template; writing virtual machine configuration options and migration options into the template can create multiple virtual machine migration files.

[0064] Understandably, to enhance the security of the virtual machine migration process, the legality of virtual machine migration commands can be verified. For example, it can be checked whether the sender of the command has migration privileges, or whether the command conforms to a preset format (whether the command includes the migration time, the resource conditions of the physical machine to be migrated, etc.). If the virtual machine migration command is valid, the migration operation is executed; otherwise, a warning message is sent to the user.

[0065] This embodiment provides a virtual machine control method, including: acquiring a virtual machine migration command sent by a user and parsing the virtual machine migration command to obtain the virtual machine to be migrated, the source host, and the target host, so as to migrate the virtual machine to be migrated from the source host to the target host according to the user command; wherein, the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated; determining whether the virtual network interface cards (NICs) of the source host and the target host are consistent; if they are inconsistent, updating the NIC driver of the target host and sending a virtual resource allocation request to the target host to migrate the virtual machine to be migrated to the virtual resources allocated by the target device, so as to ensure that the virtual machine can work normally on different host nodes before and after migration. Therefore, the technical solution provided by this application, by updating the NIC driver of the virtual machine to be migrated and requesting virtual resources from the target host when the virtual NICs of the source host and the target host are inconsistent, ensures that the virtual machine to be migrated can work normally on the target host, prevents virtual machine failure during hot migration of virtual machines using virtual device NICs, and thus improves the stability and reliability of the cloud computing system.

[0066] It is understandable that when the virtual network interface cards (NICs) of the target host and the source host are identical, the virtual machine to be migrated will normally use the virtual NIC allocated by the target host. Based on the above embodiment, after the step of determining whether the virtual NICs of the source host and the target host are identical, the method further includes: if the virtual NICs of the source host and the target host are identical, then sending a virtual resource allocation request to the target host.

[0067] During the hot migration operation, it is determined whether the SR-IOV network card of the target host is consistent with that of the source host. If they are consistent, no driver installation is required, and the process proceeds to the next step. If they are inconsistent, and the virtual machine to be migrated has vmtools installed, the platform retrieves the corresponding OS network card driver from the host driver library based on the virtual machine's OS type. The host automatically loads the network card driver through vmtools and installs it into the virtual machine, then proceeds to the next step. If the virtual machine to be migrated does not have vmtools installed, the migration task is terminated.

[0068] In a physical environment, the host connects to the network via a physical switch. In a virtualized environment, a virtual machine switch is used. Virtual machines connect to the network through the virtual machine switch, which in turn connects to the external network via the physical network interface card (NIC) on the host. Like regular server devices, each virtual machine has its own virtual NIC, with its own MAC address and IP address. The virtual machine switch acts as a virtual Layer 2 switch, connecting the virtual NIC to the physical NIC and forwarding data packets from the virtual machine to the physical network port. Like a physical switch, the virtual machine switch's function is to forward data. Therefore, a hot migration operation can only be performed when the target host and the source host belong to the same virtual switch.

[0069] Based on the above embodiments, before the step of determining whether the virtual network cards of the source host and the target host are consistent, the method further includes: determining whether the source host and the target host belong to the same SR-IOV virtual switch; if they belong to the same SR-IOV virtual switch, then the step of determining whether the virtual network cards of the source host and the target host are consistent is performed.

[0070] In practice, since virtual machine migration is a hot migration, the target host needs to pre-allocate virtual resources for the virtual machine in order to ensure that the virtual machine can work normally before and after the migration.

[0071] Based on the above embodiments, sending a virtual resource allocation request to the target host includes:

[0072] A virtual resource allocation request is generated based on the resource information of the virtual machine to be migrated; the virtual resource allocation request is sent to the target host so that the target host can allocate virtual resources to the virtual machine to be migrated.

[0073] As a preferred embodiment, in order to ensure the normal operation of the server, it is also necessary to determine whether the virtual machine migration was successful after the virtual machine migration task is completed.

[0074] Based on the above embodiments, after the step of migrating the virtual machine to be migrated to the virtual resources allocated by the target device, the method further includes: determining whether the virtual machine to be migrated has been successfully migrated;

[0075] If the migration is successful, the virtual resources corresponding to the device to be migrated in the source host will be released.

[0076] If the migration is unsuccessful, the virtual resources pre-allocated for the device to be migrated on the target host will be released.

[0077] In practice, if the virtual machine to be migrated has a new network card driver installed, the host machine will uninstall the newly installed network card driver using vmtools and terminate the task. If no new driver is installed, the task will terminate directly. If the migration is successful, the virtual network card reserved on the target host will be assigned to the virtual machine to be migrated, and the virtual network card on the source host will be released.

[0078] In the above embodiments, the virtual machine control method has been described in detail. This application also provides embodiments corresponding to the virtual machine control device. It should be noted that this application describes the embodiments of the device part from two perspectives: one is based on the functional module, and the other is based on the hardware.

[0079] Figure 3 This is a structural diagram of a virtual machine control device provided in an embodiment of this application, as shown below. Figure 3 As shown, the device includes:

[0080] Module 10 is used to acquire virtual machine migration instructions sent by the user;

[0081] Parsing module 11 is used to parse virtual machine migration instructions to obtain the virtual machine to be migrated, the source host, and the target host, wherein the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated;

[0082] The judgment module 12 is used to determine whether the virtual network cards of the source host and the target host are the same;

[0083] Update module 13 is used to update the network card driver of the virtual machine to be migrated if there is a discrepancy, and send a virtual resource allocation request to the target host.

[0084] Migration module 14 is used to migrate virtual machines to be migrated to virtual resources allocated to the target device.

[0085] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.

[0086] This application provides a virtual machine control device, comprising: acquiring a virtual machine migration command sent by a user and parsing the virtual machine migration command to obtain the virtual machine to be migrated, the source host, and the target host, so as to migrate the virtual machine to be migrated from the source host to the target host according to the user command; wherein, the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is to be migrated; determining whether the virtual network interface cards (NICs) of the source host and the target host are consistent; if they are inconsistent, updating the NIC driver of the target host and sending a virtual resource allocation request to the target host to migrate the virtual machine to be migrated to the virtual resources allocated by the target device, so as to ensure that the virtual machine can work normally on different host nodes before and after migration. Therefore, the technical solution provided by this application, by updating the NIC driver of the virtual machine to be migrated and requesting virtual resources from the target host when the virtual NICs of the source host and the target host are inconsistent, ensures that the virtual machine to be migrated can work normally on the target host, prevents virtual machine failure during hot migration operations of virtual machines using virtual device NICs, and thus improves the stability and reliability of the cloud computing system.

[0087] Figure 4 This is a structural diagram of another virtual machine control device provided in an embodiment of this application, as shown below. Figure 4 As shown, the virtual machine control device includes: a memory 20 for storing computer programs;

[0088] The processor 21 is used to implement the steps of the virtual machine control method as described in the above embodiments when executing a computer program.

[0089] The terminal device for sending migration instructions provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.

[0090] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.

[0091] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the virtual machine control method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary storage or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, virtual machine resource information, physical machine device information, etc.

[0092] In some embodiments, the virtual machine control device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0093] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the virtual machine control device and may include more or fewer components than shown.

[0094] The virtual machine control device provided in this application includes a memory and a processor. When the processor executes a program stored in the memory, it can implement the following method:

[0095] Retrieve virtual machine migration commands sent by the user;

[0096] Parse the virtual machine migration command to obtain the virtual machine to be migrated, the source host, and the target host. The source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated will be migrated.

[0097] Determine whether the virtual network interface cards of the source host and the target host are the same;

[0098] If there is a discrepancy, update the network card driver of the virtual machine to be migrated and send a virtual resource allocation request to the target host;

[0099] Migrate the virtual machine to be migrated to the virtual resources allocated to the target device.

[0100] This application provides a virtual machine control device, comprising: acquiring a virtual machine migration command sent by a user and parsing the virtual machine migration command to obtain the virtual machine to be migrated, the source host, and the target host, so as to migrate the virtual machine to be migrated from the source host to the target host according to the user command; wherein, the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is to be migrated; determining whether the virtual network interface cards (NICs) of the source host and the target host are consistent; if they are inconsistent, updating the NIC driver of the target host and sending a virtual resource allocation request to the target host to migrate the virtual machine to be migrated to the virtual resources allocated by the target device, so as to ensure that the virtual machine can work normally on different host nodes before and after migration. Therefore, the technical solution provided by this application, by updating the NIC driver of the virtual machine to be migrated and requesting virtual resources from the target host when the virtual NICs of the source host and the target host are inconsistent, ensures that the virtual machine to be migrated can work normally on the target host, prevents virtual machine failure during hot migration of virtual machines using virtual device NICs, and thus improves the stability and reliability of the cloud computing system.

[0101] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.

[0102] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0103] The virtual machine control method, apparatus, and medium provided in this application have been described in detail above. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0104] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A virtual machine control method, characterized in that, This is applied to virtual machines using virtual network interface cards (NICs) allocated with SR-IOV technology, and is used to enable hot migration of virtual machines; it includes: Retrieve virtual machine migration commands sent by the user; The virtual machine migration instruction is parsed to obtain the virtual machine to be migrated, the source host, and the target host, wherein the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated; Determine whether the source host and the target host belong to the same SR-IOV virtual switch; If they belong to the same SR-IOV virtual switch, then determine whether the virtual network interface card of the source host and the target host is the same; If they do not match, the operating system type of the virtual machine to be migrated is obtained; the target network card driver corresponding to the operating system type is determined and installed in the virtual machine to be migrated; and a virtual resource allocation request is sent to the target host. If the source host and the target host have the same virtual network interface card, then a virtual resource allocation request is sent to the target host; The virtual machine to be migrated is migrated to the virtual resources allocated to the target host.

2. The virtual machine control method according to claim 1, characterized in that, Sending a virtual resource allocation request to the target host includes: The virtual resource allocation request is generated based on the resource information of the virtual machine to be migrated; The virtual resource allocation request is sent to the target host so that the target host can allocate virtual resources to the virtual machine to be migrated.

3. The virtual machine control method according to claim 1 or 2, characterized in that, After the step of migrating the virtual machine to be migrated to the virtual resources allocated by the target host, the method further includes: Determine whether the virtual machine to be migrated has been successfully migrated; If the migration is successful, the virtual resources corresponding to the virtual machine to be migrated in the source host will be released. If the migration is unsuccessful, the virtual resources pre-allocated for the virtual machine to be migrated on the target host will be released.

4. The virtual machine control method according to claim 1, characterized in that, The operating system type of the virtual machine to be migrated includes: The operation type of the virtual machine to be migrated is determined using virtual machine enhancement tools.

5. A virtual machine control device, characterized in that, This is applied to virtual machines using virtual network interface cards (NICs) allocated with SR-IOV technology, and is used to enable hot migration of virtual machines; it includes: The acquisition module is used to acquire virtual machine migration commands sent by the user; The parsing module is used to parse the virtual machine migration instruction to obtain the virtual machine to be migrated, the source host, and the target host, wherein the source host is the host where the virtual machine to be migrated is located, and the target host is the host to which the virtual machine to be migrated is about to be migrated; The judgment module is used to determine whether the source host and the target host belong to the same SR-IOV virtual switch; if they belong to the same SR-IOV virtual switch, it determines whether the virtual network interface cards of the source host and the target host are the same. The update module is used to: if there is a discrepancy, obtain the operating system type of the virtual machine to be migrated; determine the target network card driver corresponding to the operating system type and install the target network card driver in the virtual machine to be migrated; and send a virtual resource allocation request to the target host; if the virtual network card of the source host and the target host are consistent, send a virtual resource allocation request to the target host. The migration module is used to migrate the virtual machine to be migrated to the virtual resources allocated by the target host.

6. A virtual machine control device, characterized in that, Includes memory used to store computer programs; A processor for executing the computer program to implement the steps of the virtual machine control method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the virtual machine control method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Virtual machine morphing for heterogeneous migration environments

    CN103238136A