* [Qemu-devel] [PATCH] savevm: Improve error message for blocked migration
@ 2015-02-10 13:25 Kevin Wolf
2015-02-10 14:22 ` Eric Blake
2015-02-12 17:05 ` Stefan Hajnoczi
0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2015-02-10 13:25 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, stefanha
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 <kwolf@redhat.com>
---
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;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] savevm: Improve error message for blocked migration
2015-02-10 13:25 [Qemu-devel] [PATCH] savevm: Improve error message for blocked migration Kevin Wolf
@ 2015-02-10 14:22 ` Eric Blake
2015-02-12 17:05 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2015-02-10 14:22 UTC (permalink / raw)
To: Kevin Wolf, qemu-devel; +Cc: stefanha
[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]
On 02/10/2015 06:25 AM, Kevin Wolf wrote:
> 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
You know, 'echo -e' is non-portable (even in bash; you can change shopt
so that it outputs a literal "-e" instead of turning on \
interpretation); it's worth getting used to using 'printf' for
portability. But that doesn't affect your commit.
> 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 <kwolf@redhat.com>
> ---
> savevm.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] savevm: Improve error message for blocked migration
2015-02-10 13:25 [Qemu-devel] [PATCH] savevm: Improve error message for blocked migration Kevin Wolf
2015-02-10 14:22 ` Eric Blake
@ 2015-02-12 17:05 ` Stefan Hajnoczi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2015-02-12 17:05 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, stefanha
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]
On Tue, Feb 10, 2015 at 02:25:02PM +0100, Kevin Wolf wrote:
> 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 <kwolf@redhat.com>
> ---
> savevm.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-12 17:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-10 13:25 [Qemu-devel] [PATCH] savevm: Improve error message for blocked migration Kevin Wolf
2015-02-10 14:22 ` Eric Blake
2015-02-12 17:05 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).