[PATCHv2 2/3] qemu: conf: Parse RBD storage pool from domain xml

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

 



Modify switch statement in qemuTranslateDiskSourcePool
to parse the storage pool definition for RBD pools
instead of throwing an error. I do throw errors for
any other usage case of VIR_STORAGE_VOL_NETWORK, as my
code does not cover their use cases currently. Once I
have the ability to test such usage cases, I will
revisit those possibilities.
---
 src/qemu/qemu_conf.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index e2154c6..024d40f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1416,6 +1416,32 @@ qemuTranslateDiskSourcePool(virConnectPtr conn,
 
         break;
     case VIR_STORAGE_VOL_NETWORK:
+        if (!(poolxml = virStoragePoolGetXMLDesc(pool, 0)))
+            goto cleanup;
+
+        if (!(pooldef = virStoragePoolDefParseString(poolxml)))
+            goto cleanup;
+
+        def->srcpool->pooltype = pooldef->type;
+        if (pooldef->type == VIR_STORAGE_POOL_RBD) {
+            if (!def->srcpool->mode)
+                def->srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT;
+
+            if (qemuAddRBDPoolSourceHost(def, pooldef) < 0)
+                goto cleanup;
+
+            if (!(def->src = virStorageVolGetPath(vol)))
+                goto cleanup;
+
+            if (qemuTranslateDiskSourcePoolAuth(def, pooldef) < 0)
+                goto cleanup;
+        } else {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Unsupported network volume type"));
+            goto cleanup;
+        }
+
+        break;
     case VIR_STORAGE_VOL_NETDIR:
     case VIR_STORAGE_VOL_LAST:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-- 
1.8.4.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]