From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL] block: Bugfix 'format' and 'snapshot' used in drive option
Date: Fri, 9 Aug 2013 19:59:01 +0200 [thread overview]
Message-ID: <1376071141-3214-2-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1376071141-3214-1-git-send-email-kwolf@redhat.com>
From: Mike Qiu <qiudayu@linux.vnet.ibm.com>
When use -drive file='xxx',format=qcow2,snapshot=on the error
message "Can't use snapshot=on with driver-specific options"
can be show, and fail to start the qemu.
This should not be happened, and there is no file.driver option
in qemu command line.
It is because the commit 74fe54f2a1b5c4f4498a8fe521e1dfc936656cd4,
it puts 'driver' option if the command line use 'format' option.
This patch is to solve this bug.
Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
blockdev.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/blockdev.c b/blockdev.c
index 41b0a49..e174b7d 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -340,6 +340,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
QDict *bs_opts;
const char *id;
bool has_driver_specific_opts;
+ BlockDriver *drv = NULL;
translation = BIOS_ATA_TRANSLATION_AUTO;
media = MEDIA_DISK;
@@ -485,7 +486,11 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
return NULL;
}
- qdict_put(bs_opts, "driver", qstring_from_str(buf));
+ drv = bdrv_find_whitelisted_format(buf, ro);
+ if (!drv) {
+ error_report("'%s' invalid format", buf);
+ return NULL;
+ }
}
/* disk I/O throttling */
@@ -700,12 +705,13 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
}
QINCREF(bs_opts);
- ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, NULL);
+ ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv);
if (ret < 0) {
if (ret == -EMEDIUMTYPE) {
error_report("could not open disk image %s: not in %s format",
- file ?: dinfo->id, qdict_get_str(bs_opts, "driver"));
+ file ?: dinfo->id, drv ? drv->format_name :
+ qdict_get_str(bs_opts, "driver"));
} else {
error_report("could not open disk image %s: %s",
file ?: dinfo->id, strerror(-ret));
--
1.8.1.4
next prev parent reply other threads:[~2013-08-09 17:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-09 17:59 [Qemu-devel] [PULL] Block fix for 1.6 Kevin Wolf
2013-08-09 17:59 ` Kevin Wolf [this message]
2013-08-14 16:26 ` Anthony Liguori
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=1376071141-3214-2-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/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).