[PATCH 13/35] qemu: block: Properly handle block storage in JSON generator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_block.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 516b006ce9..bf330f8238 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -977,14 +977,22 @@ qemuBlockStorageSourceGetSshProps(virStorageSourcePtr src)
 static virJSONValuePtr
 qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
 {
+    const char *driver = "file";
     const char *iomode = NULL;
     virJSONValuePtr ret = NULL;

     if (src->iomode != VIR_DOMAIN_DISK_IO_DEFAULT)
         iomode = virDomainDiskIoTypeToString(src->iomode);

+    if (virStorageSourceIsBlockLocal(src)) {
+        if (src->hostcdrom)
+            driver = "host_cdrom";
+        else
+            driver = "host_device";
+    }
+
     ignore_value(virJSONValueObjectCreate(&ret,
-                                          "s:driver", "file",
+                                          "s:driver", driver,
                                           "s:filename", src->path,
                                           "S:aio", iomode,
                                           NULL) < 0);
-- 
2.16.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux