From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCbEe-00034a-P3 for qemu-devel@nongnu.org; Thu, 22 Aug 2013 16:12:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCbEY-0004EC-JO for qemu-devel@nongnu.org; Thu, 22 Aug 2013 16:12:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCbEY-0004Dt-Ag for qemu-devel@nongnu.org; Thu, 22 Aug 2013 16:11:54 -0400 From: Stefan Hajnoczi Date: Thu, 22 Aug 2013 22:11:00 +0200 Message-Id: <1377202298-22896-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1377202298-22896-1-git-send-email-stefanha@redhat.com> References: <1377202298-22896-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 04/42] block: better error message for read only format name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Fam Zheng , Stefan Hajnoczi , Anthony Liguori From: Fam Zheng When user tries to use read-only whitelist format in the command line option, failure message was "'foo' invalid format". It might be invalid only for writable, but valid for read-only, so it is confusing. Give the user easier to understand information. Signed-off-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- blockdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index bc7016a..d3500c6 100644 --- a/blockdev.c +++ b/blockdev.c @@ -487,7 +487,11 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts, drv = bdrv_find_whitelisted_format(buf, ro); if (!drv) { - error_report("'%s' invalid format", buf); + if (!ro && bdrv_find_whitelisted_format(buf, !ro)) { + error_report("'%s' can be only used as read-only device.", buf); + } else { + error_report("'%s' invalid format", buf); + } return NULL; } } -- 1.8.3.1