mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-14 15:36:25 +00:00
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>
This commit is contained in:
commit
3bba9c115b
12
blockdev.c
12
blockdev.c
@ -340,6 +340,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
|
|||||||
QDict *bs_opts;
|
QDict *bs_opts;
|
||||||
const char *id;
|
const char *id;
|
||||||
bool has_driver_specific_opts;
|
bool has_driver_specific_opts;
|
||||||
|
BlockDriver *drv = NULL;
|
||||||
|
|
||||||
translation = BIOS_ATA_TRANSLATION_AUTO;
|
translation = BIOS_ATA_TRANSLATION_AUTO;
|
||||||
media = MEDIA_DISK;
|
media = MEDIA_DISK;
|
||||||
@ -485,7 +486,11 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
|
|||||||
return NULL;
|
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 */
|
/* disk I/O throttling */
|
||||||
@ -700,12 +705,13 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QINCREF(bs_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 < 0) {
|
||||||
if (ret == -EMEDIUMTYPE) {
|
if (ret == -EMEDIUMTYPE) {
|
||||||
error_report("could not open disk image %s: not in %s format",
|
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 {
|
} else {
|
||||||
error_report("could not open disk image %s: %s",
|
error_report("could not open disk image %s: %s",
|
||||||
file ?: dinfo->id, strerror(-ret));
|
file ?: dinfo->id, strerror(-ret));
|
||||||
|
Loading…
Reference in New Issue
Block a user