A method, device, equipment and storage medium for migrating a virtual machine across clusters

By generating and restoring virtual machine backup data using a shared backup storage device in both the source and target clusters, the inefficiency and security issues of cross-cluster migration in existing technologies are resolved, achieving an efficient, agentless migration solution.

CN115344355BActive Publication Date: 2026-06-26JINAN INSPUR DATA TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN INSPUR DATA TECH CO LTD
Filing Date
2022-09-02
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing methods for migrating virtual machines across clusters require manually copying large amounts of data, which is cumbersome, or changing the storage structure, which poses security and resource consumption issues. There is a lack of efficient agentless migration solutions.

Method used

The migration process involves generating backup data for virtual machines by connecting both the source and target clusters to a backup storage device, suspending services under migration conditions, and then using the backup recovery interface of the target cluster to restore the data to the target cluster storage device, thus completing the migration.

Benefits of technology

It enables efficient cross-cluster migration without agent virtual machines or changes to storage structure, simplifying the operation process and reducing resource consumption and security risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115344355B_ABST
    Figure CN115344355B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of cloud computing, and particularly discloses a method for cross-cluster migration of a virtual machine, which comprises the following steps: connecting a source cluster where a to-be-migrated virtual machine exists and a target cluster where the to-be-migrated virtual machine is to be migrated to a same backup storage device, generating backup data of the source cluster in the backup storage device, suspending the service of the to-be-migrated virtual machine when the to-be-migrated virtual machine reaches a migration condition, calling a backup recovery interface of the target cluster to recover the backup data to a second back-end storage device mounted by the target cluster, and configuring the to-be-migrated virtual machine in the target cluster, so that the cross-cluster migration of the virtual machine is realized in the form of backup data import and export, the storage structure of the source cluster and the storage structure of the target cluster do not need to be changed, an agent virtual machine for the cross-cluster migration of the virtual machine does not need to be created, and the efficient cross-cluster migration of the virtual machine can be realized. The application also discloses a device and equipment for cross-cluster migration of a virtual machine and a storage medium, which have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and in particular to a method, apparatus, device and storage medium for migrating virtual machines across clusters. Background Technology

[0002] With the rapid development of cloud computing technology, multi-cloud and hybrid cloud are gradually becoming the trend of future technology development. In a real multi-cloud environment, due to system updates, business needs, and other reasons, it is often necessary to migrate virtual machines from one cluster to another.

[0003] Currently, the main methods for migrating virtual machines across clusters are as follows:

[0004] Method 1 involves copying all volume data mounted on the virtual machine to be migrated from the source cluster to the local machine in the target cluster, and then uploading the local files to the target cluster to achieve cross-cluster migration of the virtual machine. However, this method requires migrating the virtual machine's file data from the local machine in the source cluster to the local machine in the target cluster, which is a cross-storage migration. This often requires manual copying, making the operation cumbersome, and the amount of data in the local files is usually quite large, resulting in low efficiency for virtual machine migration.

[0005] Method 2 involves temporarily mounting the target cluster's backend storage to the source cluster. This then allows all volume data of the virtual machines to be migrated in the source cluster to be migrated to the target cluster's storage backend. While this method achieves a similar effect to Method 1, it requires changes to the storage structures of both the source and target clusters, and has several limitations, including security restrictions, making it more constrained in practical use.

[0006] Method 3 involves creating backups of all volumes mounted by the proxy virtual machine in the source cluster, and then using the proxy virtual machine to read the backup data to the target cluster, thus achieving virtual machine migration. However, this method requires creating a proxy virtual machine to perform the cross-cluster migration task, which consumes a significant amount of additional hardware and software resources.

[0007] Providing an efficient method for migrating virtual machines across clusters without requiring agents or changes to the storage structure of the two clusters is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention

[0008] The purpose of this application is to provide a method, apparatus, device, and storage medium for migrating virtual machines across clusters, which does not require agent virtual machines and does not require changes to the storage structure of the two clusters, and can achieve efficient cross-cluster migration of virtual machines.

[0009] To address the aforementioned technical problems, this application provides a method for migrating virtual machines across clusters, comprising:

[0010] When there are virtual machines to be migrated in the source cluster, backup data of the virtual machines to be migrated is generated in the backup storage device that is commonly connected to by the source cluster and the target cluster of the virtual machines to be migrated.

[0011] After the migration conditions of the virtual machine to be migrated are met, the services of the virtual machine to be migrated are suspended, and the backup and recovery interface of the target cluster is called to restore the backup data to the second back-end storage device mounted on the target cluster.

[0012] Configure the virtual machine to be migrated in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated.

[0013] Optionally, when there are virtual machines to be migrated in the source cluster, backup data for the virtual machines to be migrated is generated in the backup storage device that is commonly accessed by both the source cluster and the target cluster of the virtual machines to be migrated. Specifically, this includes:

[0014] When the source cluster contains the virtual machine to be migrated, it is determined whether the source cluster and the target cluster have a common access to the backup storage device;

[0015] If so, proceed to the step of generating backup data for the virtual machine to be migrated in the backup storage device that is commonly accessed by the source cluster and the target cluster of the virtual machine to be migrated;

