diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-08-12 08:32:36 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-08-12 08:32:36 -0500 |
commit | 3bba9c115ba31f53fb9fc0a2711bf36c0ed6f031 (patch) | |
tree | faba405b9903127370ffa110eaedba529e3e17aa | |
parent | 4a9a8876a14653fd03918945dbb96de3e84b3e3f (diff) | |
parent | 6db5f5d68e2ffc430ba0511e23fc36c7363510f1 (diff) | |
download | hqemu-3bba9c115ba31f53fb9fc0a2711bf36c0ed6f031.zip hqemu-3bba9c115ba31f53fb9fc0a2711bf36c0ed6f031.tar.gz |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Mike Qiu
# Via Kevin Wolf
* kwolf/for-anthony:
block: Bugfix 'format' and 'snapshot' used in drive option
Message-id: 1376071141-3214-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r-- | blockdev.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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)); |