From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH] block: improve error message for read-only whitelisted driver
Date: Thu, 10 Oct 2013 10:31:11 +0800 [thread overview]
Message-ID: <1381372271-24429-1-git-send-email-famz@redhat.com> (raw)
Supplement of 7780d47, with message reworded and format probe case
included: print an easy to understand message, when user tries to open a
read-only format as read-write.
Signed-off-by: Fam Zheng <famz@redhat.com>
---
block.c | 8 +++++++-
blockdev.c | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index 93e113a..240c28e 100644
--- a/block.c
+++ b/block.c
@@ -769,7 +769,13 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
bs->read_only = !(open_flags & BDRV_O_RDWR);
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
- error_setg(errp, "Driver '%s' is not whitelisted", drv->format_name);
+ if (!bs->read_only && bdrv_is_whitelisted(drv, true)) {
+ error_setg(errp, "format '%s' is only supported read-only",
+ drv->format_name);
+ } else {
+ error_setg(errp, "Driver '%s' is not whitelisted",
+ drv->format_name);
+ }
return -ENOTSUP;
}
diff --git a/blockdev.c b/blockdev.c
index 8aa66a9..c39fd9d 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -471,7 +471,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
drv = bdrv_find_whitelisted_format(buf, ro);
if (!drv) {
if (!ro && bdrv_find_whitelisted_format(buf, !ro)) {
- error_report("'%s' can be only used as read-only device.", buf);
+ error_report("format '%s' is only supported read-only", buf);
} else {
error_report("'%s' invalid format", buf);
}
--
1.8.3.1
next reply other threads:[~2013-10-10 2:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 2:31 Fam Zheng [this message]
2013-10-10 9:29 ` [Qemu-devel] [PATCH] block: improve error message for read-only whitelisted driver Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381372271-24429-1-git-send-email-famz@redhat.com \
--to=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).