]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Properly handle block storage in JSON generator
authorPeter Krempa <pkrempa@redhat.com>
Tue, 24 Apr 2018 15:12:19 +0000 (17:12 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 7 May 2018 13:30:47 +0000 (15:30 +0200)
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>
src/qemu/qemu_block.c

index 9098399cf24293ffacfe15f1780725b0283bb9b2..b77dfaea7276ec508196c19bf8c99bf1ab6f7995 100644 (file)
@@ -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);