[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 40/65] savevm: Improve error message for blocked migr
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 40/65] savevm: Improve error message for blocked migration |
Date: |
Fri, 13 Feb 2015 16:24:36 +0000 |
From: Kevin Wolf <address@hidden>
If an internal snapshot can't be saved because migration is blocked
(most commonly probably because of AHCI), we had a really bad error
message:
$ echo -e "savevm foo\nquit" | qemu -M q35 /tmp/test.qcow2 -monitor stdio
QEMU 2.2.50 monitor - type 'help' for more information
(qemu) savevm foo
Error -22 while writing VM
(qemu) quit
This patch converts qemu_savevm_state() to the Error infrastructure so
that a useful error pointing to the problematic device is produced now:
$ echo -e "savevm foo\nquit" | qemu -M q35 /tmp/test.qcow2 -monitor stdio
QEMU 2.2.50 monitor - type 'help' for more information
(qemu) savevm foo
State blocked by non-migratable device '0000:00:1f.2/ich9_ahci'
(qemu) quit
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
savevm.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/savevm.c b/savevm.c
index 8040766..1d08165 100644
--- a/savevm.c
+++ b/savevm.c
@@ -821,7 +821,7 @@ void qemu_savevm_state_cancel(void)
}
}
-static int qemu_savevm_state(QEMUFile *f)
+static int qemu_savevm_state(QEMUFile *f, Error **errp)
{
int ret;
MigrationParams params = {
@@ -829,7 +829,7 @@ static int qemu_savevm_state(QEMUFile *f)
.shared = 0
};
- if (qemu_savevm_state_blocked(NULL)) {
+ if (qemu_savevm_state_blocked(errp)) {
return -EINVAL;
}
@@ -850,6 +850,7 @@ static int qemu_savevm_state(QEMUFile *f)
}
if (ret != 0) {
qemu_savevm_state_cancel();
+ error_setg_errno(errp, -ret, "Error while writing VM state");
}
return ret;
}
@@ -1102,6 +1103,7 @@ void do_savevm(Monitor *mon, const QDict *qdict)
qemu_timeval tv;
struct tm tm;
const char *name = qdict_get_try_str(qdict, "name");
+ Error *local_err = NULL;
/* Verify if there is a device that doesn't support snapshots and is
writable */
bs = NULL;
@@ -1160,11 +1162,12 @@ void do_savevm(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "Could not open VM state file\n");
goto the_end;
}
- ret = qemu_savevm_state(f);
+ ret = qemu_savevm_state(f, &local_err);
vm_state_size = qemu_ftell(f);
qemu_fclose(f);
if (ret < 0) {
- monitor_printf(mon, "Error %d while writing VM\n", ret);
+ monitor_printf(mon, "%s\n", error_get_pretty(local_err));
+ error_free(local_err);
goto the_end;
}
--
2.1.0
- [Qemu-devel] [PULL 28/65] qtest/ahci: Demagic ahci tests., (continued)
- [Qemu-devel] [PULL 28/65] qtest/ahci: Demagic ahci tests., Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 30/65] libqos/ahci: Add ide cmd properties, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 29/65] qtest/ahci: add ahci_write_fis, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 31/65] libqos/ahci: add ahci command functions, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 34/65] libqos/ahci: Add ahci_guest_io, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 27/65] libqos/ahci: Add cmd response sanity check helpers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 32/65] libqos/ahci: add ahci command verify, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 33/65] libqos/ahci: add ahci command size setters, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 36/65] libqos/ahci: Add ahci_clean_mem, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 37/65] qtest/ahci: Assert sector size in identify test, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 40/65] savevm: Improve error message for blocked migration,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 38/65] qtest/ahci: Adding simple dma read-write test, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 35/65] libqos/ahci: add ahci_io, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 41/65] block: vmdk - fixed sizeof() error, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 39/65] nbd: fix the co_queue multi-adding bug, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 43/65] qemu-io: Account IO by aio_read and aio_write, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 44/65] qtest: Add scripts/qtest.py, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 45/65] qemu-iotests: Add VM method qtest() to iotests.py, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 42/65] qtest: Fix deadloop by running main loop AIO context's timers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 46/65] qemu-iotests: Allow caller to disable underscore convertion for qmp, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 48/65] qemu-img: Fix qemu-img convert -n, Stefan Hajnoczi, 2015/02/13