[0016] If not, the storage device that does not store data from the source cluster or the target cluster is identified as the backup storage device. After the backup storage device is mounted to both the source cluster and the target cluster, the process proceeds to the step of generating backup data for the virtual machine to be migrated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machine to be migrated.

[0017] Optionally, generating backup data for the virtual machine to be migrated in a backup storage device shared by the source cluster and the target cluster of the virtual machine to be migrated specifically includes:

[0018] A full backup of the virtual machine to be migrated is generated on the backup storage device;

[0019] For the data updated by the virtual machine to be migrated from the starting point of the full backup data generation, a first incremental backup data is generated in the backup storage device.

[0020] Optionally, after the migration conditions of the virtual machine to be migrated are met, suspending the services of the virtual machine to be migrated and calling the backup and recovery interface of the target cluster to restore the backup data to the second backend storage device mounted on the target cluster specifically includes:

[0021] After the migration conditions of the virtual machine to be migrated are met, the task of the virtual machine to be migrated is paused, and second incremental backup data is generated in the backup storage device based on the data of the virtual machine to be migrated in memory.

[0022] The backup and recovery interface of the target cluster is invoked to restore the full backup data, the first incremental backup data, and the second incremental backup data to the second backend storage device.

[0023] Optionally, after the migration conditions of the virtual machine to be migrated are met, suspending the services of the virtual machine to be migrated and calling the backup and recovery interface of the target cluster to restore the backup data to the second backend storage device mounted on the target cluster specifically includes:

[0024] After calling the backup and recovery interface of the target cluster to restore the full backup data to the second backend storage device, the first incremental backup data is then restored to the second backend storage device.

[0025] Determine whether the first incremental backup data in the backup storage device that has not been restored to the second backend storage is less than a preset data amount;

[0026] If so, it is confirmed that the migration conditions of the virtual machine to be migrated have not been met, and the process returns to the step of determining whether the first incremental backup data in the backup storage device that has not been restored to the second backend storage is less than the preset data amount;

[0027] If not, then confirm that the migration conditions of the virtual machine to be migrated have been met, suspend the services of the virtual machine to be migrated, generate second incremental backup data in the backup storage device based on the data of the virtual machine to be migrated in memory, and call the backup and recovery interface of the target cluster to restore the first incremental backup data and the second incremental backup data that have not been restored to the second backend storage device.

[0028] Optional, also includes:

[0029] The size of the preset data volume is calculated based on the allowed pause duration of services for the virtual machine to be migrated.

[0030] Optional, also includes:

[0031] After suspending the services of the virtual machine to be migrated, the data of the virtual machine to be migrated in memory is flushed to the first backend storage device mounted on the source cluster.

[0032] Optional, also includes:

[0033] Determine whether the cross-cluster migration task has been completed within a preset time period from the date the virtual machine to be migrated was determined;

[0034] If not, then resume operation of the virtual machine to be migrated in the source cluster.

[0035] Optionally, configuring the virtual machine to be migrated on the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated specifically includes:

[0036] The source cluster is invoked to obtain the configuration information of the virtual machine to be migrated;

[0037] The target cluster is invoked to create a target virtual machine, and the target virtual machine is configured according to the configuration information of the virtual machine to be migrated;

[0038] The target virtual machine is started in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated.

[0039] To address the aforementioned technical problems, this application also provides an apparatus for migrating virtual machines across clusters, comprising:

[0040] A backup generation unit is used to generate backup data of the virtual machine to be migrated in a backup storage device that is commonly accessed by the source cluster and the target cluster of the virtual machine to be migrated when there is a virtual machine to be migrated in the source cluster.

[0041] The backup and recovery unit is used to pause the services of the virtual machine to be migrated after the migration conditions of the virtual machine to be migrated are met, and call the backup and recovery interface of the target cluster to restore the backup data to the second back-end storage device mounted on the target cluster.

[0042] The configuration unit is used to configure the virtual machine to be migrated in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated.

[0043] To address the aforementioned technical problems, this application also provides a device for migrating virtual machines across clusters, comprising:

[0044] Memory, used to store computer programs;

[0045] A processor for executing the computer program, which, when executed by the processor, implements the steps of the method for migrating virtual machines across a cluster as described in any of the preceding descriptions.

[0046] To address the aforementioned technical problems, this application also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method for migrating virtual machines across clusters as described in any of the preceding claims.

[0047] The method for migrating virtual machines across clusters provided in this application connects the source cluster containing the virtual machine to be migrated and the target cluster to be migrated to the same backup storage device. Backup data of the source cluster is generated in the backup storage device. When the virtual machine to be migrated meets the migration conditions, the services of the virtual machine to be migrated are paused, and the backup and recovery interface of the target cluster is called to restore the backup data to the second backend storage device mounted on the target cluster. Then, the virtual machine to be migrated is configured in the target cluster. The virtual machine is migrated across clusters by importing and exporting backup data. It can achieve efficient migration of virtual machines across clusters without changing the storage structure of the source cluster or the target cluster, and without creating a proxy virtual machine for cross-cluster migration.

[0048] This application also provides an apparatus, device, and storage medium for migrating virtual machines across clusters, which has the aforementioned beneficial effects, and will not be elaborated further here. Attached Figure Description

