diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-12-18 16:35:17 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2016-01-13 15:16:17 +0100 |
commit | d410fe145446968055f3807b0d41ae8150eb0926 (patch) | |
tree | 320017213ad4a7291b6050da372b46f7351f73e8 /migration/savevm.c | |
parent | b83baa6025d0bf921f2fc4514df4f60493ea41de (diff) |
migration: Use error_reportf_err() instead of monitor_printf()
Both error_reportf_err() and monitor_printf() print to the same
destination when monitor_printf() is used correctly, i.e. within an
HMP monitor. Elsewhere, monitor_printf() does nothing, while
error_reportf_err() reports to stderr.
Both changed functions are HMP command handlers. These should only
run within an HMP monitor.
Unlike monitor_printf(), error_reportf_err() uses the error whole
instead of just its message obtained with error_get_pretty(). This
avoids suppressing its hint (see commit 50b7b00), but I don't think
the errors touched in this commit can come with hints.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1450452927-8346-15-git-send-email-armbru@redhat.com>
Diffstat (limited to 'migration/savevm.c')
-rw-r--r-- | migration/savevm.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/migration/savevm.c b/migration/savevm.c index e277b72bbf..bcaeb70fe0 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1927,10 +1927,9 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) /* Delete old snapshots of the same name */ if (name && bdrv_all_delete_snapshot(name, &bs1, &local_err) < 0) { - monitor_printf(mon, - "Error while deleting snapshot on device '%s': %s\n", - bdrv_get_device_name(bs1), error_get_pretty(local_err)); - error_free(local_err); + error_reportf_err(local_err, + "Error while deleting snapshot on device '%s': ", + bdrv_get_device_name(bs1)); return; } @@ -2108,10 +2107,9 @@ void hmp_delvm(Monitor *mon, const QDict *qdict) const char *name = qdict_get_str(qdict, "name"); if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) { - 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_reportf_err(err, + "Error while deleting snapshot on device '%s': ", + bdrv_get_device_name(bs)); } } |