No sense opening a connection only to fail because we don't support the
type of build being attempted.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_backend_rbd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 37375c0..0d029c5 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -696,15 +696,15 @@ virStorageBackendRBDBuildVol(virConnectPtr conn,
goto cleanup;
}
- if (!(ptr = virStorageBackendRBDAllocStateContext(conn, pool)))
- goto cleanup;
-
if (vol->target.encryption != NULL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("storage pool does not support encrypted volumes"));
goto cleanup;
}
+ if (!(ptr = virStorageBackendRBDAllocStateContext(conn, pool)))
+ goto cleanup;
+
if ((r = virStorageBackendRBDCreateImage(ptr->ioctx, vol->name,
vol->target.capacity)) < 0) {
virReportSystemError(-r, _("failed to create volume '%s/%s'"),
--
2.7.4