[0049] To more clearly illustrate the technical solutions of the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art 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.

[0050] Figure 1 A flowchart of a method for migrating virtual machines across clusters provided in this application;

[0051] Figure 2 This application provides a schematic diagram of a cloud platform architecture for migrating virtual machines across clusters.

[0052] Figure 3 A schematic diagram of the structure of an apparatus for migrating virtual machines across clusters, provided in an embodiment of this application;

[0053] Figure 4 This is a schematic diagram of the structure of a device for migrating virtual machines across clusters, provided as an embodiment of this application. Detailed Implementation

[0054] The core of this application is to provide a method, apparatus, device, and storage medium for migrating virtual machines across clusters, which does not require agent virtual machines and does not require changes to the storage structure of the two clusters, and can achieve efficient cross-cluster migration of virtual machines.

[0055] 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 skilled in the art without creative effort are within the scope of protection of this application.

[0056] Example 1

[0057] Figure 1 A flowchart of a method for migrating virtual machines across clusters provided in this application; Figure 2 This is a schematic diagram of a cloud platform architecture for migrating virtual machines across clusters, provided as an embodiment of this application.

[0058] like Figure 1 As shown in the embodiments of this application, the method for migrating virtual machines across clusters includes:

[0059] S101: When there are virtual machines to be migrated in the source cluster, backup data of the virtual machines to be migrated is generated in the backup storage device that is commonly connected to by the source cluster and the target cluster of the virtual machines to be migrated.

[0060] S102: After the migration conditions of the virtual machine to be migrated are met, the services of the virtual machine to be migrated are suspended, and the backup and recovery interface of the target cluster is called to restore the backup data to the second back-end storage device mounted on the target cluster.

[0061] S103: Configure the virtual machine to be migrated in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated.

[0062] In practical implementation, the method for migrating virtual machines across clusters provided in this application can be implemented on the device where the cloud computing platform resides. It eliminates the need to create an additional proxy virtual machine for cross-cluster migration. Only pre-deployment is required to monitor the presence of processes for the virtual machines to be migrated in each cluster, as well as scripts for controlling the mounting and access of the source and target clusters to the same backup storage device, and for controlling the backup, import, and export of the data of the virtual machines to be migrated. The method for migrating virtual machines across clusters provided in this application can be applied to the OpenStack platform. OpenStack is an open-source cloud computing management platform, a combination of a series of open-source software projects, providing scalable and elastic cloud computing services for private and public clouds. Therefore, both the source and target clusters can be OpenStack clusters.

[0063] The method for migrating virtual machines across clusters provided in this application embodiment uses a backup-import-export approach to achieve the migration of virtual machines across clusters. At this time, the cloud platform architecture is as follows: Figure 2 As shown, this refers to the source cluster 201 accessed under the cloud computing platform (e.g., Figure 2 OpenStack A in the middle) and the target cluster 202 of the virtual machines to be migrated (such as OpenStack A ... Figure 2 In OpenStack B), the local storage of the source cluster 201 is the first backend storage device 203, and the local storage of the target cluster 202 is the second backend storage device 204. When performing a virtual machine cross-cluster migration task, the source cluster 201 and the target cluster 202 jointly access the backup storage device 205 to back up, import, and export the data of the virtual machines to be migrated through the backup storage device 205.

[0064] Referring to the above architecture, the following describes in detail each step of the method for migrating virtual machines across clusters provided in the embodiments of this application.

[0065] For S101, monitor the source cluster. When the monitoring detects a virtual machine to be migrated in the source cluster, initiate a cross-cluster migration task for the virtual machine. Locate a backup storage device that is commonly connected to both the source cluster and the target cluster of the virtual machine to be migrated, and perform backup, import, and export operations on the data of the virtual machine to be migrated.

[0066] It should be noted that, in order to avoid violating the data security policies of each cluster and to ensure data security between clusters, when generating cross-cluster migration tasks, the backup storage device should be in a state where it does not store data from either the source or target cluster, or even has no storage usage at all. Of course, if there are no data security policies or other restrictions between the source and target clusters, it is permissible for the backup storage device to pre-store data from the source and / or target clusters.

[0067] Depending on the actual application, if there has been a previous cross-cluster migration of virtual machines between the source cluster and the target cluster, or other deployments, then a backup storage device shared by both the source cluster and the target cluster of the virtual machine to be migrated will exist when the cross-cluster migration task is generated. In this case, the data of the virtual machine to be migrated can be directly backed up, imported, and exported based on this backup storage device. However, if a backup storage device shared by both the source cluster and the target cluster of the virtual machine to be migrated does not exist when the cross-cluster migration task is generated, then the backup storage device needs to be mounted to both the source cluster and the target cluster. Therefore, S101: When the source cluster contains a virtual machine to be migrated, backup data for the virtual machine to be migrated is generated in the backup storage device shared by both the source cluster and the target cluster of the virtual machine to be migrated. Specifically, this may include:

[0068] If there are virtual machines to be migrated in the source cluster, determine whether the source cluster and the target cluster have a common access backup storage device;

[0069] If so, proceed to the step of generating backup data for the virtual machines to be migrated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machines to be migrated.

