[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 0/8] Post-copy live migration support



Qemu currently implements pre-copy live migration. VM memory pages are
first copied from the source hypervisor to the destination, potentially
multiple times as pages get dirtied during transfer, then VCPU state
is migrated. Unfortunately, if the VM dirties memory faster than the
network bandwidth, then pre-copy cannot finish. `virsh` currently
includes an option to suspend a VM after a timeout, so that migration
may finish, but at the expense of downtime.

A future version of qemu will implement post-copy live migration. The
VCPU state is first migrated to the destination hypervisor, then
memory pages are pulled from the source hypervisor. Post-copy has the
potential to do migration with zero-downtime, despite the VM dirtying
pages fast, with minimum performance impact. On the other hand, one
post-copy is in progress, any network failure would render the VM
unusable, as its memory is partitioned between the source and
destination hypervisor. Therefore, post-copy should only be used when
necessary.

Post-copy migration in qemu will work as follows:
(1) The `x-postcopy-ram` migration capability needs to be set.
(2) Migration is started.
(3) When the user decides so, post-copy migration is activated by
sending the `migrate-start-postcopy` command. Qemu acknowledges by
setting migration status to `postcopy-active`.

v2:
- Fixed formatting
- Set target version to libvirt 1.2.10
- Only use JSON monitor
- Renamed `qemuMigrateStartPostCopy` to `qemuDomainMigrateStartPostCopy`
- Added parameter `flags` to domainMigrateStartPostCopy (currently unused)
- Misc fixes required for `make check`
- Stop perform phase, when post-copy starts
- Wait for post-copy completion in confirm phase, before killing source VM

Implementation note: `qemuMigrationWaitForCompletion` is overloaded. When
called the first time it waits for post-copy to start, when called the
second time it waits for post-copy to complete. I did so to reduce
code duplication, but am not sure this is the best solution.

Cristian Klein (8):
  Added public API to enable post-copy migration
  Added public API to start post-copy migration
  Added low-level API to qemu post-copy migration
  Implemented VIR_MIGRATE_POSTCOPY in qemu driver
  Added job type VIR_DOMAIN_JOB_PHASE1_COMPLETED
  Implemented post-copy migration logic in qemu
  Implement virDomainMigrateStartPostCopy in qemu
  virsh: add postcopy-after option to migrate command

 include/libvirt/libvirt.h.in |  5 +++
 src/driver.h                 |  5 +++
 src/libvirt.c                | 46 ++++++++++++++++++++++++
 src/libvirt_public.syms      |  5 +++
 src/qemu/qemu_driver.c       | 58 ++++++++++++++++++++++++++++++
 src/qemu/qemu_migration.c    | 85 ++++++++++++++++++++++++++++++++++++++++++--
 src/qemu/qemu_migration.h    |  3 +-
 src/qemu/qemu_monitor.c      | 24 +++++++++++--
 src/qemu/qemu_monitor.h      |  4 +++
 src/qemu/qemu_monitor_json.c | 23 +++++++++++-
 src/qemu/qemu_monitor_json.h |  1 +
 src/remote/remote_driver.c   |  1 +
 src/remote/remote_protocol.x | 13 ++++++-
 src/remote_protocol-structs  |  5 +++
 tools/virsh-domain.c         | 75 ++++++++++++++++++++++++++++++++++++--
 tools/virsh.pod              |  5 +++
 16 files changed, 347 insertions(+), 11 deletions(-)

-- 
1.9.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]