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 <pkrempa(a)redhat.com>
---
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;
--
2.35.1