KVM: migrating a VM


Introduction

KVM currently supports savevm/loadvm and offline or live migration
Migration commands are given when in qemu-monitor (Alt-Ctrl-2).
Upon successful completion, the migrated VM continues to run on the destination host.

Note

You can migrate a guest between an AMD host to an Intel host and back. Naturally, a 64-bit guest can only be migrated to a 64-bit host, but a 32-bit guest can be migrated at will.

There are some older Intel processors which don't support NX (or XD), which may cause problems in a cluster which includes NX-supporting hosts. We may add a feature to hide NX if this proves to be a problem in actual deployments.

Requirements

highlights / merits

1 These features are unique to KVM Live Migration as far as I know. If you know of other hypervisor that support any of them please update this page or let me (Uri) know.

User Interface

The user interface is through the qemu monitor (alt-ctrl-2 on the SDL window)

Management

migrate [-d] <URI>
migrate_cancel

The '-d' will let you query the status of the migration.

With no '-d' the monitor prompt returns when the migration completes. URI can be one of 'exec:<command>', 'ssh://<ip>' or tcp://<ip:port>

Status

info migration

Migration Parameters

migrate_set_speed <speed>   set bandwidth control parameters (max transfer rate per second)

Example / HOWTO

Problems / Todo

savevm/loadvm to an external state file (using pseudo-migration)

more exec: options

Algorithm (the short version)

  1. Setup
    • Start guest on destination, connect, enable dirty page logging and more
  2. Transfer Memory
    • Guest continues to run
    • Bandwidth limitation (controlled by the user)
    • First transfer the whole memory
    • Iteratively transfer all dirty pages (pages that were written to by the guest).
  3. Stop the guest
    • And sync VM image(s) (guest's hard drives).
  4. Transfer State
    • As fast as possible (no bandwidth limitation)
    • All VM devices' state and dirty pages yet to be transferred
  5. Continue the guest
    • On destination upon success
      • Broadcast "I'm over here" Ethernet packet to announce new location of NIC(s).
    • On source upon failure (with one exception).

Instructions for kvm-13 and below: MigrationQemu0.8.2.

Migration (last edited 2008-02-21 16:01:50 by Uri Lublin)