[PATCH v3 00/12] Rework storage migration

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

 



This patch set re-implements migration with storage for enough new qemu.
Currently, you can migrate a domain to a host without need for shared storage.
This is done by setting 'blk' or 'inc' attribute (representing
VIR_MIGRATE_NON_SHARED_DISK and VIR_MIGRATE_NON_SHARED_INC flags respectively)
of 'migrate' monitor command. However, the qemu implementation is
buggy and applications are advised to switch to new impementation
which, moreover, offers some nice features, like migrating only explicitly
specified disks.

The new functionality is controlled via 'nbd-server-*' and 'drive-mirror'
commands. The flow is meant to look like this:

1) User invokes libvirt's migrate functionality.

2) libvirt checks that no block jobs are active on the source.

3) libvirt starts the destination QEMU and sets up the NBD server using the
nbd-server-start and nbd-server-add commands.

4) libvirt starts drive-mirror with a destination pointing to the remote NBD
server, for example nbd:host:port:exportname=diskname (where diskname is the
-drive id specified on the destination).

5) once all mirroring jobs reach steady state, libvirt invokes the migrate
command.

6) once migration completed, libvirt invokes the nbd-server-stop command on the
destination QEMU.

If we just skip the 2nd step and there is an active block-job, qemu will fail in
step 4. No big deal.
Since we try to NOT break migration and keep things compatible, this feature is
enabled iff both sides support it. Since there's obvious need for some data
transfer between src and dst, I've put it into qemuCookieMigration:

1) src -> dest: (QEMU_MIGRATION_PHASE_BEGIN3 -> QEMU_MIGRATION_PHASE_PREPARE)
  <nbd>
    <disk target='vda' size='15032385536'/>
    <disk target='vdb' size='11534336'/>
    <disk target='vdc' size='13631488'/>
  </nbd>

  The source is telling the destination it supports the NBD feature. Moreover,
  which disks are to be transferred and what are their sizes. That's because
  disks needs to be fully allocated (even qcow) for successful transfer.

2) dst -> src: (QEMU_MIGRATION_PHASE_PREPARE -> QEMU_MIGRATION_PHASE_PERFORM3)
  <nbd port='5901'/>

  The destination is confirming it does support NBD as well. All disks were
  pre-created and NBD server is listening on given port (5901 in this case).

If either src or dst doesn't support NBD, it is not used and whole process falls
back to old implementation.

diff to v1:
-Eric's and Daniel's suggestions worked in. To point out the bigger ones:
 don't do NBD style when TUNNELLED requested, added 'b:writable' to
 'nbd-server-add'

-drop '/qemu-migration/nbd/disk/@src' attribute from migration cookie.
 As pointed out by Jirka, disk->src can be changed during migration (e.g. by
 migration hook or by passed xml). So I've tried (as suggested on the list)
 passing disk alias. However, since qemu hasn't been started on destination yet,
 the aliases hasn't been generated yet.  So we have to rely on ordering
 completely.

diff to v2:
-rebase to reflect changes made by offline migration patch
-send initial nbd cookie only if needed

diff to v2.1:
-nbd cookie reworked
-don't rely on disk ordering in the cookie, but use disk target for that
-adapt to virPortAllocator
-unlink pre-created storage on migration fail
-other of Jirka's suggestions worked in

Michal Privoznik (12):
  qemu: Introduce NBD_SERVER capability
  Introduce NBD migration cookie
  qemu: Introduce nbd-server-start command
  qemu: Introduce nbd-server-add command
  qemu: Introduce nbd-server-stop command
  qemu_migration: Introduce qemuMigrationStartNBDServer()
  qemu_migration: Introduce qemuMigrationDriveMirror
  qemu_domain: Introduce qemuDomainGetDiskBlockInfo
  qemu_migration: Check size prerequisites
  qemu_migration: Stop NBD server at Finish phase
  qemu_migration: Cancel running jobs on failed migration
  qemu_migration: Unlink pre-created storage on error

 src/qemu/qemu_capabilities.c |   4 +-
 src/qemu/qemu_capabilities.h |   1 +
 src/qemu/qemu_domain.c       | 157 ++++++++-
 src/qemu/qemu_domain.h       |   7 +
 src/qemu/qemu_driver.c       | 124 +------
 src/qemu/qemu_migration.c    | 769 ++++++++++++++++++++++++++++++++++++++++++-
 src/qemu/qemu_monitor.c      |  63 ++++
 src/qemu/qemu_monitor.h      |   7 +
 src/qemu/qemu_monitor_json.c | 102 ++++++
 src/qemu/qemu_monitor_json.h |   7 +
 src/qemu/qemu_process.c      |  13 +
 11 files changed, 1118 insertions(+), 136 deletions(-)

-- 
1.8.0.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]