From patchwork Fri Jan 18 14:55:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 213628 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0EFE32C007C for ; Sat, 19 Jan 2013 01:55:33 +1100 (EST) Received: from localhost ([::1]:41155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwDLv-0001dS-1E for incoming@patchwork.ozlabs.org; Fri, 18 Jan 2013 09:55:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54462) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwDLl-0001dA-Fm for qemu-devel@nongnu.org; Fri, 18 Jan 2013 09:55:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwDLh-0006ad-I9 for qemu-devel@nongnu.org; Fri, 18 Jan 2013 09:55:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwDLh-0006aS-AE for qemu-devel@nongnu.org; Fri, 18 Jan 2013 09:55:17 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0IEtG99014465 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Jan 2013 09:55:16 -0500 Received: from localhost (ovpn-112-50.phx2.redhat.com [10.3.112.50]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0IEt9Z0012353 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 18 Jan 2013 09:55:15 -0500 From: Jeff Cody To: qemu-devel@nongnu.org Date: Fri, 18 Jan 2013 09:55:09 -0500 Message-Id: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, armbru@redhat.com, stefanha@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v2] block: do_commit() does not pass along error messages for all errors 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 The non-live bdrv_commit() function may return one of the following errors: -ENOTSUP, -EBUSY, -EACCES, -EIO. The only error that is checked in the HMP handler is -EBUSY, so the monitor command 'commit' silently fails for all error cases other than 'Device is in use'. Return error using monitor_printf() and strerror(), and covert existing qerror_report() calls in do_commit() to use monitor_printf(). Signed-off-by: Jeff Cody --- blockdev.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/blockdev.c b/blockdev.c index d724e2d..cb3b426 100644 --- a/blockdev.c +++ b/blockdev.c @@ -642,21 +642,17 @@ void do_commit(Monitor *mon, const QDict *qdict) if (!strcmp(device, "all")) { ret = bdrv_commit_all(); - if (ret == -EBUSY) { - qerror_report(QERR_DEVICE_IN_USE, device); - return; - } } else { bs = bdrv_find(device); if (!bs) { - qerror_report(QERR_DEVICE_NOT_FOUND, device); + monitor_printf(mon, "Device '%s' not found\n", device); return; } ret = bdrv_commit(bs); - if (ret == -EBUSY) { - qerror_report(QERR_DEVICE_IN_USE, device); - return; - } + } + if (ret < 0) { + monitor_printf(mon, "'commit' error for '%s': %s\n", device, + strerror(-ret)); } }