From patchwork Thu Dec 17 16:49:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 558434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D2AC71402C0 for ; Fri, 18 Dec 2015 03:56:04 +1100 (AEDT) Received: from localhost ([::1]:54847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9bqT-0004ZF-Cb for incoming@patchwork.ozlabs.org; Thu, 17 Dec 2015 11:56:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9bkq-0003sn-JN for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:50:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9bko-0007X8-Bt for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:50:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54954) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9bko-0007Ww-7P for qemu-devel@nongnu.org; Thu, 17 Dec 2015 11:50:10 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id D086F8E363 for ; Thu, 17 Dec 2015 16:50:09 +0000 (UTC) Received: from blackfin.pond.sub.org ([10.3.113.12]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBHGo74e013044 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 17 Dec 2015 11:50:09 -0500 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 378853002544; Thu, 17 Dec 2015 17:50:06 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 17 Dec 2015 17:49:55 +0100 Message-Id: <1450371004-26866-15-git-send-email-armbru@redhat.com> In-Reply-To: <1450371004-26866-1-git-send-email-armbru@redhat.com> References: <1450371004-26866-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 14/23] migration: Use error_reportf_err() instead of monitor_printf() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Using error_reportf_err() instead of monitor_printf() makes no difference 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. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- migration/savevm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/migration/savevm.c b/migration/savevm.c index e277b72..bcaeb70 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)); } }