]> xenbits.xensource.com Git - libvirt.git/commitdiff
rbd: Move the encryption check in build
authorJohn Ferlan <jferlan@redhat.com>
Fri, 16 Sep 2016 12:05:10 +0000 (08:05 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 5 Oct 2016 15:08:09 +0000 (11:08 -0400)
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@redhat.com>
src/storage/storage_backend_rbd.c

index c442b50f5ca45ace684bf5a7596388df7374287a..718c4d6be6f6d28a012836339c6b252c22d84ece 100644 (file)
@@ -696,15 +696,15 @@ virStorageBackendRBDBuildVol(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (!(ptr = virStorageBackendRBDNewState(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 = virStorageBackendRBDNewState(conn, pool)))
+        goto cleanup;
+
     if ((r = virStorageBackendRBDCreateImage(ptr->ioctx, vol->name,
                                              vol->target.capacity)) < 0) {
         virReportSystemError(-r, _("failed to create volume '%s/%s'"),