mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: block: Properly handle block storage in JSON generator
Block storage should actually be passed to qemu via 'host_device' or 'host_cdrom' according to the device type. There were no users of this behaviour so we thankfully can change it. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
e5dc760d0c
commit
01455fe87b
@ -977,14 +977,22 @@ qemuBlockStorageSourceGetSshProps(virStorageSourcePtr src)
|
|||||||
static virJSONValuePtr
|
static virJSONValuePtr
|
||||||
qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
|
qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
|
||||||
{
|
{
|
||||||
|
const char *driver = "file";
|
||||||
const char *iomode = NULL;
|
const char *iomode = NULL;
|
||||||
virJSONValuePtr ret = NULL;
|
virJSONValuePtr ret = NULL;
|
||||||
|
|
||||||
if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
|
if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
|
||||||
iomode = virDomainDiskIoTypeToString(src->iomode);
|
iomode = virDomainDiskIoTypeToString(src->iomode);
|
||||||
|
|
||||||
|
if (virStorageSourceIsBlockLocal(src)) {
|
||||||
|
if (src->hostcdrom)
|
||||||
|
driver = "host_cdrom";
|
||||||
|
else
|
||||||
|
driver = "host_device";
|
||||||
|
}
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectCreate(&ret,
|
||||||
"s:driver", "file",
|
"s:driver", driver,
|
||||||
"s:filename", src->path,
|
"s:filename", src->path,
|
||||||
"S:aio", iomode,
|
"S:aio", iomode,
|
||||||
NULL) < 0);
|
NULL) < 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user