Introduction

Administrators want to live migrate VMs between KVM hosts and from one NFS storage pool to another, without stopping the VMs execution. CloudStack did not provide this functionality for KVM, the aim of this feature is to leverage it through the CloudStack API 

Feature Specifications

This feature ensures live storage migration between KVM hosts, under these conditions:

  • From a source KVM host and source NFS mounted primary storage
  • To a different destination KVM host and destination NFS mounted primary storage within the same cluster
  • VM migration between source and destination storage on the same host is not considered
  • Inter-cluster migration is not considered

Architecture and Design

The global setting 'kvm.storage.online.migration.wait' is used to control the migration timeout for the 'migrateVirtualMachineWithVolume' API method

The 'migrateVirtualMachineWithVolume' API method will be used for live storage migrations, extending the existing functionality, performing:

  • Pre-checks ensuring the suitability of destination host and destination storage pool accessibility
  • Volumes preparation depending on its type: linked clone or full clones:
    • Linked clones: Volumes created from a template backing are linked clones. For each linked clone VM volume:
      • A new stub file should be created on the destination storage pool with template backing (if template is not on the storage pool then it must be copied beforehand)
    • Full clones: Data disks and volumes without backing file are full clones. For each full clone VM volume:
  • Live migration: The following flags are passed to QEMU for the live migration: '–persistent –copy-storage-inc' (Check 'virDomainMigrateFlags' section on: https://libvirt.org/html/libvirt-libvirt-domain.html)
    • VIR_MIGRATE_PERSIST_DEST: Define the domain as persistent on the destination host after successful migration. If the domain was persistent on the source host and VIR_MIGRATE_UNDEFINE_SOURCE is not used, it will end up persistent on both hosts.

    • VIR_MIGRATE_NON_SHARED_INC: Migrate disk images in addition to domain's memory. This is similar to VIR_MIGRATE_NON_SHARED_DISK, but only the top level of each disk's backing chain is copied. That is, the rest of the backing chain is expected to be present on the destination and to be exactly the same as on the source host. This flag and VIR_MIGRATE_NON_SHARED_DISK are mutually exclusive.

  • Post checks: Ensure migration succeeded before doing any source disks cleanup

UI flow

No UI change will be implemented

  • No labels