[0070] If not, the storage device that does not store data from either the source cluster or the target cluster is identified as the backup storage device. After mounting the backup storage device to both the source and target clusters, the process proceeds to the step of generating backup data for the virtual machines to be migrated in the backup storage device that is shared by both the source cluster and the target cluster.

[0071] After determining the backup storage device, the cloud computing platform calls the backup interface of the source cluster to create backup data for the virtual machine to be migrated, and calls the backup export interface of the source cluster to export the backup data as a JSON file.

[0072] For S102, the cloud computing platform calls the backup import interface of the target cluster to import the backup data into the database of the target cluster.

[0073] The step of calling the target cluster's backup and recovery interface to restore backup data to the second backend storage device mounted on the target cluster can be performed before, after, or simultaneously with pausing the services of the virtual machine to be migrated. That is, after the migration conditions for the virtual machine to be migrated are met, the services of the virtual machine to be migrated can be paused first, and then the target cluster's backup and recovery interface can be called to restore the backup data to the second backend storage device mounted on the target cluster; alternatively, after generating the backup data of the virtual machine to be migrated in the backup storage device in S101, the step of calling the target cluster's backup and recovery interface to restore the backup data to the second backend storage device mounted on the target cluster can begin. The corresponding backup generation (import) strategy and backup recovery (export) strategy are determined based on the different times when the target cluster's backup and recovery interface is called to restore the backup data to the second backend storage device mounted on the target cluster.

[0074] Migration conditions can be determined based on the workload of the virtual machine to be migrated, or further, in conjunction with the workload of the source cluster. If the virtual machine to be migrated is under heavy workload, or if the source cluster is under heavy workload and resource consumption, pausing the services of the virtual machine to be migrated before migration will significantly impact services and may also overload the source cluster. Therefore, migration conditions are set so that the services of the virtual machine to be migrated are only paused and migration proceeds when the virtual machine to be migrated is not under heavy workload.

[0075] For S103, the cloud computing platform calls the backup and recovery interface of the target cluster to restore the backup data of the virtual machine to be migrated to the cloud disk in the second backend storage device mounted on the target cluster.

[0076] After migrating the data of the virtual machine to be migrated to the second backend storage device mounted on the target cluster via backup import / export, it is also necessary to rebuild the task of migrating the virtual machine in the target cluster. Typically, to minimize the impact on business users, the configuration information such as the virtual machine's Internet Protocol Address (IP address) is not changed before and after the virtual machine cross-cluster migration. Therefore, S103: Configure the virtual machine to be migrated in the target cluster to complete the cross-cluster migration task, which may specifically include:

[0077] The source cluster is invoked to obtain the configuration information of the virtual machine to be migrated;

[0078] The target cluster is invoked to create the target virtual machine, and the target virtual machine is configured according to the configuration information of the virtual machine to be migrated;

[0079] Start the target virtual machine in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated.

[0080] Specifically, the cloud computing platform calls the source cluster to obtain the configuration information of the virtual machine to be migrated, and calls the target cluster. Based on the configuration information of the virtual machine to be migrated, the target virtual machine is created using the cloud disk in the second backend storage device mounted on the target cluster, and the target virtual machine is started and initialized with information such as IP address and Media Access Control Address (MAC address).

[0081] After completing the cross-cluster migration task of the virtual machine to be migrated, the data related to the virtual machine to be migrated can be deleted on both the backup storage device and the first backend storage device. Optionally, after deleting the backup data of the virtual machine to be migrated on the backup storage device, the backup storage device can be unmounted from the source cluster and unmounted from the target cluster.

[0082] The method for migrating virtual machines across clusters provided in this application involves connecting the source cluster containing the virtual machine to be migrated and the target cluster to be migrated to the same backup storage device. Backup data of the source cluster is generated in the backup storage device. When the virtual machine to be migrated meets the migration conditions, the services of the virtual machine to be migrated are paused, and the backup and recovery interface of the target cluster is called to restore the backup data to the second backend storage device mounted on the target cluster. Then, the virtual machine to be migrated is configured in the target cluster. The virtual machine is migrated across clusters by importing and exporting backup data. It does not require changing the storage structure of the source cluster or the target cluster, nor does it require creating a proxy virtual machine for migrating virtual machines across clusters, thus achieving efficient migration of virtual machines across clusters.

[0083] Example 2

[0084] Based on the above embodiments, this application further describes the data backup import and export scheme for the virtual machine to be migrated.

[0085] In the method for migrating virtual machines across clusters provided in this application embodiment, step S101, which generates backup data for the virtual machine to be migrated in a backup storage device commonly accessed by both the source cluster and the target cluster of the virtual machine to be migrated, may specifically include:

[0086] Generate a full backup of the virtual machine to be migrated, backup_1, on the backup storage device;

[0087] For the data updated by the virtual machine to be migrated starting from the start time point of the full backup data generation, the first incremental backup data backup_2 is generated in the backup storage device.

[0088] The main challenge in migrating virtual machines across clusters lies in efficiently migrating the volume data mounted by the virtual machine to the target cluster. In practice, a full backup of the virtual machine to be migrated is first created on the backup storage device. This backup, known as backup_1, is the full backup data of the mounted volume vol_a on the first backend storage device mounted by the virtual machine in the source cluster. At this point, the virtual machine is still running; that is, during the creation of the full backup data backup_1, I / O reads and writes are still occurring on the mounted volume vol_a. Therefore, a first incremental backup, backup_2, needs to be created for the virtual machine to be migrated.

