|
|
ae23c9 |
From 1669a71fd8a4bd570f09fc2df67279d6936cc5ad Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
ae23c9 |
Date: Fri, 22 Jun 2018 19:00:03 +0200
|
|
|
ae23c9 |
Subject: [PATCH 15/21] migration: Don't activate block devices if using -S
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ae23c9 |
Message-id: <20180801135522.11658-17-dgilbert@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 81576
|
|
|
ae23c9 |
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 16/18] migration: Don't activate block devices if using -S
|
|
|
ae23c9 |
Bugzilla: 1594384
|
|
|
ae23c9 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Activating the block devices causes the locks to be taken on
|
|
|
ae23c9 |
the backing file. If we're running with -S and the destination libvirt
|
|
|
ae23c9 |
hasn't started the destination with 'cont', it's expecting the locks are
|
|
|
ae23c9 |
still untaken.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Don't activate the block devices if we're not going to autostart the VM;
|
|
|
ae23c9 |
'cont' already will do that anyway. This change is tied to the new
|
|
|
ae23c9 |
migration capability 'late-block-activate' that defaults to off, keeping
|
|
|
ae23c9 |
the old behaviour by default.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
bz: https://bugzilla.redhat.com/show_bug.cgi?id=1560854
|
|
|
ae23c9 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ae23c9 |
Reviewed-by: Juan Quintela <quintela@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 0f073f44df109ea0910d67caede70dec95956ff6)
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
migration/migration.c | 34 +++++++++++++++++++++++++++-------
|
|
|
ae23c9 |
qapi/migration.json | 5 ++++-
|
|
|
ae23c9 |
2 files changed, 31 insertions(+), 8 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/migration/migration.c b/migration/migration.c
|
|
|
ae23c9 |
index b6294f6..edf1c06 100644
|
|
|
ae23c9 |
--- a/migration/migration.c
|
|
|
ae23c9 |
+++ b/migration/migration.c
|
|
|
ae23c9 |
@@ -199,6 +199,16 @@ static void migrate_generate_event(int new_state)
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+static bool migrate_late_block_activate(void)
|
|
|
ae23c9 |
+{
|
|
|
ae23c9 |
+ MigrationState *s;
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ s = migrate_get_current();
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ return s->enabled_capabilities[
|
|
|
ae23c9 |
+ MIGRATION_CAPABILITY_LATE_BLOCK_ACTIVATE];
|
|
|
ae23c9 |
+}
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
/*
|
|
|
ae23c9 |
* Called on -incoming with a defer: uri.
|
|
|
ae23c9 |
* The migration can be started later after any parameters have been
|
|
|
ae23c9 |
@@ -308,13 +318,23 @@ static void process_incoming_migration_bh(void *opaque)
|
|
|
ae23c9 |
Error *local_err = NULL;
|
|
|
ae23c9 |
MigrationIncomingState *mis = opaque;
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- /* Make sure all file formats flush their mutable metadata.
|
|
|
ae23c9 |
- * If we get an error here, just don't restart the VM yet. */
|
|
|
ae23c9 |
- bdrv_invalidate_cache_all(&local_err);
|
|
|
ae23c9 |
- if (local_err) {
|
|
|
ae23c9 |
- error_report_err(local_err);
|
|
|
ae23c9 |
- local_err = NULL;
|
|
|
ae23c9 |
- autostart = false;
|
|
|
ae23c9 |
+ /* If capability late_block_activate is set:
|
|
|
ae23c9 |
+ * Only fire up the block code now if we're going to restart the
|
|
|
ae23c9 |
+ * VM, else 'cont' will do it.
|
|
|
ae23c9 |
+ * This causes file locking to happen; so we don't want it to happen
|
|
|
ae23c9 |
+ * unless we really are starting the VM.
|
|
|
ae23c9 |
+ */
|
|
|
ae23c9 |
+ if (!migrate_late_block_activate() ||
|
|
|
ae23c9 |
+ (autostart && (!global_state_received() ||
|
|
|
ae23c9 |
+ global_state_get_runstate() == RUN_STATE_RUNNING))) {
|
|
|
ae23c9 |
+ /* Make sure all file formats flush their mutable metadata.
|
|
|
ae23c9 |
+ * If we get an error here, just don't restart the VM yet. */
|
|
|
ae23c9 |
+ bdrv_invalidate_cache_all(&local_err);
|
|
|
ae23c9 |
+ if (local_err) {
|
|
|
ae23c9 |
+ error_report_err(local_err);
|
|
|
ae23c9 |
+ local_err = NULL;
|
|
|
ae23c9 |
+ autostart = false;
|
|
|
ae23c9 |
+ }
|
|
|
ae23c9 |
}
|
|
|
ae23c9 |
|
|
|
ae23c9 |
/*
|
|
|
ae23c9 |
diff --git a/qapi/migration.json b/qapi/migration.json
|
|
|
ae23c9 |
index 9d0bf82..618d2de 100644
|
|
|
ae23c9 |
--- a/qapi/migration.json
|
|
|
ae23c9 |
+++ b/qapi/migration.json
|
|
|
ae23c9 |
@@ -357,13 +357,16 @@
|
|
|
ae23c9 |
# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
|
|
|
ae23c9 |
# (since 2.12)
|
|
|
ae23c9 |
#
|
|
|
ae23c9 |
+# @late-block-activate: If enabled, the destination will not activate block
|
|
|
ae23c9 |
+# devices (and thus take locks) immediately at the end of migration.
|
|
|
ae23c9 |
+# (since 3.0)
|
|
|
ae23c9 |
# Since: 1.2
|
|
|
ae23c9 |
##
|
|
|
ae23c9 |
{ 'enum': 'MigrationCapability',
|
|
|
ae23c9 |
'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
|
|
|
ae23c9 |
'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
|
|
|
ae23c9 |
'block', 'return-path', 'pause-before-switchover', 'x-multifd',
|
|
|
ae23c9 |
- 'dirty-bitmaps' ] }
|
|
|
ae23c9 |
+ 'dirty-bitmaps', 'late-block-activate' ] }
|
|
|
ae23c9 |
|
|
|
ae23c9 |
##
|
|
|
ae23c9 |
# @MigrationCapabilityStatus:
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|