From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCPSB-0000Wr-GX for qemu-devel@nongnu.org; Thu, 22 Aug 2013 03:37:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCPS5-0008I1-H8 for qemu-devel@nongnu.org; Thu, 22 Aug 2013 03:37:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCPS5-0008He-9n for qemu-devel@nongnu.org; Thu, 22 Aug 2013 03:37:05 -0400 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 r7M7b3F0014739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 22 Aug 2013 03:37:03 -0400 From: Fam Zheng Date: Thu, 22 Aug 2013 15:36:59 +0800 Message-Id: <1377157019-9267-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH] 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: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com 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 --- 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