qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] savevm: Improve error message for unmigratable devices
@ 2013-04-18  9:23 Kevin Wolf
  2013-04-18 10:43 ` Pavel Hrdina
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2013-04-18  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

Trying to take an internal snapshot when an unmigratable device is in
use resuled in an 'Error -22 while writing VM' message. This patch
changes it to print the same error message as migration would print:
'State blocked by non-migratable device xyz'

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 savevm.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/savevm.c b/savevm.c
index 53515cb..1d00998 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1905,7 +1905,7 @@ void qemu_savevm_state_cancel(void)
     }
 }
 
-static int qemu_savevm_state(QEMUFile *f)
+static void qemu_savevm_state(QEMUFile *f, Error **errp)
 {
     int ret;
     MigrationParams params = {
@@ -1913,8 +1913,8 @@ static int qemu_savevm_state(QEMUFile *f)
         .shared = 0
     };
 
-    if (qemu_savevm_state_blocked(NULL)) {
-        return -EINVAL;
+    if (qemu_savevm_state_blocked(errp)) {
+        return;
     }
 
     qemu_mutex_unlock_iothread();
@@ -1934,8 +1934,8 @@ static int qemu_savevm_state(QEMUFile *f)
     }
     if (ret != 0) {
         qemu_savevm_state_cancel();
+        error_setg(errp, "Error %d while writing VM\n", ret);
     }
-    return ret;
 }
 
 static int qemu_save_device_state(QEMUFile *f)
@@ -2256,6 +2256,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;
@@ -2314,11 +2315,13 @@ 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);
+
+    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);
+    if (error_is_set(&local_err)) {
+        qerror_report_err(local_err);
+        error_free(local_err);
         goto the_end;
     }
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] savevm: Improve error message for unmigratable devices
  2013-04-18  9:23 [Qemu-devel] [PATCH] savevm: Improve error message for unmigratable devices Kevin Wolf
@ 2013-04-18 10:43 ` Pavel Hrdina
  2013-04-18 11:33   ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Hrdina @ 2013-04-18 10:43 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: qemu-devel

On 18.4.2013 11:23, Kevin Wolf wrote:
> Trying to take an internal snapshot when an unmigratable device is in
> use resuled in an 'Error -22 while writing VM' message. This patch
> changes it to print the same error message as migration would print:
> 'State blocked by non-migratable device xyz'
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---

Hi Kevin,

this patch is not needed because I'm fixing the same in my patch series 
http://lists.nongnu.org/archive/html/qemu-devel/2013-04/msg03287.html in 
this patch 
http://lists.nongnu.org/archive/html/qemu-devel/2013-04/msg03298.html .

Pavel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] savevm: Improve error message for unmigratable devices
  2013-04-18 10:43 ` Pavel Hrdina
@ 2013-04-18 11:33   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2013-04-18 11:33 UTC (permalink / raw)
  To: Pavel Hrdina; +Cc: qemu-devel

Am 18.04.2013 um 12:43 hat Pavel Hrdina geschrieben:
> On 18.4.2013 11:23, Kevin Wolf wrote:
> >Trying to take an internal snapshot when an unmigratable device is in
> >use resuled in an 'Error -22 while writing VM' message. This patch
> >changes it to print the same error message as migration would print:
> >'State blocked by non-migratable device xyz'
> >
> >Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> >---
> 
> Hi Kevin,
> 
> this patch is not needed because I'm fixing the same in my patch
> series
> http://lists.nongnu.org/archive/html/qemu-devel/2013-04/msg03287.html
> in this patch
> http://lists.nongnu.org/archive/html/qemu-devel/2013-04/msg03298.html

Okay, I wasn't CCed on that series, so I wasn't fully aware of what it's
touching or not. I'll comment on your series.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-18 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18  9:23 [Qemu-devel] [PATCH] savevm: Improve error message for unmigratable devices Kevin Wolf
2013-04-18 10:43 ` Pavel Hrdina
2013-04-18 11:33   ` Kevin Wolf

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).