[PATCH 09/12] qemu: block: Add JSON props generator for sheepdog storage backing

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

 



---
 src/qemu/qemu_block.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 8a1ce8262..5f28c4dd6 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -865,6 +865,33 @@ qemuBlockStorageSourceGetRBDProps(virStorageSourcePtr src)
 }


+static virJSONValuePtr
+qemuBlockStorageSourceGetSheepdogProps(virStorageSourcePtr src)
+{
+    virJSONValuePtr serverprops;
+    virJSONValuePtr ret = NULL;
+
+    if (src->nhosts != 1) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("sheepdog protocol accepts only one host"));
+        return NULL;
+    }
+
+    serverprops = qemuBlockStorageSourceBuildJSONSocketAddress(&src->hosts[0],
+                                                               false);
+    if (!serverprops)
+        return NULL;
+
+    /* libvirt does not support the 'snap-id' and 'tag' properties */
+    ignore_value(virJSONValueObjectCreate(&ret,
+                                          "s:driver", "sheepdog",
+                                          "a:server", serverprops,
+                                          "s:vdi", src->path,
+                                          NULL));
+
+    return ret;
+}
+
 /**
  * qemuBlockStorageSourceGetBackendProps:
  * @src: disk source
@@ -930,6 +957,10 @@ qemuBlockStorageSourceGetBackendProps(virStorageSourcePtr src)
             break;

         case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
+            if (!(fileprops = qemuBlockStorageSourceGetSheepdogProps(src)))
+                return NULL;
+            break;
+
         case VIR_STORAGE_NET_PROTOCOL_SSH:
         case VIR_STORAGE_NET_PROTOCOL_NONE:
         case VIR_STORAGE_NET_PROTOCOL_LAST:
-- 
2.14.3

--
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