[0089] As mentioned in the above embodiments, the step of calling the backup and recovery interface of the target cluster to restore the backup data to the second back-end storage device mounted on the target cluster can be performed before, after, or simultaneously with pausing the services of the virtual machine to be migrated. For example, if the step of calling the backup and recovery interface of the target cluster to restore the backup data to the second back-end storage device mounted on the target cluster is performed after pausing the services of the virtual machine to be migrated, then in S102, after the migration conditions of the virtual machine to be migrated are met, pausing the services of the virtual machine to be migrated and calling the backup and recovery interface of the target cluster to restore the backup data to the second back-end storage device mounted on the target cluster specifically includes:

[0090] Once the migration conditions for the virtual machine to be migrated are met, the task of the virtual machine to be migrated is paused, and a second incremental backup data backup_3 is generated in the backup storage device based on the data of the virtual machine to be migrated in memory.

[0091] Call the backup and recovery interface of the target cluster to restore the full backup data backup_1, the first incremental backup data backup_2, and the second incremental backup data backup_3 to the second backend storage device.

[0092] When the migration conditions for the virtual machine to be migrated are met, i.e., the virtual machine to be migrated is in a state of low business activity, in addition to the full backup data backup_1 and the first incremental backup data backup_2 stored in the backup storage device, the running virtual machine to be migrated is also generating new data in the memory of the source cluster. Therefore, after pausing the business of the virtual machine to be migrated, the data in the memory of the virtual machine to be migrated generates the second incremental backup data backup_3 in the backup storage device. Finally, the data that needs to be restored in the second backend storage device of the target cluster includes the full backup data backup_1, the first incremental backup data backup_2, and the second incremental backup data backup_3 to ensure that the data of the virtual machine to be migrated in the target cluster is consistent with the data of the virtual machine to be migrated in the source cluster.

[0093] Alternatively, if the step of calling the backup and recovery interface of the target cluster to restore the backup data to the second backend storage device mounted on the target cluster is performed while pausing the services of the virtual machine to be migrated, a threshold can be preset to measure the service load of the virtual machine to be migrated, in order to help determine whether the migration conditions of the virtual machine to be migrated have been met. Then, S103: After the migration conditions of the virtual machine to be migrated are met, the services of the virtual machine to be migrated are paused, and the backup and recovery interface of the target cluster is called to restore the backup data to the second backend storage device mounted on the target cluster, specifically including:

[0094] After calling the backup and recovery interface of the target cluster to restore the full backup data backup_1 to the second backend storage device, continue to restore the first incremental backup data backup_2 to the second backend storage device;

[0095] Determine whether the first incremental backup data backup_2, which has not been restored to the second backend storage in the backup storage device, is less than the preset data size;

[0096] If so, confirm that the migration conditions for the virtual machine to be migrated have not been met, and return to the step of determining whether the first incremental backup data backup_2 in the backup storage device that has not been restored to the second backend storage is less than the preset data amount;

[0097] If not, confirm that the migration conditions for the virtual machine to be migrated have been met, suspend the services of the virtual machine to be migrated, generate the second incremental backup data backup_3 in the backup storage device based on the data of the virtual machine to be migrated in memory, and call the backup and recovery interface of the target cluster to restore the first incremental backup data backup_2 and the second incremental backup data backup_3 that have not been restored to the second backend storage device.

[0098] In other words, after initiating the cross-cluster migration task for the virtual machine to be migrated, a full backup data backup_1 is generated. This full backup data backup_1 is then restored to the second backend storage device. During this process, new data generated by the virtual machine to be migrated is backed up as the first incremental backup data backup_2, and this first incremental backup data backup_2 is then restored to the second backend storage device. Throughout this backup import / export process, the amount of data in the un-backed-up and restored first incremental backup data backup_2 is continuously checked to ensure it is less than a preset amount. If it is less, the migration conditions for the virtual machine to be migrated are confirmed, the services of the virtual machine to be migrated are paused, and the remaining backup and restoration of the first incremental backup data backup_2, as well as the backup and restoration of the second incremental backup data backup_3 generated from the data in memory of the virtual machine to be migrated in the backup storage device, are performed.

[0099] To maintain a smooth workflow, a corresponding first incremental backup data backup_2 can be created in each incremental backup cycle (from the creation of the first incremental backup data backup_2 to the execution of the judgment on whether the first incremental backup data backup_2 that has not been restored to the second backend storage in the backup storage device is less than the preset data size, which is one incremental backup cycle). After the backup and recovery of the previous first incremental backup data backup_2 is completed, the judgment on whether the data size of the next first incremental backup data backup_2 is less than the preset data size is then executed.

[0100] The preset data volume is used to measure the size of the first incremental backup data backup_2. It can be set in advance or a default value can be used. When the preset data volume threshold is set large, the number of incremental backup cycles will decrease, but the service interruption time during virtual machine migration may increase. Conversely, when the preset data volume threshold is set small, the number of incremental backup cycles may increase, but the service interruption time during virtual machine migration may decrease. Therefore, the method for migrating virtual machines across clusters provided in this application embodiment may further include: calculating the size of the preset data volume based on the allowed service interruption duration of the virtual machine to be migrated. The allowed service interruption duration of the virtual machine to be migrated can be determined by comprehensively considering parameters such as the type of cloud computing platform, the type of source cluster, the type of virtual machine to be migrated, and the type of service being executed by the virtual machine to be migrated.

