Virtual Machine Hot Migration
TOC
Overview
The virtual machine hot migration technology allows for moving a virtual machine from one physical server to another without shutting down or interrupting the virtual machine. The platform's virtual machine solution is implemented based on the open-source component KubeVirt, which uses a mode called ProCopy for hot migration by default.
ProCopy
ProCopy (Pre-Copy Memory Migration) is a commonly used virtual machine migration technology that ensures service continuity during migration by pre-copying the virtual machine's memory data. The specific process is as follows:
- Initial Phase: At the start of the migration, the source host will copy the virtual machine's memory pages to the target host while the virtual machine continues to run. Because the virtual machine continues running, some memory pages may be modified during the copying process.
- Iterative Copying: The source host repeatedly copies the modified memory pages to the target host until the number of modified pages decreases to an acceptable level. Each round of copying is called an iteration, and the number of unmodified memory pages gradually decreases after each iteration.
- Stop and Copy: When the remaining un-copied memory pages are sufficiently few, the virtual machine will pause briefly (usually only a few seconds to a dozen seconds), during which the last memory pages are copied to the target host, and the virtual machine's CPU and device states are synchronized to the target host.
- Resume Operation: The virtual machine resumes operation on the target host.
Constraints and Limitations
It is recommended that the two physical machines involved in the hot migration operation use the same hardware configuration. If the configurations are inconsistent (for example, different CPU models), migration may fail.
Prerequisites
Please enable the relevant virtual machine hot migration functions in advance.
Operation Steps
Deploy kubevirt-operator
Note: For detailed steps and parameter explanations, please refer to Deploy Operator.
-
Go to Platform Management.
-
In the left navigation bar, click App Store Management > Operators.
-
Click Cluster at the top of the page to switch to the cluster where the Operator needs to be deployed.
-
In the OperatorHub tab, click Deploy on the KubeVirt HyperConverged Cluster Operator card.
-
Configure the parameters as needed and click Deploy. You can check the Operator deployment status in the Deployed tab.
Create HyperConverged Instance
For specific creation steps, please refer to Create HyperConverged Instance.
Prepare the Virtual Machine
Note: It is recommended to use the Kube-OVN Underlay network. For related configurations, please refer to Create Subnet (Kube-OVN Underlay Network).
-
Go to Container Platform.
-
In the left navigation bar, click Virtualization > Virtual Machine.
-
Click Create Virtual Machine.
-
Click More in the Basic Information area to expand more configuration options, and click Add corresponding to Annotations, adding annotations according to the key-value pairs below. If the network plugin is Kube-OVN, there is no need to manually fill in this annotation.
Note: Due to form restrictions, please enter the value of the annotation first before entering the key of the annotation.
-
Configure other virtual machine parameters as needed. For specific parameter descriptions, please refer to the relevant product documentation.
-
Click Create.
Start Hot Migration
Note: Hot migration can only be started when the virtual machine status is Running.
-
Go to Container Platform.
-
In the left navigation bar, click Virtualization > Virtual Machine.
-
Start the hot migration. There are two ways to do this:
- Click ⋮ > Hot Migration on the right side of the virtual machine that needs to be migrated in the list.
- Click the name of the virtual machine that needs to be migrated in the list to enter the detail information page, then click Actions > Hot Migration.
-
Click Confirm. You can check the migration progress through Virtual Machine Status or Real-Time Events. When the status changes from Migrating to Running, or when a real-time event appears with information like Migrated: The VirtualMachineInstance migrated to node 10.1.1.1., it indicates that the migration was successful.