[libvirt] [PATCHv2 3/3] qemu: command: Handle RBD storage pools

Adam Walters adam at pandorasboxen.com
Mon Dec 2 21:36:02 UTC 2013


This patch modifies the switch statement in qemuBuildVolumeString
to format and pass the needed argument to handle a volume from an
RBD storage pool properly. If the volume is a VIR_STORAGE_VOL_NETWORK
but is not from an RBD pool, I goto cleanup, just like the other
unimplemented volume types. Currently, the code only supports RBD
volumes, as I lack the facilities to test other network storage pools.
Once I have the ability to test those, I will revisit the possibility
of implementing additional types.
---
 src/qemu/qemu_command.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 763417f..4102568 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3825,6 +3825,17 @@ qemuBuildVolumeString(virConnectPtr conn,
         }
         break;
     case VIR_STORAGE_VOL_NETWORK:
+        if (disk->srcpool->pooltype == VIR_STORAGE_POOL_RBD) {
+            virBufferAddLit(opt, "file=");
+
+            if (qemuBuildRBDString(conn, disk, opt) < 0)
+                goto cleanup;
+
+            virBufferAddChar(opt, ',');
+        } else {
+            goto cleanup;
+        }
+        break;
     case VIR_STORAGE_VOL_NETDIR:
     case VIR_STORAGE_VOL_LAST:
         /* Keep the compiler quiet, qemuTranslateDiskSourcePool already
-- 
1.8.4.2




More information about the libvir-list mailing list