|
|
5d360b |
From 88b94264928e180cad4067a55cb328fe594985b9 Mon Sep 17 00:00:00 2001
|
|
|
5d360b |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
5d360b |
Date: Fri, 26 Jan 2018 18:53:14 +0100
|
|
|
5d360b |
Subject: [PATCH 3/4] savevm: Improve error message for blocked migration
|
|
|
5d360b |
|
|
|
5d360b |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
5d360b |
Message-id: <20180126185315.2342-2-dgilbert@redhat.com>
|
|
|
5d360b |
Patchwork-id: 78730
|
|
|
5d360b |
O-Subject: [RHEL7.5 qemu-kvm PATCH 1/2] savevm: Improve error message for blocked migration
|
|
|
5d360b |
Bugzilla: 1536883
|
|
|
5d360b |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
5d360b |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
5d360b |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
5d360b |
|
|
|
5d360b |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
5d360b |
|
|
|
5d360b |
If an internal snapshot can't be saved because migration is blocked
|
|
|
5d360b |
(most commonly probably because of AHCI), we had a really bad error
|
|
|
5d360b |
message:
|
|
|
5d360b |
|
|
|
5d360b |
$ echo -e "savevm foo\nquit" | qemu -M q35 /tmp/test.qcow2 -monitor stdio
|
|
|
5d360b |
QEMU 2.2.50 monitor - type 'help' for more information
|
|
|
5d360b |
(qemu) savevm foo
|
|
|
5d360b |
Error -22 while writing VM
|
|
|
5d360b |
(qemu) quit
|
|
|
5d360b |
|
|
|
5d360b |
This patch converts qemu_savevm_state() to the Error infrastructure so
|
|
|
5d360b |
that a useful error pointing to the problematic device is produced now:
|
|
|
5d360b |
|
|
|
5d360b |
$ echo -e "savevm foo\nquit" | qemu -M q35 /tmp/test.qcow2 -monitor stdio
|
|
|
5d360b |
QEMU 2.2.50 monitor - type 'help' for more information
|
|
|
5d360b |
(qemu) savevm foo
|
|
|
5d360b |
State blocked by non-migratable device '0000:00:1f.2/ich9_ahci'
|
|
|
5d360b |
(qemu) quit
|
|
|
5d360b |
|
|
|
5d360b |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
5d360b |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
5d360b |
Message-id: 1423574702-23072-1-git-send-email-kwolf@redhat.com
|
|
|
5d360b |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
5d360b |
(cherry picked from commit 5d80448c3fc566e505adfa2b566ec8074442c8e1)
|
|
|
5d360b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
5d360b |
---
|
|
|
5d360b |
savevm.c | 11 +++++++----
|
|
|
5d360b |
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
|
5d360b |
|
|
|
5d360b |
diff --git a/savevm.c b/savevm.c
|
|
|
5d360b |
index 731d5c0..d34004e 100644
|
|
|
5d360b |
--- a/savevm.c
|
|
|
5d360b |
+++ b/savevm.c
|
|
|
5d360b |
@@ -2199,7 +2199,7 @@ void qemu_savevm_state_cancel(void)
|
|
|
5d360b |
}
|
|
|
5d360b |
}
|
|
|
5d360b |
|
|
|
5d360b |
-static int qemu_savevm_state(QEMUFile *f)
|
|
|
5d360b |
+static int qemu_savevm_state(QEMUFile *f, Error **errp)
|
|
|
5d360b |
{
|
|
|
5d360b |
int ret;
|
|
|
5d360b |
MigrationParams params = {
|
|
|
5d360b |
@@ -2207,7 +2207,7 @@ static int qemu_savevm_state(QEMUFile *f)
|
|
|
5d360b |
.shared = 0
|
|
|
5d360b |
};
|
|
|
5d360b |
|
|
|
5d360b |
- if (qemu_savevm_state_blocked(NULL)) {
|
|
|
5d360b |
+ if (qemu_savevm_state_blocked(errp)) {
|
|
|
5d360b |
return -EINVAL;
|
|
|
5d360b |
}
|
|
|
5d360b |
|
|
|
5d360b |
@@ -2228,6 +2228,7 @@ static int qemu_savevm_state(QEMUFile *f)
|
|
|
5d360b |
}
|
|
|
5d360b |
if (ret != 0) {
|
|
|
5d360b |
qemu_savevm_state_cancel();
|
|
|
5d360b |
+ error_setg_errno(errp, -ret, "Error while writing VM state");
|
|
|
5d360b |
}
|
|
|
5d360b |
return ret;
|
|
|
5d360b |
}
|
|
|
5d360b |
@@ -2603,6 +2604,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
|
|
|
5d360b |
qemu_timeval tv;
|
|
|
5d360b |
struct tm tm;
|
|
|
5d360b |
const char *name = qdict_get_try_str(qdict, "name");
|
|
|
5d360b |
+ Error *local_err = NULL;
|
|
|
5d360b |
|
|
|
5d360b |
/* Verify if there is a device that doesn't support snapshots and is writable */
|
|
|
5d360b |
bs = NULL;
|
|
|
5d360b |
@@ -2661,11 +2663,12 @@ void do_savevm(Monitor *mon, const QDict *qdict)
|
|
|
5d360b |
monitor_printf(mon, "Could not open VM state file\n");
|
|
|
5d360b |
goto the_end;
|
|
|
5d360b |
}
|
|
|
5d360b |
- ret = qemu_savevm_state(f);
|
|
|
5d360b |
+ ret = qemu_savevm_state(f, &local_err);
|
|
|
5d360b |
vm_state_size = qemu_ftell(f);
|
|
|
5d360b |
qemu_fclose(f);
|
|
|
5d360b |
if (ret < 0) {
|
|
|
5d360b |
- monitor_printf(mon, "Error %d while writing VM\n", ret);
|
|
|
5d360b |
+ monitor_printf(mon, "%s\n", error_get_pretty(local_err));
|
|
|
5d360b |
+ error_free(local_err);
|
|
|
5d360b |
goto the_end;
|
|
|
5d360b |
}
|
|
|
5d360b |
|
|
|
5d360b |
--
|
|
|
5d360b |
1.8.3.1
|
|
|
5d360b |
|