From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwHkJ-0003Ai-Cc for qemu-devel@nongnu.org; Fri, 18 Jan 2013 14:37:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwHkI-00033R-AP for qemu-devel@nongnu.org; Fri, 18 Jan 2013 14:36:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwHkI-00033N-1S for qemu-devel@nongnu.org; Fri, 18 Jan 2013 14:36:58 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0IJavow010202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Jan 2013 14:36:57 -0500 Date: Fri, 18 Jan 2013 17:37:05 -0200 From: Luiz Capitulino Message-ID: <20130118173705.3abdb9f2@doriath.home> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] block: Monitor command commit neglects to report some errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com On Fri, 18 Jan 2013 12:45:35 -0500 Jeff Cody wrote: > 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'. > > Report error using monitor_printf() and strerror(), and convert existing > qerror_report() calls in do_commit() to monitor_printf(). > > Signed-off-by: Jeff Cody Applied to the qmp branch, thanks. > --- > 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)); > } > } >