[0101] Example 3

[0102] Typically, after migrating a virtual machine to be migrated, it is necessary to delete the data related to the virtual machine to be migrated from both the backup storage device and the first backend storage device. To avoid accidentally deleting the virtual machine to be migrated before the migration is successful, based on the above embodiments, the method for migrating virtual machines across clusters provided in this application further includes: after suspending the services of the virtual machine to be migrated, flushing the data of the virtual machine to be migrated from memory to the first backend storage device mounted on the source cluster.

[0103] In practice, since the first backend storage device already contains all the data of the virtual machine to be migrated, as well as the incremental data generated after the cross-cluster migration task starts (equivalent to the first incremental backup data backup_2), after the service of the virtual machine to be migrated is suspended, while generating the second incremental backup data backup_3 in the backup storage device from the data of the virtual machine to be migrated in memory, it is also necessary to flush the data of the virtual machine to be migrated in memory to the first backend storage device. Only then does the first backend storage device contain all the data of the virtual machine to be migrated before the time of suspension of service.

[0104] Furthermore, the method for migrating virtual machines across clusters provided in this application embodiment may also include:

[0105] Determine whether the cross-cluster migration task has been completed within a preset time period from the date the virtual machine to be migrated was identified;

[0106] If not, then resume the operation of the virtual machine to be migrated in the source cluster.

[0107] The preset time value can be determined based on the allowed pause duration of services for the virtual machine to be migrated. By setting this preset time threshold, the success of the cross-cluster migration task of the virtual machine to be migrated is measured. If it fails, the task is rolled back, and the operation of the virtual machine to be migrated is directly restored in the source cluster; if it succeeds, the cross-cluster migration task is terminated, and the migration of the virtual machine to be migrated is completed.

[0108] The above details various embodiments of the method for migrating virtual machines across clusters. Based on this, this application also discloses apparatus, devices, and storage media for migrating virtual machines across clusters corresponding to the above methods.

[0109] Example 4

[0110] Figure 3 This is a schematic diagram of a device for migrating virtual machines across clusters, provided in an embodiment of this application.

[0111] like Figure 3 As shown in the embodiments of this application, the apparatus for migrating virtual machines across clusters includes:

[0112] Backup generation unit 301 is used to generate backup data of the virtual machine to be migrated in the backup storage device that is commonly accessed by the source cluster and the target cluster of the virtual machine to be migrated when there is a virtual machine to be migrated in the source cluster.

[0113] The backup and recovery unit 302 is used to pause the services of the virtual machine to be migrated after the migration conditions of the virtual machine to be migrated are met, and call the backup and recovery interface of the target cluster to restore the backup data to the second back-end storage device mounted on the target cluster.

[0114] Configuration unit 303 is used to configure the virtual machine to be migrated in the target cluster in order to complete the cross-cluster migration task of the virtual machine to be migrated.

[0115] Furthermore, when the source cluster contains virtual machines to be migrated, the backup generation unit 301 generates backup data for the virtual machines to be migrated in the backup storage device shared by the source cluster and the target cluster of the virtual machines to be migrated. Specifically, this includes:

[0116] If there are virtual machines to be migrated in the source cluster, determine whether the source cluster and the target cluster have a common access backup storage device;

[0117] If so, proceed to the step of generating backup data for the virtual machines to be migrated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machines to be migrated.

[0118] If not, the storage device that does not store data from either the source cluster or the target cluster is identified as the backup storage device. After mounting the backup storage device to both the source and target clusters, the process proceeds to the step of generating backup data for the virtual machines to be migrated in the backup storage device that is shared by both the source cluster and the target cluster.

[0119] Furthermore, the backup generation unit 301 generates backup data for the virtual machines to be migrated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machines to be migrated. Specifically, this includes:

[0120] Generate a full backup of the virtual machines to be migrated on the backup storage device;

[0121] For the data updated by the virtual machine to be migrated starting from the start time of the full backup data generation, the first incremental backup data is generated in the backup storage device.

[0122] Furthermore, after the migration conditions of the virtual machine to be migrated are met, the backup and recovery unit 302 suspends the services of the virtual machine to be migrated, and calls the backup and recovery interface of the target cluster to restore the backup data to the second backend storage device mounted on the target cluster, specifically including:

[0123] Once the migration conditions for the virtual machine to be migrated are met, the task of the virtual machine to be migrated is paused, and a second incremental backup data is generated in the backup storage device based on the data of the virtual machine to be migrated in memory.

[0124] Call the backup and recovery interface of the target cluster to restore the full backup data, the first incremental backup data, and the second incremental backup data to the second backend storage device.

[0125] Furthermore, after the migration conditions of the virtual machine to be migrated are met, the backup and recovery unit 302 suspends the services of the virtual machine to be migrated, and calls the backup and recovery interface of the target cluster to restore the backup data to the second backend storage device mounted on the target cluster, specifically including:

