Migrating virtual machines
Virtual machine migration helps facilitate cluster upgrades and workload balancing between compute nodes. Virtuozzo Hybrid Infrastructure allows you to perform two types of migration:
- Cold migration for stopped virtual machines
- Hot migration for running virtual machines (allows you to avoid VM downtime)
For both migration types, a virtual machine is migrated between compute nodes using shared storage, so no block device migration takes place.
Hot migration consists of the following steps:
- All VM memory is copied to the destination node, while the virtual machine keeps running on the source node. If a VM memory page changes, it is copied again.
- When only a few memory pages are left to copy, the VM is stopped on the source node, the remaining pages are transferred, and the VM is restarted on the destination node.
Large virtual machines with write-intensive workloads write to memory faster than memory changes can be transferred to the destination node, thus preventing migration from converging. For such VMs, the auto-converge mechanism is used. When a lack of convergence is detected during live migration, the VM’s vCPU execution speed is throttled down, which also slows down writing to the VM memory. Initially, the virtual machine’s vCPU is throttled by 20 percent and then by 10 percent during each iteration. This process continues until writing to the VM memory slows down enough for migration to complete or the VM vCPU is throttled by 99 percent.
Limitations
-
Virtual machines are created with the host CPU model, by default. Having compute nodes with different CPUs may lead to live migration issues. To avoid them, you can manually set the CPU model for all new VMs, as described in Setting virtual machine CPU model. Alternatively, you can create a placement for each group of compute nodes with the same CPU model by using the instructions in Managing placements for compute nodes.
- Migration is not supported for suspended virtual machines.
Prerequisites
- Virtual machines are created, as described in Creating virtual machines.
To migrate a virtual machine
Admin panel
- On the Compute > Virtual machines > Virtual machines tab, click a VM to migrate.
- Click the ellipsis button next to the VM, and then select Migrate.
-
In the new window, specify the destination node:
- Auto. Automatically select the optimal destination among cluster nodes, based on available CPU and RAM resources.
- Select the destination node manually from the drop-down list.
-
By default, running VMs are migrated live. You can change the migration mode to offline by selecting the Cold migration check box. A VM will be stopped and restarted on the destination node after migration.
- Click Migrate to reserve resources on the destination node and start migration.
The admin panel will show the migration progress.
Command-line interface
Use the following command:
vinfra service compute server migrate [--cold] [--node <node>] <server>
--cold
- Perform cold migration. If not set, the migration type is determined automatically.
--node <node>
- Destination node ID or hostname
<server>
- Virtual machine ID or name
For example, to start migration of the virtual machine myvm
to the compute node node003.vstoragedomain
, run:
# vinfra service compute server migrate myvm --node node003