On 12/05/13 05:09, Adam Walters wrote:
This implements RBD storage pool support in the
qemuTranslateDiskSourcePool function. This support
is working on my machine, but could probably use
some additional testing. It is implemented very
similarly to the ISCSI support.
---
src/qemu/qemu_conf.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 060ac17..f3daf06 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1478,8 +1478,42 @@ 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;
+ }
+
+ switch (def->srcpool->mode) {
the mode is checked and won't be anything else than _DEFAULT here, so
this switch is not needed.
+ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DEFAULT:
+ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_LAST:
+ def->srcpool->mode = VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT;
+ /* fallthrough */
+ case VIR_DOMAIN_DISK_SOURCE_POOL_MODE_DIRECT:
+ 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_DOMAIN_DISK_SOURCE_POOL_MODE_HOST:
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("\"mode='host'\" is not valid for
"
+ "'rbd' type volume"));
+ goto cleanup;
+ }
+ break;
+
+ case VIR_STORAGE_POOL_MPATH:
case VIR_STORAGE_POOL_SHEEPDOG:
case VIR_STORAGE_POOL_GLUSTER:
case VIR_STORAGE_POOL_LAST:
I'll resend this patch with the switch removed so you can give it a try
before pushing. Thanks for the patch and for fixing it after my changes.
Peter