[0126] After calling the backup and recovery interface of the target cluster to restore the full backup data to the second backend storage device, the first incremental backup data is then restored to the second backend storage device.

[0127] Determine whether the first incremental backup data in the backup storage device that has not been restored to the second backend storage is less than the preset data size;

[0128] If so, it is confirmed that the migration conditions for the virtual machine to be migrated have not been met, and the process returns to the step of determining whether the first incremental backup data in the backup storage device that has not been restored to the second backend storage is less than the preset data amount.

[0129] If not, confirm that the migration conditions for the virtual machine to be migrated have been met, suspend the services of the virtual machine to be migrated, generate second incremental backup data in the backup storage device based on the data of the virtual machine to be migrated in memory, and call the backup and recovery interface of the target cluster to restore the second incremental backup data to the second backend storage device.

[0130] Furthermore, the apparatus for migrating virtual machines across clusters provided in this application embodiment also includes:

[0131] The computing unit is used to calculate the preset data volume based on the allowed pause duration of services for the virtual machine to be migrated.

[0132] Furthermore, the apparatus for migrating virtual machines across clusters provided in this application embodiment also includes:

[0133] The refresh unit is used to refresh the data of the virtual machine to be migrated from memory to the first backend storage device mounted on the source cluster after pausing the services of the virtual machine to be migrated.

[0134] Furthermore, the apparatus for migrating virtual machines across clusters provided in this application embodiment also includes:

[0135] The rollback unit is used to determine whether the cross-cluster migration task has been completed within a preset time since the virtual machine to be migrated was identified; if not, the operation of the virtual machine to be migrated is restored in the source cluster.

[0136] Furthermore, configuration unit 303 configures the virtual machine to be migrated in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated, specifically including:

[0137] The source cluster is invoked to obtain the configuration information of the virtual machine to be migrated;

[0138] The target cluster is invoked to create the target virtual machine, and the target virtual machine is configured according to the configuration information of the virtual machine to be migrated;

[0139] Start the target virtual machine in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated.

[0140] 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.

[0141] Example 5

[0142] Figure 4 This is a schematic diagram of the structure of a device for migrating virtual machines across clusters, provided as an embodiment of this application.

[0143] like Figure 4 As shown in the embodiments of this application, the device for migrating virtual machines across clusters includes:

[0144] Memory 410 is used to store computer program 411;

[0145] Processor 420 is configured to execute computer program 411, which, when executed by processor 420, implements the steps of the method for migrating virtual machines across a cluster as described in any of the above embodiments.

[0146] The processor 420 may include one or more processing cores, such as a 3-core processor or an 8-core processor. The processor 420 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 420 may also include a main processor and a coprocessor. The main processor, also known as a 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 420 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 420 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.

[0147] The memory 410 may include one or more storage media, which may be non-transitory. The memory 410 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 410 is used to store at least the following computer program 411, wherein, after being loaded and executed by the processor 420, the computer program 411 is able to implement the relevant steps in the cross-cluster migration method for virtual machines disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 410 may also include an operating system 412 and data 413, and the storage method may be temporary storage or permanent storage. The operating system 412 may be Windows. The data 413 may include, but is not limited to, the data involved in the above methods.

[0148] In some embodiments, the device for migrating virtual machines across clusters may further include a display screen 430, a power supply 440, a communication interface 450, an input / output interface 460, a sensor 470, and a communication bus 480.

[0149] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the device for migrating virtual machines across clusters and may include more or fewer components than illustrated.

[0150] The device for migrating virtual machines across clusters provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the method for migrating virtual machines across clusters as described above, with the same effect.

[0151] It should be noted that the device and equipment embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms. Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0152] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0153] If the integrated modules are implemented as software functional modules and sold or used as independent products, they can be stored in a 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.

[0154] Therefore, embodiments of this application also provide a storage medium storing a computer program that, when executed by a processor, implements steps such as a method for migrating virtual machines across a cluster.

[0155] The storage medium can include various media that can store program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0156] The computer program contained in the storage medium provided in this embodiment can implement the steps of the method for migrating virtual machines across clusters as described above when executed by a processor, with the same effect.

[0157] The foregoing provides a detailed description of a method, apparatus, device, and storage medium for migrating virtual machines across clusters, as provided in this application. 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, device, and storage medium disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various 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.

[0158] 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 method for migrating virtual machines across clusters, characterized in that, include: When there are virtual machines to be migrated in the source cluster, backup data of the virtual machines to be migrated is generated in the backup storage device that is commonly connected to by the source cluster and the target cluster of the virtual machines to be migrated. After the migration conditions of the virtual machine to be migrated are met, the services of the virtual machine to be migrated are suspended, and the backup and recovery interface of the target cluster is called to restore the backup data to the second back-end storage device mounted on the target cluster. Configure the virtual machine to be migrated in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated; Specifically, when there are virtual machines to be migrated in the source cluster, backup data for the virtual machines to be migrated is generated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machines to be migrated. This includes: When the source cluster contains the virtual machine to be migrated, it is determined whether the source cluster and the target cluster have a common access to the backup storage device; If so, proceed to the step of generating backup data for the virtual machine to be migrated in the backup storage device that is commonly accessed by the source cluster and the target cluster of the virtual machine to be migrated; If not, the storage device that does not store data from the source cluster or the target cluster is identified as the backup storage device. After the backup storage device is mounted to both the source cluster and the target cluster, the process proceeds to the step of generating backup data for the virtual machine to be migrated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machine to be migrated.

