qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v1 24/25] migration: savevm: Update error API us


From: Peter Crosthwaite
Subject: [Qemu-devel] [RFC PATCH v1 24/25] migration: savevm: Update error API usages
Date: Thu, 10 Sep 2015 22:33:34 -0700

Use error_prefix() and convert monitor_printf to error_printf_fn.

Cc: Juan Quintela <address@hidden>
Signed-off-by: Peter Crosthwaite <address@hidden>
---

 migration/savevm.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/migration/savevm.c b/migration/savevm.c
index 6071215..683201d 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1266,12 +1266,10 @@ static int del_existing_snapshots(Monitor *mon, const 
char *name)
             bdrv_snapshot_find(bs, snapshot, name) >= 0) {
             bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
             if (err) {
-                monitor_printf(mon,
-                               "Error while deleting snapshot on device '%s':"
-                               " %s\n",
-                               bdrv_get_device_name(bs),
-                               error_get_pretty(err));
-                error_free(err);
+                error_prefix(err,
+                             "Error while deleting snapshot on device '%s':",
+                              bdrv_get_device_name(bs));
+                error_printf_fn(err, monitor_printf, mon);
                 return -1;
             }
         }
@@ -1360,7 +1358,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
     vm_state_size = qemu_ftell(f);
     qemu_fclose(f);
     if (ret < 0) {
-        monitor_printf(mon, "%s\n", error_get_pretty(local_err));
+        error_printf_fn(local_err, monitor_printf, mon);
         error_free(local_err);
         goto the_end;
     }
@@ -1512,12 +1510,10 @@ void hmp_delvm(Monitor *mon, const QDict *qdict)
             err = NULL;
             bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
             if (err) {
-                monitor_printf(mon,
-                               "Error while deleting snapshot on device '%s':"
-                               " %s\n",
-                               bdrv_get_device_name(bs),
-                               error_get_pretty(err));
-                error_free(err);
+                error_prefix(err,
+                             "Error while deleting snapshot on device '%s':",
+                             bdrv_get_device_name(bs));
+                error_printf_fn(err, monitor_printf, mon);
             }
         }
     }
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]