From b1f5f14a5c53145d9f078382d3b1bc8328030c83 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 22 Apr 2022 16:16:18 +0200 Subject: [PATCH] qemuBlockStorageSourceGetRBDProps: Simplify handling of encryption format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/qemu/qemu_block.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 3d961c8b39..60e03d418e 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -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,