qemu: domain: Inline qemuDomainDiskHasEncryptionSecret

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2022-04-22 17:11:39 +02:00
parent 6fe2ca9ac1
commit 3172b0ed3f

View File

@ -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;