]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: domain: Inline qemuDomainDiskHasEncryptionSecret
authorPeter Krempa <pkrempa@redhat.com>
Fri, 22 Apr 2022 15:11:39 +0000 (17:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 25 Apr 2022 14:34:59 +0000 (16:34 +0200)
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>
src/qemu/qemu_domain.c

index 0486826fc74f905fa9ce4dd600ff0b2831060343..1eb15c898962c5ff5741fa86b89fedfb72b728ea 100644 (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;