]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBlockStorageSourceGetRBDProps: Simplify handling of encryption format
authorPeter Krempa <pkrempa@redhat.com>
Fri, 22 Apr 2022 14:16:18 +0000 (16:16 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 25 Apr 2022 14:34:59 +0000 (16:34 +0200)
Remove the impossible error message about the 'qcow2' encryption format
not being supported. We validated before that it can't happen.

Additionally the code can be simplified by removing error handling from
impossible code paths as the last resort is virJSONValueCreate not
allowing NULL argument with the 's:' modifier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_block.c

index 3d961c8b39c064e46c71de04057a3ca9a146c4db..60e03d418ed753c4eb5f6a33394ff2836988c281 100644 (file)
@@ -882,7 +882,7 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *src,
     g_autoptr(virJSONValue) servers = NULL;
     virJSONValue *ret = NULL;
     g_autoptr(virJSONValue) encrypt = NULL;
-    const char *encformat;
+    const char *encformat = NULL;
     const char *username = NULL;
     g_autoptr(virJSONValue) authmodes = NULL;
     const char *keysecret = NULL;
@@ -911,16 +911,10 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *src,
                 break;
 
             case VIR_STORAGE_ENCRYPTION_FORMAT_QCOW:
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("librbd encryption engine only supports luks/luks2 formats"));
-                return NULL;
-
             case VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT:
             case VIR_STORAGE_ENCRYPTION_FORMAT_LAST:
             default:
-                virReportEnumRangeError(virStorageEncryptionFormatType,
-                                        src->encryption->format);
-                return NULL;
+                break;
         }
 
         if (virJSONValueObjectAdd(&encrypt,