]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Extract formatting of props for 'file' backend
authorPeter Krempa <pkrempa@redhat.com>
Tue, 5 Dec 2017 16:02:28 +0000 (17:02 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 7 May 2018 12:50:54 +0000 (14:50 +0200)
'file' backend in qemu supports few more options than the current
implementation. Extract it so that changes don't pollute the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_block.c

index e648fb9625f17316d6aefb9c86e3da91bd37375f..537a41022f4941e19df42232bd5e6ba2ebb0d819 100644 (file)
@@ -974,6 +974,18 @@ qemuBlockStorageSourceGetSshProps(virStorageSourcePtr src)
 }
 
 
+static virJSONValuePtr
+qemuBlockStorageSourceGetFileProps(virStorageSourcePtr src)
+{
+    virJSONValuePtr ret = NULL;
+
+    ignore_value(virJSONValueObjectCreate(&ret,
+                                          "s:driver", "file",
+                                          "s:filename", src->path, NULL) < 0);
+    return ret;
+}
+
+
 /**
  * qemuBlockStorageSourceGetBackendProps:
  * @src: disk source
@@ -991,9 +1003,7 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
     case VIR_STORAGE_TYPE_BLOCK:
     case VIR_STORAGE_TYPE_FILE:
     case VIR_STORAGE_TYPE_DIR:
-        if (virJSONValueObjectCreate(&fileprops,
-                                     "s:driver", "file",
-                                     "s:filename", src->path, NULL) < 0)
+        if (!(fileprops = qemuBlockStorageSourceGetFileProps(src)))
             return NULL;
         break;