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