From 3172b0ed3fd6802a8eb6e46d008b47ef959baf6a Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 22 Apr 2022 17:11:39 +0200 Subject: [PATCH] qemu: domain: Inline qemuDomainDiskHasEncryptionSecret MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we are already checking that the encryption format can be only _LUKS and _LUKS2 this wrapper function doesn't make much sense any more. The only one caller can do this internally. The move of virStorageSourceIsEmpty is correct as there are no secrets to setup if the disk is empty anyways. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_domain.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0486826fc7..1eb15c8989 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1243,19 +1243,6 @@ qemuDomainStorageSourceHasAuth(virStorageSource *src) } -static bool -qemuDomainDiskHasEncryptionSecret(virStorageSource *src) -{ - if (!virStorageSourceIsEmpty(src) && src->encryption && - (src->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS || - src->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS2) && - src->encryption->nsecrets > 0) - return true; - - return false; -} - - static qemuDomainSecretInfo * qemuDomainSecretStorageSourcePrepareCookies(qemuDomainObjPrivate *priv, virStorageSource *src, @@ -1291,7 +1278,10 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivate *priv, { qemuDomainStorageSourcePrivate *srcPriv; bool hasAuth = qemuDomainStorageSourceHasAuth(src); - bool hasEnc = qemuDomainDiskHasEncryptionSecret(src); + bool hasEnc = src->encryption && src->encryption->nsecrets > 0; + + if (virStorageSourceIsEmpty(src)) + return 0; if (!hasAuth && !hasEnc && src->ncookies == 0) return 0;