Virtual machine migration method and device and storage medium
By using acceleration components to compress virtual machine resources during virtual machine migration, the problem of inefficient virtual machine migration is solved, and efficient data transmission and stability of the migration process is achieved.
Patent Information
- Application Number
- CN202412000513.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-27
AI Technical Summary
During the online migration of virtual machines, the generation speed of dirty memory data exceeds the network bandwidth between the source node and the destination node, resulting in the consistency of migration data not converging and the virtual machine migration efficiency is low.
When the target virtual machine meets specific migration conditions, use the virtualization management component to obtain the migration request, and compress the virtual machine resources through configured acceleration components (such as QuickAssist Technology, QAT) to reduce the amount of data transmission.
By accelerating the compression and decompression of components, the load of data transmission during the migration process is effectively reduced, ensuring the improvement of data convergence and migration efficiency, and avoiding migration failure caused by data consistency problems.
Smart Images

Figure CN120045277A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computers. Specifically, the present application relates to a method and device for migrating virtual machines, and a storage medium. Background Art
[0002] Online migration of virtual machines is a very important function in cloud platforms. It can ensure that a virtual machine is migrated from one computing node in a cloud platform cluster to another node without affecting the internal services of the user's virtual machine. This function is used when the host node where the virtual machine is located has insufficient resources or needs to enter the maintenance state.
[0003] Compared with offline migration, although online migration can avoid affecting user services, it also has disadvantages. The most common and serious problem is that when the internal service volume of the virtual machine is very large, a large amount of dirty memory data will be generated. When the generation speed of the dirty memory data exceeds the network bandwidth between the source node and the destination node, the migration data will not converge, and the virtual machine will always be in the migration task, resulting in a low migration efficiency of the virtual machine.
[0004] Therefore, there is a technical problem of low migration efficiency of virtual machines in the prior art. Summary of the Invention
[0005] The embodiments of the present application provide a method and device for migrating virtual machines, and a storage medium, so as to at least solve the technical problem of low migration efficiency of virtual machines.
[0006] According to an embodiment of the present application, a method for migrating a virtual machine is provided, including: when a target virtual machine meets a first migration condition, obtaining, by using a virtualization management component, a first migration request carrying first migration information, where the first migration request is used to request to migrate the target virtual machine from a first server to a second server, the first migration information is used to migrate the target virtual machine, and the first migration information carries a prompt message for prompting to use a first acceleration component configured for the first server to migrate the target virtual machine; sending, by using the virtualization management component, the virtual machine resources and the first migration information of the target virtual machine to the first acceleration component; compressing, by using the first acceleration component, the virtual machine resources based on the first migration information to obtain virtual machine compressed resources; and sending, by using the first acceleration component, the virtual machine compressed resources to a second acceleration component configured for the second server, so that the second server uses the second acceleration component to decompress the virtual machine compressed resources to obtain virtual machine resources.
[0007] According to another embodiment of the present application, a virtual machine migration device is provided, including: an acquisition unit, configured to, when a target virtual machine meets a first migration condition, use a virtualization management component to acquire a first migration request carrying first migration information, where the first migration request is used to request to migrate the target virtual machine from a first server to a second server, the first migration information is used to migrate the target virtual machine, and the first migration information carries a prompt message for prompting to use a first acceleration component configured for the first server to migrate the target virtual machine; a first sending unit, configured to use the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the first acceleration component; a compression processing unit, configured to use the first acceleration component to perform compression processing on the virtual machine resources based on the first migration information to obtain virtual machine compressed resources; a second sending unit, configured to use the first acceleration component to send the virtual machine compressed resources to a second acceleration component configured for the second server, so that the second server uses the second acceleration component to perform decompression processing on the virtual machine compressed resources to obtain virtual machine resources.
[0008] According to yet another embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0009] According to yet another embodiment of the present application, an electronic device is further provided, including a memory and a processor, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0010] According to yet another embodiment of the present application, a computer program product is further provided, including a computer program, and the steps of the methods described in various embodiments of the present application are implemented when the computer program is executed by a processor.
[0011] Through the embodiments provided in this application, when the target virtual machine meets the first migration condition, the virtualization management component is used to obtain a first migration request carrying first migration information. The first migration request is used to request migrating the target virtual machine from the first server to the second server. The first migration information is used to migrate the target virtual machine, and the first migration information carries a prompt message for prompting to use the first acceleration component configured for the first server to migrate the target virtual machine. The virtual machine resources and the first migration information of the target virtual machine are sent to the first acceleration component by using the virtualization management component. The first acceleration component performs compression processing on the virtual machine resources based on the first migration information to obtain virtual machine compressed resources. The first acceleration component sends the virtual machine compressed resources to the second acceleration component configured for the second server, so that the second server uses the second acceleration component to decompress the virtual machine compressed resources to obtain virtual machine resources. That is to say, by adopting the embodiments of this application, by using acceleration components, such as the Quick Assist Technology (QAT for short), dirty data can be effectively compressed without increasing the system burden, and data convergence can be maintained even under high business loads, ensuring that the migration is completed within a predetermined time. The problem of low migration efficiency caused by a large amount of memory dirty data during the traditional online migration process is solved, the efficiency of the migration process and the continuity of the service are ensured, and at the same time, the pressure on the host resources is reduced, providing a more powerful and flexible virtual machine migration ability for the cloud platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a flowchart of a method for migrating a virtual machine according to an embodiment of this application;
[0013] Figure 2 is a schematic diagram of a method for migrating a virtual machine according to an embodiment of this application;
[0014] Figure 3 is a flowchart of a method for migrating a virtual machine according to an embodiment of this application;
[0015] Figure 4 is a structural block diagram of a device for migrating a virtual machine according to an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0016] The embodiments of this application will be described in detail below with reference to the drawings and in conjunction with the embodiments.
[0017] It should be noted that in the description, claims and the above drawings of this application, terms such as "first", "second", etc. are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "include", "have" and any of their variants are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or devices.
[0018] As an alternative solution, the method for migrating a virtual machine specifically includes the following steps Figure 1 as shown below:
[0019] S102, when the target virtual machine meets the first migration condition, use the virtualization management component to obtain a first migration request carrying first migration information, where the first migration request is used to request to migrate the target virtual machine from the first server to the second server, the first migration information is used to migrate the target virtual machine, and the first migration information carries a prompt message for prompting to use the first acceleration component configured for the first server to migrate the target virtual machine.
[0020] It should be noted that the above method for migrating a virtual machine can be applied to, but is not limited to, at least one of the following scenarios:
[0021] Resource balancing scenario: In a cloud platform cluster, such as an OpenStack Cloud Software (referred to as Openstack), when the resource (CPU, memory, etc.) utilization rate of a certain computing node (such as the first server) is too high, while the resources of other nodes (such as the second server) are relatively idle, the resource-intensive virtual machine is migrated from the high-load node to the low-load node to achieve balanced utilization of resources and improve the efficiency and stability of the entire cluster.
[0022] Hardware maintenance and failover scenario: When a server needs to perform hardware maintenance or fails, in order to avoid business interruption on the virtual machine, the virtual machine can be quickly migrated to other healthy servers. This migration method can accelerate this process and ensure business continuity.
[0023] Virtual machine expansion or contraction: As business requirements change, virtual machines may need to be migrated between different servers to adjust their resource configurations (e.g., migrating from a server with fewer resources to a server with more abundant resources). Using an accelerated migration method can complete this adjustment faster and reduce the business adjustment time.
[0024] Data center migration: When performing data center migration or upgrade, virtual machines need to be migrated from the old data center to the new data center. This method can improve the migration speed, reduce the service interruption time during the migration process, and lower the migration cost.
[0025] Cross-regional migration: For a distributed cloud environment, it may be necessary to migrate virtual machines from one geographical location to another. This method can reduce the data transfer time across the network, which is especially important for geographically dispersed cloud service providers.
[0026] Optionally, in some embodiments, the above virtualization management component can be used but is not limited to indicating the virtualization management virtualization application interface (Libvirt Virtualization API, hereinafter referred to as Libvirt). Libvirt is an open-source software collection that provides a set of APIs for managing virtualization functions on a machine. Libvirt allows applications to control virtualization technologies such as KVM, Xen, LXC, QEMU, VMware ESX, etc., provides a unified interface to start, stop, monitor, and manage virtual machines, and configure virtualization resources such as networks and storage. Through Libvirt, developers can write a set of code and operate across multiple virtualization platforms, greatly enhancing the flexibility and efficiency of virtualization management.
[0027] Further, the above first migration information may but is not limited to include a first migration parameter and a first flag. Specifically, the above first migration parameter may but is not limited to include: a migration type, indicating live migration; information of the second server, such as the IP address, port, authentication information, etc. of the second server; a migration bandwidth limit, which can set an upper limit on the network bandwidth usage during the migration process to avoid the migration operation affecting other network services or operations. Compression algorithms and levels, such as the selection of QuickAssist Technology (QAT) compression, Extended Block Zero Run-Length Encoding (XBZRLE), etc. and the selection of compression levels. The higher the compression level, the better the compression effect but it may increase the time of the compression operation; information of the QAT component, such as the ID, status, acceleration type (compression, decompression, etc.) and possible other configuration details of the QAT device; a dirty page processing strategy. In the live migration scenario, how to process the data modified (dirty pages) in the memory, which can be to wait until the number of dirty pages drops to a certain threshold before migrating, or use a specific dirty page replication strategy; a storage migration configuration, such as whether to use incremental storage migration, a snapshot strategy, etc. Network state synchronization, ensuring that after the virtual machine is migrated, its network state (such as IP address, network interface information) is correctly configured and synchronized on the second server; a migration priority: when resources are scarce or there are multiple migration tasks in progress simultaneously, the migration priority can be set to determine the execution order of the migration tasks. Security and authentication parameters, ensuring the security of data during the migration process, which may include the selection of encryption algorithms, key information, authentication methods, etc.; a migration timeout and retry mechanism, setting the timeout time and retry strategy of the migration operation to improve the reliability of the migration process; log parameters, configuring the log records during the migration process to facilitate tracking the migration status and subsequent troubleshooting, and so on, as well as other parameter information for migrating the target virtual machine. Further, the above first flag may but is not limited to be used to indicate the use of the compression and decompression functions of QAT during the migration process.
[0028] Optionally, in some embodiments, the above first acceleration component may but is not limited to be a QAT component configured for the first server. QAT is a hardware acceleration technology mainly used to improve data processing performance, especially in tasks such as data encryption, decryption, compression, and decompression. QAT can offload these computationally intensive tasks through a dedicated hardware acceleration engine, thereby reducing the CPU load and improving the overall system performance and efficiency. The QAT technology is usually integrated into Intel's network adapters and processors to provide acceleration support for scenarios such as data centers, cloud computing, and high-performance computing.
[0029] It should be noted that in some embodiments, before obtaining the first migration request carrying the first migration information by using the virtualization management component as described above, it is also necessary to modify the virtualization layer libvirt code to add the migration flag information required for QAT migration acceleration and the migration parameters required for migration. These flags and parameters are mainly passed through libvirt. For this virtual machine migration, the acceleration function is to be used, and the QAT acceleration technology is to be used. In addition, it is also necessary to modify the virtual machine migration code logic of the QEMU module. Libvirt determines that QAT migration acceleration is to be used for this migration according to the parameters issued by the cloud platform, and then sends the virtual machine and host information to the Quick Emulator (QEMU) after sorting them out. After receiving the migration parameters, QEMU will call the compression and decompression functions provided by QAT when migrating the virtual machine memory data.
[0030] S104. Use the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the first acceleration component.
[0031] It should be noted that the virtual machine resources of the above target virtual machine can include but are not limited to: the running state and data of the target virtual machine. For example, the memory state, the memory of the virtual machine stores the runtime data of the operating system and applications, including process state, register information, stack data, and dynamically loaded libraries, etc. During online migration, these memory data must be completely copied from the source node to the destination node to ensure that the virtual machine can continue to run seamlessly on the new node; the disk state, although the disk data of the virtual machine usually will not be transmitted in real time during the migration process (especially for online migration), the disk file or block device mapping information of the virtual machine needs to be correctly set on the destination node to ensure that the virtual machine can access its original disk data after migration; the network state, the network connection state of the virtual machine needs to be maintained during migration, including IP address, MAC address, routing table, and network connection information, etc., to ensure that the virtual machine can continue to communicate over the network after migration; the CPU state, the CPU context of the virtual machine, including execution state, interrupt state, instruction pointer, and the values of each CPU register, etc., also needs to be considered during the migration process. In some cases, it may be necessary to pause the CPU activity during the migration process to copy these states; the peripheral state, the virtual machine may be mounted with virtual peripherals (such as virtual disks, virtual network cards, etc.), and the state and configuration information of these devices also need to be correctly restored after migration; the virtual machine configuration information, including basic information such as the number of CPUs, memory size, disk configuration, and network interface configuration of the virtual machine, these information need to be reloaded and set on the destination node, etc. No limitations are imposed on this in this embodiment.
[0032] S106. Use the first acceleration component to perform compression processing on the virtual machine resources based on the first migration information to obtain compressed virtual machine resources.
[0033] S108. Use the first acceleration component to send the compressed virtual machine resources to the second acceleration QAT component configured for the second server, so that the second server uses the second QAT component to decompress the compressed virtual machine resources to obtain virtual machine resources.
[0034] Optionally, in some embodiments, the above-mentioned use of the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the first acceleration component may include, but is not limited to: using the Libvirt component to send the virtual machine resources and the first migration information of the target virtual machine to the virtual machine management QEMU component; using the QEMU component to send the virtual machine resources and the first migration information to the first acceleration component.
[0035] Through the embodiments provided in this application, when the target virtual machine meets the first migration condition, use the virtualization management Libvirt component to obtain a first migration request carrying the first migration information, where the first migration request is used to request to migrate the target virtual machine from the first server to the second server, the first migration information is used to migrate the target virtual machine, and the first migration information carries a prompt message for prompting to use the first acceleration QAT component configured for the first server to migrate the target virtual machine; use the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the first acceleration component; use the first acceleration component to perform compression processing on the virtual machine resources based on the first migration information to obtain compressed virtual machine resources; use the first acceleration component to send the compressed virtual machine resources to the second acceleration component configured for the second server, so that the second server uses the second acceleration component to decompress the compressed virtual machine resources to obtain virtual machine resources. That is to say, by adopting the embodiments of this application, through the use of QAT acceleration, dirty data can be effectively compressed without increasing the CPU burden, and data convergence can be maintained even under high business loads, ensuring that the migration is completed within a predetermined time. It solves the problem of low migration efficiency caused by a large amount of memory dirty data during the traditional online migration process, ensures the high efficiency of the migration process and the continuity of the service, and at the same time reduces the pressure on the host resources, providing a more powerful and flexible virtual machine migration ability for the cloud platform.
[0036] As an alternative solution, using the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the first acceleration component includes:
[0037] S1. Use the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the virtual machine management component.
[0038] S2. Use the QEMU component to send the virtual machine resources and the first migration information to the first acceleration component.
[0039] It should be noted that the above virtual machine management component can be, but is not limited to, used to indicate Quick Emulator (QEMU). QEMU is an open-source, pure-software CPU and peripheral emulator that also supports paravirtualization technology and is mainly used to create and run virtual machines. QEMU can run on multiple platforms and simulate multiple different processor architectures, which enables it to not only run as a virtual machine on the same or different hardware platforms but also be used for cross-platform software development and testing. In cloud computing and virtualization technologies, QEMU is often used as the underlying execution environment for virtual machines. By cooperating with management tools such as Libvirt, it provides functions for creating, managing, and running virtual machines, supporting advanced features such as live migration, snapshots, CPU, and memory configuration adjustment of virtual machines. Its paravirtualization mode (such as KVM, i.e., Kernel-based Virtual Machine) can directly access physical hardware, thus providing better performance and efficiency.
[0040] In the embodiment of the present application, the virtual machine resources and the first migration information of the target virtual machine are sent to the virtual machine management component by using the virtualization management component. Then, the virtual machine management component is used to send the virtual machine resources and the first migration information to the first acceleration component. That is to say, through the mediation of Libvirt and QEMU, the cloud platform can intelligently schedule resources and select to execute virtual machine migration on a server with QAT support, thereby making full use of the advantages of hardware acceleration. At the same time, this design maintains compatibility with the existing virtualization architecture, without the need to modify the virtual machine or the operating system, reducing the implementation complexity of the solution.
[0041] As an alternative solution, before using the virtualization management Libvirt component to obtain the first migration request carrying the first migration information when the target virtual machine meets the first migration condition, it further includes:
[0042] Determine that the target virtual machine meets the first migration condition when the first acceleration component configured for the first server is in a running state and the second QAT component configured for the second server is in a running state.
[0043] In an embodiment of the present application, when the first acceleration component configured for the first server is in a running state and the second acceleration component configured for the second server is in a running state, it is determined that the target virtual machine meets the first migration condition. In other words, by adopting the embodiment of the present application, the availability of the hardware acceleration function during the migration process can be ensured by pre-checking the running state of the acceleration component. If the QAT component is not running or has problems, the migration process will not rely on hardware acceleration, thereby avoiding migration failures or delays caused by hardware accelerator failures during the migration process.
[0044] As an alternative solution, the virtual machine migration method further includes:
[0045] When the target virtual machine does not meet the first migration condition, the target virtual machine is migrated according to the resource usage of the first server.
[0046] By adopting the embodiment of the present application, the migration failure caused by insufficient resources can be reduced by intelligently selecting the acceleration scheme. In the absence of QAT acceleration, adopting the acceleration technology most suitable for the current resource state can ensure a smoother migration process and avoid data consistency non-convergence problems caused by resource bottlenecks.
[0047] As an alternative solution, the above-mentioned migrating the target virtual machine according to the resource usage of the first server when the target virtual machine does not meet the first migration condition includes:
[0048] S1, obtaining the first resource utilization rate of the first server and obtaining the second resource utilization rate of the second server.
[0049] Optionally, in some embodiments, after obtaining the first resource utilization rate of the first server and obtaining the second resource utilization rate of the second server when it is determined that the target virtual machine does not meet the first migration condition, it may include, but is not limited to: when the first computing resource utilization rate is less than the first memory utilization rate and the second computing resource utilization rate is less than the second memory utilization rate, it is determined that the target virtual machine meets the second migration condition, where the first resource utilization rate includes the first computing resource utilization rate and the first memory utilization rate, and the second resource utilization rate includes the second computing resource utilization rate and the second memory utilization rate.
[0050] S2, when it is determined that the target virtual machine meets the second migration condition based on the first resource utilization rate and the second resource utilization rate, using the Libvirt component to obtain a second migration request carrying second migration information, where the second migration request is used to request to migrate the target virtual machine from the first server to the second server, the second migration information is used to migrate the target virtual machine, and the second migration information carries a prompt message for prompting to use the virtual machine management component to migrate the target virtual machine.
[0051] It should be noted that the above second migration information may include, but is not limited to, second migration parameters and second flag bits. Specifically, the above second migration parameters may include, but are not limited to: Compression algorithm: Specifies the specific algorithm used during compression, such as LZ4, Zstd, etc. Different compression algorithms have different compression ratios and compression speeds. Selecting the most suitable algorithm for the current scenario can optimize the migration performance. Number of threads: Represents the number of threads used for compression and decompression operations. This usually needs to be adjusted according to the number of CPU cores of the source node and the destination node to fully utilize the parallel computing power of the multi-core processor. Compression level: The compression level determines the intensity of compression. A higher level may provide a better compression ratio, but it will consume more CPU resources and time. Reasonably selecting the compression level is the key to balancing the migration speed and resource consumption. Cache size: If the compression algorithm requires a cache, such as some preprocessing or postprocessing steps, this parameter should specify the size of the cache. Reasonable configuration of the cache can reduce memory copying and access times, improving the compression performance. Data shard size: Represents the size of the fragments into which the data is split during multi-threaded compression. This affects the distribution of data between threads and the efficiency of data compression and decompression. Error recovery strategy: In the event of errors during compression or transmission, this parameter defines how to recover or handle these errors. For multi-threaded operations, the error recovery strategy is particularly important as it needs to ensure the correctness and consistency of all threads. Priority: When using multi-threaded compression, the priority of the threads can be defined to ensure that the compression operation does not overly affect the normal business operations of the virtual machine. Further, the above second flag bit is used to indicate that the multi-threaded compression function is enabled for this migration.
[0052] S3. Use the virtualization management component to send the virtual machine resources and the second migration information to the virtual machine management component.
[0053] S4. Use the virtualization management component to perform compression processing on the virtual machine resources based on the second migration information to obtain compressed virtual machine resources.
[0054] Optionally, the above-mentioned compression processing of virtual machine resources by the virtual machine management component based on the second migration information to obtain virtual machine compressed resources may include, but is not limited to: using the QEMU component to perform multi-threaded compression on virtual machine resources based on the second migration information to obtain virtual machine compressed resources. Specifically, it includes: QEMU parses the flag enabling multi-threaded compression according to the received migration parameters. According to the number of threads in the parameters, QEMU allocates and initializes multiple compression threads, and each thread is responsible for processing a subset of the memory data, sets the compression algorithm and compression level, and allocates necessary resources for each thread, such as caches and working memory. QEMU divides the memory data of the virtual machine into multiple smaller data blocks or pages. The sharding strategy may be based on the size of the data blocks or the logical address of the memory, ensuring that each thread has an independent data block for compression, reducing competition and synchronization overhead between threads. Each thread independently performs compression processing on the memory data block allocated to it. Use a specified compression algorithm for compression, such as LZ4, Zstd, etc., aiming to improve the compression ratio and compression speed. Lightweight synchronization may be required between threads to avoid duplicate processing of data blocks or data conflicts. Among them, QEMU needs to maintain the state of each compression thread and which data blocks have been compressed and completed.
[0055] S5. Use the virtual machine management component to send the virtual machine compressed resources to the second server, so that the second server decompresses the virtual machine compressed resources to obtain virtual machine resources.
[0056] It should be noted that the above steps S1 to S5 are implemented based on the multi-threaded compression technology. The multi-threaded compression technology is an optimization strategy adopted during the online migration of virtual machines. Its core is to use the multi-threaded parallel processing ability to accelerate the compression of virtual machine memory data. This technology is usually based on the computing power of the CPU in existing virtualization and cloud computing environments, and improves the speed and efficiency of data compression by concurrently executing multiple compression tasks.
[0057] In the embodiment of the present application, the first resource utilization rate of the first server is obtained, and the second resource utilization rate of the second server is obtained; when it is determined, based on the first resource utilization rate and the second resource utilization rate, that the target virtual machine meets the second migration condition, the virtualization management component is used to obtain a second migration request carrying second migration information, where the second migration request is used to request to migrate the target virtual machine from the first server to the second server, the second migration information is used to migrate the target virtual machine, and the second migration information carries a prompt message for prompting to use the virtual machine management component to migrate the target virtual machine; the virtual machine resources and the second migration information are sent to the virtual machine management component by using the virtualization management component; the virtual machine management component compresses the virtual machine resources based on the second migration information to obtain virtual machine compressed resources; the virtual machine management component sends the virtual machine compressed resources to the second server so that the second server decompresses the virtual machine compressed resources to obtain virtual machine resources. In other words, by adopting the embodiment of the present application, by dynamically evaluating the resource utilization rate and migration conditions and intelligently selecting the most suitable migration acceleration scheme, not only the migration efficiency is improved, but also the resource utilization is optimized, the flexibility and adaptability of the system are enhanced, the user operation is simplified, the consistency and security of data transmission are ensured, thereby improving the overall performance and user experience of the cloud platform.
[0058] As an optional solution, after obtaining the first resource utilization rate of the first server and obtaining the second resource utilization rate of the second server, it further includes:
[0059] S1. When it is determined, based on the first resource utilization rate and the second resource utilization rate, that the target virtual machine does not meet the second migration condition, the virtualization management component is used to obtain a third migration request carrying third migration information, where the third migration request is used to request to migrate the target virtual machine from the first server to the second server, the third migration information is used to migrate the target virtual machine, and the third migration information carries a prompt message for prompting to use the virtual machine management component to migrate the target virtual machine based on the target migration method.
[0060] It should be noted that, in some embodiments, the above-mentioned third migration information may include, but is not limited to: a third migration parameter and a third flag bit. Specifically, the above-mentioned third migration parameter may include, but is not limited to: Cache size: The XBZRLE technology needs to use a cache to store the reference memory data for subsequent differential comparison. This parameter defines the size of the cache, which is usually related to the physical memory and the virtual machine memory size. Differential detection interval: Indicates the frequency at which the XBZRLE technology detects memory differences, in milliseconds or microseconds. This affects the detection efficiency of dirty pages and the compression effect. Reference point setting: Before the migration starts, a reference point of the memory data needs to be determined for subsequent differential comparison. This parameter may include the strategy for selecting this reference point (for example, at a certain time point before the migration starts, or when the host load is low). Data block size: Defines the size of the blocks into which the data is divided during the migration process, which affects the compression efficiency and the scheduling between threads. Compression threshold: Specifies the condition for starting the XBZRLE compression. For example, if the proportion of memory dirty pages exceeds a certain threshold, the XBZRLE compression is started. Consistency check: To ensure the integrity of data transmission, a consistency check parameter can be set to verify the data consistency during the compression and decompression processes. Error recovery strategy: In the event of errors during compression or transmission, this parameter defines how to recover or handle these errors to ensure the reliability of data migration.
[0061] Furthermore, the above-mentioned third flag bit may be used to indicate, but is not limited to, the XBZRLE compression flag with a value of true. Among them, the XBZRLE compression flag being true means that the XBZRLE technology will be used to reduce the data transmission volume during the migration process.
[0062] It should be noted that the above-mentioned target migration method may be used to indicate, but is not limited to, using the extended bitwise run-length encoding (XBZRLE) technology to migrate the target virtual machine. The XBZRLE technology analyzes the memory data and uses run-length encoding (RLE) and bitwise operations to identify and compress the repeated patterns in the data. During virtual machine migration, it detects the "dirty pages" (i.e., those memory pages that have been modified since the last check) in the memory and performs an exclusive OR operation (XOR operation) on the data in the dirty pages with the reference data of the source node to obtain the differential data (delta data). These differential data are often much smaller in volume than the original data, so the total data volume transmitted during migration is greatly reduced, improving the migration efficiency.
[0063] S2. Use the virtualization management component to send the virtual machine resources and the second migration information to the virtual machine management component.
[0064] S3. Use the virtual machine management component to send the virtual machine resources to the second server.
[0065] S4. When the first server receives a request to update the virtual machine resources and the virtual machine resources have been updated to the target virtual machine resources, use the virtual machine management component to compare the virtual machine resources with the target virtual machine resources according to the target migration method, and determine the difference data between the virtual machine resources and the target virtual machine resources.
[0066] It should be noted that the virtual machine management component will store a copy of the virtual machine resources in the cache. Subsequently, after the virtual machine resources are updated, the virtual machine resources in the cache will be compared with the updated virtual machine resources.
[0067] S5. Use the virtual machine management component to send the difference data to the second server.
[0068] For example, it is possible but not limited to refer to the following example as shown in Figure 2 to illustrate the above steps: As shown in Figure 2 perform an exclusive OR operation on the virtual machine resources 202 and the target virtual machine resources 204 to obtain the difference data 206.
[0069] It should be noted that the above example is an optional example provided to facilitate the explanation of the above virtual machine migration method, and there is no limitation on the above virtual machine migration method.
[0070] In an embodiment of the present application, when it is determined that the target virtual machine does not meet the second migration condition based on the first resource utilization rate and the second resource utilization rate, the virtualization management component is used to obtain a third migration request carrying third migration information, where the third migration request is used to request to migrate the target virtual machine from the first server to the second server, the third migration information is used to migrate the target virtual machine, and the third migration information carries a prompt message for prompting to use the virtual machine management component to migrate the target virtual machine based on the target migration method; the virtualization management component is used to send the virtual machine resources and the second migration information to the virtual machine management component; the virtual machine management component is used to send the virtual machine resources to the second server; when the first server receives an update request for the virtual machine resources and the virtual machine resources have been updated to the target virtual machine resources, the virtual machine management component is used to compare the virtual machine resources with the target virtual machine resources according to the target migration method, and determine the difference data between the virtual machine resources and the target virtual machine resources; the virtual machine management component is used to send the difference data to the second server. In other words, in the embodiment of the present application, when the target virtual machine does not meet the second migration condition, the system switches to the migration method based on the QEMU component. This method significantly reduces the occupancy of network bandwidth and migration time by comparing the difference data of virtual machine resources on the source node and the destination node and only transmitting the changed data part instead of the complete virtual machine state. This strategy is particularly suitable for scenarios with limited network bandwidth or requiring quick response, improving the migration efficiency.
[0071] As an optional solution, after obtaining the first resource utilization rate of the first server and the second resource utilization rate of the second server when it is determined that the target virtual machine does not meet the first migration condition, it further includes:
[0072] When the first computing resource utilization rate is less than the first memory utilization rate and the second computing resource utilization rate is less than the second memory utilization rate, it is determined that the target virtual machine meets the second migration condition, where the first resource utilization rate includes the first computing resource utilization rate and the first memory utilization rate, and the second resource utilization rate includes the second computing resource utilization rate and the second memory utilization rate.
[0073] In other words, in the embodiment of the present application, when the CPU utilization rate is lower than the memory utilization rate, it indicates that the CPU resources of the server are relatively sufficient, while the memory resources may be more tense. In this case, it is appropriate to select the CPU compression migration scheme because the compression process mainly consumes CPU resources, and the decompression and restoration of the virtual machine state consume relatively less memory resources. This strategy ensures the matching of resource priorities, makes full use of the computing power of the server, and at the same time avoids over-exploiting the memory resources.
[0074] Optionally, in some embodiments, after the virtual machine resources and the first migration information of the target virtual machine are sent to the first acceleration component by using the Libvirt component as described above, it may but is not limited to further include:
[0075] Call the built-in deduplication function in KVM through the Libvirt component to remove duplicate resources in the virtual machine resources. Specifically, divide the virtual machine resources into N virtual machine sub-resources, and remove the duplicate virtual machine sub-resources among the N virtual machine sub-resources to obtain M virtual machine sub-resources, where N is greater than or equal to M, N is a positive integer, and M is a positive integer.
[0076] By adopting the embodiments of the present application, by dividing the virtual machine resources into sub-resources and removing the duplicate parts, the amount of data that actually needs to be migrated can be significantly reduced, thereby accelerating the speed of the entire migration process.
[0077] Optionally, as an alternative example, it may but is not limited to use the following example as shown in Figure 3 to illustrate the above virtual machine migration method by way of example:
[0078] Execute step S302, and the user logs in to the cloud platform management page.
[0079] Then execute step S304, the user enters the virtual machine list and selects the virtual machine to be migrated online.
[0080] Then execute step S306, the user clicks the online migration function and checks the migration acceleration.
[0081] Then execute step S308. When the cloud platform determines that migration acceleration is enabled after receiving the migration request, query whether there is QAT hardware on the virtual machine source node and destination node and whether the QAT service is running normally through the host command.
[0082] When there is QAT hardware and the QAT service is running normally, execute steps S308-1 to S310-1. The cloud platform selects to use QAT migration acceleration, sets the virtual machine QAT migration acceleration flag bit and migration parameters, and sends the migration request to libvirt. After receiving the request, libvirt collects virtual machine and host information to establish a migration channel and sends the request to QEMU for processing.
[0083] In the case where there is no QAT hardware or the QAT service is not running properly, step S308-2 is executed to obtain the average load of the host CPU and memory. If the percentage of available CPU on the host is greater than the percentage of available memory, step S310-2 is executed to migrate the virtual machine using the CPU multithreading compression acceleration scheme. If the percentage of available CPU on the host is less than the percentage of available memory, step S310-3 is executed to set the cache space and migrate the virtual machine using the XBZRLE technology acceleration scheme.
[0084] In this embodiment, a virtual machine migration device is further provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. As used hereinafter, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0085] Figure 4 is a structural block diagram of a virtual machine migration device according to an embodiment of the present application, as Figure 4 shown, the device includes:
[0086] An acquisition unit 402, configured to, when a target virtual machine meets a first migration condition, use a virtualization management component to acquire a first migration request carrying first migration information, where the first migration request is used to request to migrate the target virtual machine from a first server to a second server, the first migration information is used to migrate the target virtual machine, and the first migration information carries a prompt message for prompting to use a first acceleration component configured for the first server to migrate the target virtual machine;
[0087] A first sending unit 404, configured to use the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the first acceleration component;
[0088] A compression processing unit 406, configured to use the first acceleration component to perform compression processing on the virtual machine resources based on the first migration information to obtain virtual machine compressed resources;
[0089] A second sending unit 408, configured to use the first acceleration component to send the virtual machine compressed resources to a second acceleration component configured for the second server, so that the second server uses the second acceleration component to perform decompression processing on the virtual machine compressed resources to obtain virtual machine resources.
[0090] As an optional solution, the above first sending unit includes: a first sending module, configured to use the virtualization management component to send the virtual machine resources and the first migration information of the target virtual machine to the virtual machine management component; a second sending module, configured to use the virtual machine management component to send the virtual machine resources and the first migration information to the first acceleration component.
[0091] As an alternative, the above device further includes: a first determination unit, configured to determine that the target virtual machine meets the first migration condition when the first acceleration component configured for the first server is in an operating state and the second acceleration component configured for the second server is in an operating state.
[0092] As an alternative, the above device further includes: a dynamic migration unit, configured to migrate the target virtual machine according to the resource usage of the first server when the target virtual machine does not meet the first migration condition.
[0093] As an alternative, the above dynamic migration unit includes: a first acquisition module, configured to acquire a first resource utilization rate of the first server and a second resource utilization rate of the second server; a first determination module, configured to, when it is determined that the target virtual machine meets the second migration condition based on the first resource utilization rate and the second resource utilization rate, acquire, by using a virtualization management component, a second migration request carrying second migration information, where the second migration request is used to request to migrate the target virtual machine from the first server to the second server, the second migration information is used to migrate the target virtual machine, and the second migration information carries a prompt information for prompting to use the virtual machine management component to migrate the target virtual machine; a first sending module, configured to send, by using the virtualization management component, the virtual machine resources and the second migration information to the virtual machine management component; a first compression processing module, configured to perform compression processing on the virtual machine resources based on the second migration information by using the virtual machine management component to obtain virtual machine compressed resources; a second sending module, configured to send, by using the virtual machine management component, the virtual machine compressed resources to the second server so that the second server decompresses the virtual machine compressed resources to obtain the virtual machine resources.
[0094] As an alternative solution, the above dynamic migration unit further includes: a second determination module, configured to, when it is determined that the target virtual machine does not meet the second migration condition based on the first resource utilization rate and the second resource utilization rate, obtain, by using a virtualization management component, a third migration request carrying third migration information, where the third migration request is used to request to migrate the target virtual machine from a first server to a second server, the third migration information is used to migrate the target virtual machine, and the third migration information carries prompt information for prompting to use the virtual machine management component to migrate the target virtual machine based on a target migration method; a third sending module, configured to send, by using the virtualization management component, virtual machine resources and the second migration information to the virtual machine management component; a fourth sending module, configured to send, by using the virtual machine management component, the virtual machine resources to the second server; a third determination module, configured to, when the first server receives a request for updating the virtual machine resources and the virtual machine resources have been updated to target virtual machine resources, compare, by using the virtual machine management component, the virtual machine resources with the target virtual machine resources according to the target migration method, and determine the difference data between the virtual machine resources and the target virtual machine resources; a fifth sending module, configured to send, by using the virtual machine management component, the difference data to the second server.
[0095] As an alternative solution, the above device further includes: a determination unit, configured to determine that the target virtual machine meets the second migration condition when the first computing resource utilization rate is less than the first memory utilization rate and the second computing resource utilization rate is less than the second memory utilization rate, where the first resource utilization rate includes the first computing resource utilization rate and the first memory utilization rate, and the second resource utilization rate includes the second computing resource utilization rate and the second memory utilization rate.
[0096] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and the exemplary embodiments, and details are not described herein again.
[0097] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), and includes several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application.
[0098] It should be noted that the above-mentioned various modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above-mentioned modules are all located in the same processor; or, the above-mentioned various modules are respectively located in different processors in any combination form.
[0099] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. Among them, the computer program is set to execute the steps in any one of the above method embodiments when running.
[0100] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk or optical disc, etc., various media that can store computer programs.
[0101] An embodiment of the present application further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is set to run the computer program to execute the steps in any one of the above method embodiments.
[0102] In an exemplary embodiment, the above electronic device may further include a transmission device and an input / output device. Among them, the transmission device is connected to the above processor, and the input / output device is connected to the above processor.
[0103] An embodiment of the present application further provides a computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores the computer program product. When the computer program is executed by a processor, it implements the steps of the method in each embodiment of the present application.
[0104] The specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and will not be repeated here.
[0105] Obviously, those skilled in the art should understand that the above-mentioned various modules or steps of the present application can be implemented by a general-purpose computing device. They can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately made into individual integrated circuit modules, or multiple modules or steps among them can be made into a single integrated circuit module to implement. In this way, the present application is not limited to any specific combination of hardware and software.
[0106] The above are only the preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various modifications and changes can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for migrating a virtual machine, characterized in that: include: In a case where the target virtual machine meets the first migration condition, using the virtualization management component to obtain a first migration request carrying first migration information, wherein the first migration request is used to request to migrate the target virtual machine from the first server to the second server, the first migration information is used to migrate the target virtual machine, and the first migration information carries prompt information for prompting to use the first acceleration component configured for the first server to migrate the target virtual machine; Using a virtualization management component, sending the virtual machine resources of the target virtual machine and the first migration information to a first acceleration component; Using the first acceleration component to compress the virtual machine resources based on the first migration information to obtain virtual machine compressed resources; The first acceleration component is used to send the virtual machine compression resource to the second acceleration component configured for the second server, so that the second server uses the second acceleration component to decompress the virtual machine compression resource to obtain the virtual machine resource.
2. The method for migrating a virtual machine according to claim 1, characterized in that: The sending the virtual machine resources of the target virtual machine and the first migration information to the first acceleration component by using the virtualization management component includes: Using a virtualization management component, sending the virtual machine resources of the target virtual machine and the first migration information to a virtual machine management component; The virtual machine resources and the first migration information are sent to the first acceleration component by using a virtual machine management component.
3. The method for migrating a virtual machine according to claim 1, characterized in that: When the target virtual machine meets the first migration condition, before using the virtualization management component to obtain the first migration request carrying the first migration information, the method further includes: When the first acceleration component configured for the first server is in a running state and the second acceleration component configured for the second server is in a running state, it is determined that the target virtual machine meets the first migration condition.
4. The method for migrating a virtual machine according to any one of claims 1 to 3, characterized in that: The virtual machine migration method further includes: When the target virtual machine does not satisfy the first migration condition, the target virtual machine is migrated according to resource usage of the first server.
5. The method for migrating a virtual machine according to any one of claim 4, characterized in that: When the target virtual machine does not meet the first migration condition, migrating the target virtual machine according to the resource usage of the first server includes: Obtaining a first resource utilization rate of the first server, and obtaining a second resource utilization rate of the second server; In a case where it is determined that the target virtual machine meets a second migration condition based on the first resource utilization and the second resource utilization, using the virtualization management component to obtain a second migration request carrying second migration information, wherein the second migration request is used to request migration of the target virtual machine from the first server to the second server, the second migration information is used to migrate the target virtual machine, and the second migration information carries prompt information for prompting the virtual machine management component to be used to migrate the target virtual machine; Using the virtualization management component to send the virtual machine resources and the second migration information to a virtual machine management component; Using the virtual machine management component to compress the virtual machine resources based on the second migration information to obtain the virtual machine compressed resources; The virtual machine management component is used to send the virtual machine compressed resource to the second server, so that the second server decompresses the virtual machine compressed resource to obtain the virtual machine resource.
6. The method for migrating a virtual machine according to claim 5, characterized in that: After obtaining the first resource utilization of the first server and obtaining the second resource utilization of the second server, the method further includes: when it is determined based on the first resource utilization and the second resource utilization that the target virtual machine does not meet the second migration condition, using the virtualization management component to obtain a third migration request carrying third migration information, wherein the third migration request is used to request to migrate the target virtual machine from the first server to the second server, the third migration information is used to migrate the target virtual machine, and the third migration information carries prompt information for prompting the virtual machine management component to migrate the target virtual machine based on the target migration method; Using a virtualization management component, sending the virtual machine resources and the second migration information to the virtual machine management component; Using the virtual machine management component to send the virtual machine resources to the second server; When the first server receives an update request for the virtual machine resource and the virtual machine resource has been updated to a target virtual machine resource, using the virtual machine management component to compare the virtual machine resource with the target virtual machine resource according to the target migration mode, and determining difference data between the virtual machine resource and the target virtual machine resource; The virtual machine management component is used to send the difference data to the second server.
7. The method for migrating a virtual machine according to claim 5, characterized in that: After obtaining the first resource utilization of the first server and obtaining the second resource utilization of the second server, the method further includes: When the first computing resource utilization is less than the first memory utilization and the second computing resource utilization is less than the second memory utilization, it is determined that the target virtual machine meets the second migration condition, wherein the first resource utilization includes the first computing resource utilization and the first memory utilization, and the second resource utilization includes the second computing resource utilization and the second memory utilization.
8. A virtual machine migration device, characterized in that: include: an acquisition unit, configured to acquire, by using a virtualization management component, a first migration request carrying first migration information when a target virtual machine satisfies a first migration condition, wherein the first migration request is used to request migration of the target virtual machine from a first server to a second server, the first migration information is used to migrate the target virtual machine, and the first migration information carries prompt information for prompting to adopt a first acceleration component configured for the first server to migrate the target virtual machine; A first sending unit, configured to send the virtual machine resources of the target virtual machine and the first migration information to a first acceleration component by using a virtualization management component; A compression processing unit, configured to use the first acceleration component to compress the virtual machine resources based on the first migration information to obtain virtual machine compressed resources; The second sending unit is used to use the first acceleration component to send the virtual machine compression resource to the second acceleration component configured for the second server, so that the second server uses the second acceleration component to decompress the virtual machine compression resource to obtain the virtual machine resource.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.