From: Adam Walters <adam(a)pandorasboxen.com>
This helper function pulls the host definitions from the
RBD storage pool definition, and applies it to the disk
definition.
---
src/qemu/qemu_conf.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 4378791..2d42c3b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1247,6 +1247,45 @@ cleanup:
}
static int
+qemuAddRBDPoolSourceHost(virDomainDiskDefPtr def,
+ virStoragePoolDefPtr pooldef)
+{
+ int ret = -1;
+ size_t i = 0;
+ char **tokens = NULL;
+
+ def->nhosts = pooldef->source.nhost;
+
+ if (VIR_ALLOC_N(def->hosts, def->nhosts) < 0)
+ goto cleanup;
+
+ for (i = 0; i < def->nhosts; i++) {
+ if (VIR_STRDUP(def->hosts[i].name, pooldef->source.hosts[i].name) < 0)
+ goto cleanup;
+
+ if (virAsprintf(&def->hosts[i].port, "%d",
+ pooldef->source.hosts[i].port ?
+ pooldef->source.hosts[i].port :
+ 6789) < 0)
+ goto cleanup;
+
+ /* Storage pools have not supported these 2 attributes yet,
+ * use the defaults.
+ */
+ def->hosts[i].transport = VIR_DOMAIN_DISK_PROTO_TRANS_TCP;
+ def->hosts[i].socket = NULL;
+ }
+
+ def->protocol = VIR_DOMAIN_DISK_PROTOCOL_RBD;
+
+ ret = 0;
+
+cleanup:
+ virStringFreeList(tokens);
+ return ret;
+}
+
+static int
qemuTranslateDiskSourcePoolAuth(virDomainDiskDefPtr def,
virStoragePoolDefPtr pooldef)
{
--
1.8.4.3