[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/58] migration: Unify block node activation error h
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 28/58] migration: Unify block node activation error handling |
Date: |
Thu, 11 May 2017 16:32:31 +0200 |
Migration code activates all block driver nodes on the destination when
the migration completes. It does so by calling
bdrv_invalidate_cache_all() and blk_resume_after_migration(). There is
one code path for precopy and one for postcopy migration, resulting in
four function calls, which used to have three different failure modes.
This patch unifies the behaviour so that failure to activate all block
nodes is non-fatal, but the error message is logged and the VM isn't
automatically started. 'cont' will retry activating the block nodes.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
migration/migration.c | 16 +++++-----------
migration/savevm.c | 12 +++++-------
qmp.c | 18 +++++++++---------
3 files changed, 19 insertions(+), 27 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 799952c..04af719 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -338,20 +338,14 @@ static void process_incoming_migration_bh(void *opaque)
Error *local_err = NULL;
MigrationIncomingState *mis = opaque;
- /* Make sure all file formats flush their mutable metadata */
+ /* Make sure all file formats flush their mutable metadata.
+ * If we get an error here, just don't restart the VM yet. */
bdrv_invalidate_cache_all(&local_err);
- if (local_err) {
- migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
- MIGRATION_STATUS_FAILED);
- error_report_err(local_err);
- migrate_decompress_threads_join();
- exit(EXIT_FAILURE);
+ if (!local_err) {
+ blk_resume_after_migration(&local_err);
}
-
- /* If we get an error here, just don't restart the VM yet. */
- blk_resume_after_migration(&local_err);
if (local_err) {
- error_free(local_err);
+ error_report_err(local_err);
local_err = NULL;
autostart = false;
}
diff --git a/migration/savevm.c b/migration/savevm.c
index 352a8f2..3ca8d11 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1612,16 +1612,14 @@ static void loadvm_postcopy_handle_run_bh(void *opaque)
qemu_announce_self();
- /* Make sure all file formats flush their mutable metadata */
+ /* Make sure all file formats flush their mutable metadata.
+ * If we get an error here, just don't restart the VM yet. */
bdrv_invalidate_cache_all(&local_err);
- if (local_err) {
- error_report_err(local_err);
+ if (!local_err) {
+ blk_resume_after_migration(&local_err);
}
-
- /* If we get an error here, just don't restart the VM yet. */
- blk_resume_after_migration(&local_err);
if (local_err) {
- error_free(local_err);
+ error_report_err(local_err);
local_err = NULL;
autostart = false;
}
diff --git a/qmp.c b/qmp.c
index ab74cd7..25b5050 100644
--- a/qmp.c
+++ b/qmp.c
@@ -196,15 +196,15 @@ void qmp_cont(Error **errp)
}
/* Continuing after completed migration. Images have been inactivated to
- * allow the destination to take control. Need to get control back now. */
- if (runstate_check(RUN_STATE_FINISH_MIGRATE) ||
- runstate_check(RUN_STATE_POSTMIGRATE))
- {
- bdrv_invalidate_cache_all(&local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return;
- }
+ * allow the destination to take control. Need to get control back now.
+ *
+ * If there are no inactive block nodes (e.g. because the VM was just
+ * paused rather than completing a migration), bdrv_inactivate_all() simply
+ * doesn't do anything. */
+ bdrv_invalidate_cache_all(&local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
}
blk_resume_after_migration(&local_err);
--
1.8.3.1
- [Qemu-devel] [PULL 18/58] block: Reuse bs as backing hd for drive-backup sync=none, (continued)
- [Qemu-devel] [PULL 18/58] block: Reuse bs as backing hd for drive-backup sync=none, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 14/58] tests: Use null-co:// instead of /dev/null as the dummy image, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 20/58] osdep: Fall back to posix lock when OFD lock is unavailable, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 23/58] tests: Add POSIX image locking test case 182, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 24/58] qcow2: Fix preallocation size formula, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 22/58] qemu-iotests: Add test case 153 for image locking, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 21/58] file-posix: Add image locking to perm operations, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 25/58] qcow2: Reuse preallocated zero clusters, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 26/58] qcow2: Discard preallocated zero clusters, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 27/58] iotests: Extend test 066, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 28/58] migration: Unify block node activation error handling,
Kevin Wolf <=
- [Qemu-devel] [PULL 29/58] block: New BdrvChildRole.activate() for blk_resume_after_migration(), Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 34/58] qemu-img: wait for convert coroutines to complete, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 30/58] block: Drop permissions when migration completes, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 35/58] nvme: Implement Write Zeroes, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 36/58] blockdev: use drained_begin/end for qmp_block_resize, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 31/58] block: Inactivate parents before children, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 33/58] file-posix: Remove .bdrv_inactivate/invalidate_cache, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 32/58] block: Fix write/resize permissions for inactive images, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 38/58] qemu-io: Switch 'alloc' command to byte-based length, Kevin Wolf, 2017/05/11
- [Qemu-devel] [PULL 40/58] blkdebug: Sanity check block layer guarantees, Kevin Wolf, 2017/05/11