2. The method for migrating virtual machines across clusters according to claim 1, characterized in that, The step of generating backup data for the virtual machine to be migrated in a backup storage device that is shared by the source cluster and the target cluster of the virtual machine to be migrated specifically includes: A full backup of the virtual machine to be migrated is generated on the backup storage device; For the data updated by the virtual machine to be migrated from the starting point of the full backup data generation, a first incremental backup data is generated in the backup storage device.

3. The method for migrating virtual machines across clusters according to claim 2, characterized in that, After the migration conditions of the virtual machine to be migrated are met, the services of the virtual machine to be migrated are paused, and the backup and recovery interface of the target cluster is invoked to restore the backup data to the second backend storage device mounted on the target cluster. Specifically, this includes: After the migration conditions of the virtual machine to be migrated are met, the task of the virtual machine to be migrated is paused, and second incremental backup data is generated in the backup storage device based on the data of the virtual machine to be migrated in memory. The backup and recovery interface of the target cluster is invoked to restore the full backup data, the first incremental backup data, and the second incremental backup data to the second backend storage device.

4. The method for migrating virtual machines across clusters according to claim 2, characterized in that, After the migration conditions of the virtual machine to be migrated are met, the services of the virtual machine to be migrated are paused, and the backup and recovery interface of the target cluster is invoked to restore the backup data to the second backend storage device mounted on the target cluster. Specifically, this includes: After calling the backup and recovery interface of the target cluster to restore the full backup data to the second backend storage device, the first incremental backup data is then restored to the second backend storage device. Determine whether the first incremental backup data in the backup storage device that has not been restored to the second backend storage is less than a preset data amount; If so, it is confirmed that the migration conditions of the virtual machine to be migrated have not been met, and the process returns to the step of determining whether the first incremental backup data in the backup storage device that has not been restored to the second backend storage is less than the preset data amount; If not, then confirm that the migration conditions of the virtual machine to be migrated have been met, suspend the services of the virtual machine to be migrated, generate second incremental backup data in the backup storage device based on the data of the virtual machine to be migrated in memory, and call the backup and recovery interface of the target cluster to restore the first incremental backup data and the second incremental backup data that have not been restored to the second backend storage device.

5. The method for migrating virtual machines across clusters according to claim 4, characterized in that, Also includes: The size of the preset data volume is calculated based on the allowed pause duration of services for the virtual machine to be migrated.

6. The method for migrating virtual machines across clusters according to claim 1, characterized in that, Also includes: After suspending the services of the virtual machine to be migrated, the data of the virtual machine to be migrated in memory is flushed to the first backend storage device mounted on the source cluster.

7. The method for migrating virtual machines across clusters according to claim 6, characterized in that, Also includes: Determine whether the cross-cluster migration task has been completed within a preset time period from the date the virtual machine to be migrated was determined; If not, then resume the operation of the virtual machine to be migrated in the source cluster.

8. The method for migrating virtual machines across clusters according to claim 1, characterized in that, The configuration of the virtual machine to be migrated on the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated specifically includes: The source cluster is invoked to obtain the configuration information of the virtual machine to be migrated; The target cluster is invoked to create a target virtual machine, and the target virtual machine is configured according to the configuration information of the virtual machine to be migrated; The target virtual machine is started in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated.

9. An apparatus for migrating virtual machines across clusters, characterized in that, include: A backup generation unit is used to generate backup data of the virtual machine to be migrated in a backup storage device that is commonly accessed by the source cluster and the target cluster of the virtual machine to be migrated when there is a virtual machine to be migrated in the source cluster. The backup and recovery unit is used to pause the services of the virtual machine to be migrated after the migration conditions of the virtual machine to be migrated are met, and call the backup and recovery interface of the target cluster to restore the backup data to the second back-end storage device mounted on the target cluster. A configuration unit is used to configure the virtual machine to be migrated in the target cluster to complete the cross-cluster migration task of the virtual machine to be migrated. Specifically, when there are virtual machines to be migrated in the source cluster, backup data for the virtual machines to be migrated is generated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machines to be migrated. This includes: When the source cluster contains the virtual machine to be migrated, it is determined whether the source cluster and the target cluster have a common access to the backup storage device; If so, proceed to the step of generating backup data for the virtual machine to be migrated in the backup storage device that is commonly accessed by the source cluster and the target cluster of the virtual machine to be migrated; If not, the storage device that does not store data from the source cluster or the target cluster is identified as the backup storage device. After the backup storage device is mounted to both the source cluster and the target cluster, the process proceeds to the step of generating backup data for the virtual machine to be migrated in the backup storage device that is shared by the source cluster and the target cluster of the virtual machine to be migrated.

10. A device for migrating virtual machines across clusters, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program, which, when executed by the processor, implements the steps of the method for migrating virtual machines across a cluster as described in any one of claims 1 to 8.

11. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method for migrating virtual machines across a cluster as described in any one of claims 1 to 8.