VM live migration
Live migration moves a running VM (virtual machine) to another node without powering it off. Memory and CPU state move to the new node, and the disks stay in their pool. The guest OS keeps running; at the end of the migration, the VM is paused briefly. Center chooses the length of the pause by itself: it starts with 100 ms and makes the pause longer only if the move did not converge.
How it works
- Center checks the request and the target node. The VM is running and no other operation runs on it. The target node is online, not in maintenance mode, not forbidden by placement rules, has enough free memory taking the migrations to it into account, and has a free receiving slot, and the source node sends fewer migrations than allowed. If any condition is not met, Center rejects the request immediately and states the reason.
- Center takes a receiving slot on the target node and a place within the outgoing migration limit of the source node.
- The target node prepares a receiver and waits for the VM memory stream.
- The source node sends the memory over the storage network of the target node. The first pass sends all VM memory, and the next passes send only the pages that the guest OS changed during the previous pass. The receiving address is the NVMe-oF address of a pool of the target node: a pool in the
ONLINEstate first, and if there is none — in theDEGRADEDstate; for a node without such pools — its storage network address. Live migration does not use the public network. - The VM is paused for the switchover pause. The source node stops the VM CPU, sends the last pages and the CPU state, and the VM continues on the target node. If the move did not converge within the given pause, Center deletes the copy on the target node and retries with a longer pause — Switchover pause.
- The disks stay in the pool. If the target node is the current node of the pool, the VM works with its disks directly. Otherwise, it accesses them over the network, over NVMe-oF.
- Center binds the VM to the new node, deletes its remaining data on the source node and releases the lock.
The network ports, MAC and IP of the VM do not change: the cluster networks exist on every node.
Switchover pause
The longer the pause, the more changed memory reaches the target node, but the longer the VM stays paused. Therefore, Center moves the VM in one operation with several attempts: a 100 ms pause, then 500 ms, then 2000 ms. The Switchover pause, ms value in the migration window is the longest pause: attempts with a shorter pause go in order, and the last one uses the value itself.
| Switchover pause, ms | Attempts, ms |
|---|---|
| 2000 (default) | 100, 500, 2000 |
| 1000 | 100, 500, 1000 |
| 300 | 100, 300 |
| 5000 | 100, 500, 2000, 5000 |
| 100 and less | one attempt with this value |
The next attempt starts only if the move did not converge: the guest OS changed memory faster than the node could send it. Before the attempt, Center deletes the VM copy on the target node, and the VM keeps running on the source node all this time.
If the move did not converge in the last attempt either, or it was interrupted between attempts, the VM stays in the Started status on the previous node. You can move it again immediately. After such a failure, DRS does not offer to move this VM for some time — DRS.
Duration
- Timeout, s in the migration window is how long the nodes wait for the memory transfer in the last attempt: from 60 to 3600 s, 300 by default. The time of each previous attempt is no less than 60 s and no less than the estimated time to copy the VM memory, but no more than Timeout, s. An operation with several attempts lasts longer than Timeout, s.
- The time depends on the VM memory size, the storage network speed and the intensity of guest OS writes to memory.
- At the same time, migrations to different nodes run in parallel. A node accepts no more than 18 live migrations at once. No more than 8 migrations leave one node — this is the DRS setting Outgoing migrations per node, from 1 to 18. Center checks two migrations to one node one after another: if the second one no longer fits, Center rejects it immediately.
What you see
- The Migrate VM window, Compute tab: all cluster nodes with their RAM and CPU load (with DRS enabled — RAM (DRS) and CPU (DRS)). A node that will not accept the VM is inactive, and the reason is in the tooltip on its name. A node with a different CPU model can be selected only with Migrate to this node anyway checked.
- The VM migration progress window: the stage and the percentage of the move. Closing the window does not stop the move; Actions → Migrate on the VM page opens it again.
- VM status during the move: Migrating or Sending. Other actions with the VM are unavailable during this time.
- After a success: the notification Migration completed successfully, the Node field shows the new node, and the status is Started. Next to the node — Remotely if it is not the node of the VM pool.
- The move did not converge: the VM is Started on the previous node, and the web interface shows an error.
- After a failure: the notification Migration failed or the error text, and the VM status Migration failed or Send failed.
- Tasks: the migration is visible in the Tasks section — Tasks. Refusals and the result of the migration go to the security log.
- For external clients: the VM network does not change. Clients of the VM notice only a short pause at the end of the migration.
If the migration was interrupted
- The target node did not accept the VM. Center checks whether the VM already runs on the target node. If it does not, Center deletes the copy on the target node, and the VM keeps running on the source node.
- The move did not converge. Center retries with a longer pause; after the last attempt, the VM stays Started on the source node.
- The transfer was interrupted. Center sets the Send failed or Migration failed status — depending on which node reported the error — and releases the lock. The VM stays on the source node: the source node ends its VM copy only after a successful transfer.
- The nodes did not report the result in time. Center checks the target node. If the VM already runs there, the migration counts as successful. If it does not, the copy on the target node is deleted, and the VM gets the Migration failed status with the error Live migration timeout. If the check failed, Center leaves the copy unchanged. In both cases, do not repeat the migration and do not stop the VM — contact vStack support.
- The target node cannot be reached over the storage network. The migration ends with the error Storage network address of node <node> is unreachable, and the VM stays on the source node.
- Center restarted in the middle of a migration. After the start, it finds unfinished migrations and completes them or marks them as failed.
- The source or target node failed. Center waits for responses from both nodes and ends the migration with an error — based on the response of the remaining node or when the time limit expires. Where the VM ends up depends on the moment of the failure: while the memory is being sent, the VM runs on the source node; after the switchover — on the target node. If the VM is not running after that, start it manually.
Center keeps counting a VM in the Migration failed status as using node memory.
Limitations
- Only a running VM and only with the Live Migrate VM privilege: of the built-in roles, Cluster master has it; it can be granted to a custom role.
- Migration is enabled on the cluster. The Center installation enables it; if the VM menu has no Migrate item, it is disabled. To enable it on a running cluster, contact vStack support.
- A VM with PCI passthrough cannot be moved: the node rejects the request.
- CPU. A VM cannot be moved to a node with a CPU from another vendor. To a node with a different CPU model — only with a confirmation: the guest clock may drift after migration.
- A node in maintenance mode does not accept VMs — Node maintenance mode.
- Placement rules. A node forbidden by a mandatory VMs to nodes rule will not accept the VM — DRS.
- Disks do not move. To move disks to another pool — Moving VM disks between pools.
- Center can move VMs by itself: with DRS enabled — by its recommendations, and when a node is put into maintenance mode — migrating VMs off the node.
What not to do
- Do not move a VM with large memory and active writes over a slow storage network: the move may not converge even with the longest pause.
- Do not set a pause longer than the acceptable downtime: with Switchover pause, ms, the VM may stay paused for that long in the last attempt.
- Do not reboot or stop the source or target node while the VM status is Migrating or Sending. Center rejects disabling a node with the
cluster-node-disableAPI method while a migration involves the node. - Do not try to stop, suspend or transfer the VM pool during the migration: Center rejects it with the error A VM in this pool is migrating. Wait for the migration to finish.