rbd: Move the encryption check in build

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>
This commit is contained in:
John Ferlan 2016-09-16 08:05:10 -04:00
parent 15118aca28
commit 8546f723db

View 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'"),