This patch modifies the qemuTranslateDiskSourcePool function to add RBD storage 
pool support. The code is heavily based off of the existing iSCSI code, but 
modified for RBD support. The modification calls the qemuAddRBDPoolSourceHost 
from my previous patch, along with setting up the ceph user and secret, if 
applicable.

Signed-off-by: Adam Walters <a...@pandorasboxen.com>
---
 src/qemu/qemu_conf.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 2d42c3b..c28908a 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1478,8 +1478,29 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
        }
        break;
 
-    case VIR_STORAGE_POOL_MPATH:
     case VIR_STORAGE_POOL_RBD:
+        if (def->startupPolicy) {
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("'startupPolicy' is only valid for "
+                             "'file' type volume"));
+            goto cleanup;
+        }
+
+        def->srcpool->actualtype = VIR_DOMAIN_DISK_TYPE_NETWORK;
+        def->protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD;
+
+        if (!(def->src = virStorageVolGetPath(vol)))
+            goto cleanup;
+
+        if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0)
+            goto cleanup;
+
+        if (qemuAddRBDPoolSourceHost(def, pooldef) < 0)
+            goto cleanup;
+
+        break;
+
+    case VIR_STORAGE_POOL_MPATH:
     case VIR_STORAGE_POOL_SHEEPDOG:
     case VIR_STORAGE_POOL_GLUSTER:
     case VIR_STORAGE_POOL_LAST:
-- 
1.8.5.2

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

Reply via email to