From 4370ac84f86e8f2d71a1d1e1cc65f7238359c36e Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Tue, 17 Apr 2018 14:46:29 +0200 Subject: [PATCH] qemu: Fix domain resume after failed migration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Libvirt relies on being able to kill the destination domain and resume the source one during migration until we called "cont" on the destination. Unfortunately, QEMU automatically activates block devices at the end of migration even when it's called with -S. This wasn't a big issue in the past since the guest is not running and thus no data are written to the block devices. However, when QEMU introduced its internal block device locks, we can no longer resume the source domain once the destination domain already activated the block devices (and thus acquired all locks) unless the destination domain is killed first. Since it's impossible to synchronize the destination and the source libvirt daemons after a failed migration, QEMU introduced a new migration capability called "late-block-activate" which ensures QEMU won't activate block devices until it gets "cont". The only thing we need to do is to enable this capability whenever QEMU supports it. https://bugzilla.redhat.com/show_bug.cgi?id=1568407 QEMU commit implementing the capability: v2.12.0-952-g0f073f44df Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- src/qemu/qemu_migration_params.c | 4 ++++ src/qemu/qemu_migration_params.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index db2fbe084a..9ecd2ab39d 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -84,6 +84,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability, QEMU_MIGRATION_CAP_LAST, "postcopy-ram", "compress", "pause-before-switchover", + "late-block-activate", ); @@ -129,6 +130,9 @@ struct _qemuMigrationParamsTPMapItem { static const qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOn[] = { {QEMU_MIGRATION_CAP_PAUSE_BEFORE_SWITCHOVER, QEMU_MIGRATION_SOURCE}, + + {QEMU_MIGRATION_CAP_LATE_BLOCK_ACTIVATE, + QEMU_MIGRATION_DESTINATION}, }; /* Translation from virDomainMigrateFlags to qemuMigrationCapability. */ diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h index da4c734e3a..57c3b8dc13 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -37,6 +37,7 @@ typedef enum { QEMU_MIGRATION_CAP_POSTCOPY, QEMU_MIGRATION_CAP_COMPRESS, QEMU_MIGRATION_CAP_PAUSE_BEFORE_SWITCHOVER, + QEMU_MIGRATION_CAP_LATE_BLOCK_ACTIVATE, QEMU_MIGRATION_CAP_LAST } qemuMigrationCapability; -- 2.47.2