|
|
9ae3a8 |
From 0262e36cb9326586a82985b1c26ee8cf9c6e0578 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <0262e36cb9326586a82985b1c26ee8cf9c6e0578.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
|
|
|
9ae3a8 |
From: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 14 Nov 2013 22:52:39 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 03/46] migration: Fail migration on bdrv_flush_all() error
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Nigel Croxon <ncroxon@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1384469598-13137-4-git-send-email-ncroxon@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 55687
|
|
|
9ae3a8 |
O-Subject: [RHEL7.0 PATCH 03/42] migration: Fail migration on bdrv_flush_all() error
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: 1011720
|
|
|
9ae3a8 |
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From commit ID:
|
|
|
9ae3a8 |
commit 0e1146a7a011a69d8cbc958b4f7ebad186730fc3
|
|
|
9ae3a8 |
Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Fri Jul 5 13:54:55 2013 +0200
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
migration: Fail migration on bdrv_flush_all() error
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
If bdrv_flush_all() returns an error, there is an inconsistency in the
|
|
|
9ae3a8 |
view of an image file between the source and the destination host.
|
|
|
9ae3a8 |
Completing the migration would lead to corruption. Better abort
|
|
|
9ae3a8 |
migration in this case.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
To reproduce this case, try the following (ensures that there is
|
|
|
9ae3a8 |
something to flush, and then fails that flush):
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
$ qemu-img create -f qcow2 test.qcow2 1G
|
|
|
9ae3a8 |
$ cat blkdebug.cfg
|
|
|
9ae3a8 |
[inject-error]
|
|
|
9ae3a8 |
event = "flush_to_os"
|
|
|
9ae3a8 |
errno = "5"
|
|
|
9ae3a8 |
$ qemu-system-x86_64 -hda blkdebug:blkdebug.cfg:test.qcow2 -monitor stdio
|
|
|
9ae3a8 |
(qemu) qemu-io ide0-hd0 "write 0 4k"
|
|
|
9ae3a8 |
(qemu) migrate ...
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration.c | 17 ++++++++++++++---
|
|
|
9ae3a8 |
1 files changed, 14 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
migration.c | 17 ++++++++++++++---
|
|
|
9ae3a8 |
1 file changed, 14 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/migration.c b/migration.c
|
|
|
9ae3a8 |
index d91e702..3520776 100644
|
|
|
9ae3a8 |
--- a/migration.c
|
|
|
9ae3a8 |
+++ b/migration.c
|
|
|
9ae3a8 |
@@ -542,15 +542,26 @@ static void *migration_thread(void *opaque)
|
|
|
9ae3a8 |
if (pending_size && pending_size >= max_size) {
|
|
|
9ae3a8 |
qemu_savevm_state_iterate(s->file);
|
|
|
9ae3a8 |
} else {
|
|
|
9ae3a8 |
+ int ret;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
DPRINTF("done iterating\n");
|
|
|
9ae3a8 |
qemu_mutex_lock_iothread();
|
|
|
9ae3a8 |
start_time = qemu_get_clock_ms(rt_clock);
|
|
|
9ae3a8 |
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
|
|
|
9ae3a8 |
old_vm_running = runstate_is_running();
|
|
|
9ae3a8 |
- vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
|
|
9ae3a8 |
- qemu_file_set_rate_limit(s->file, INT_MAX);
|
|
|
9ae3a8 |
- qemu_savevm_state_complete(s->file);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
|
|
|
9ae3a8 |
+ if (ret >= 0) {
|
|
|
9ae3a8 |
+ qemu_file_set_rate_limit(s->file, INT_MAX);
|
|
|
9ae3a8 |
+ qemu_savevm_state_complete(s->file);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
qemu_mutex_unlock_iothread();
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (ret < 0) {
|
|
|
9ae3a8 |
+ migrate_finish_set_state(s, MIG_STATE_ERROR);
|
|
|
9ae3a8 |
+ break;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
if (!qemu_file_get_error(s->file)) {
|
|
|
9ae3a8 |
migrate_finish_set_state(s, MIG_STATE_COMPLETED);
|
|
|
9ae3a8 |
break;
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.11.7
|
|
|
9ae3a8 |
|