[PATCH 04/12] qemu: domain: Remove qemuDomainSupportsEncryptedSecret

Peter Krempa pkrempa at redhat.com
Wed Sep 22 11:35:23 UTC 2021


The answer is now always 'true', so we can remove the function and
simplify the logic in places where it's called.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c | 25 ++-----------------------
 src/qemu/qemu_domain.h |  2 --
 2 files changed, 2 insertions(+), 25 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1340ed0d29..903e86f8dc 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1154,12 +1154,6 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivate *priv,
     g_autofree uint8_t *ciphertext = NULL;
     size_t ciphertextlen = 0;

-    if (!qemuDomainSupportsEncryptedSecret(priv)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("encrypted secrets are not supported"));
-        return NULL;
-    }
-
     secinfo = g_new0(qemuDomainSecretInfo, 1);

     secinfo->type = VIR_DOMAIN_SECRET_INFO_TYPE_AES;
@@ -1235,20 +1229,6 @@ qemuDomainSecretAESSetupFromSecret(qemuDomainObjPrivate *priv,
 }


-/**
- * qemuDomainSupportsEncryptedSecret:
- * @priv: qemu domain private data
- *
- * Returns true if libvirt can use encrypted 'secret' objects with VM which
- * @priv belongs to.
- */
-bool
-qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivate *priv)
-{
-    return !!priv->masterKey;
-}
-
-
 /* qemuDomainSecretInfoNewPlain:
  * @usageType: Secret usage type
  * @username: username
@@ -1404,8 +1384,7 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivate *priv,
         if (src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
             usageType = VIR_SECRET_USAGE_TYPE_CEPH;

-        if (!qemuDomainSupportsEncryptedSecret(priv) ||
-            (src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && !iscsiHasPS)) {
+        if (src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && !iscsiHasPS) {
             srcPriv->secinfo = qemuDomainSecretInfoNewPlain(usageType,
                                                             src->auth->username,
                                                             &src->auth->seclookupdef);
@@ -10888,7 +10867,7 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev,
                 virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
                 qemuDomainStorageSourcePrivate *srcPriv = qemuDomainStorageSourcePrivateFetch(src);

-                if (!qemuDomainSupportsEncryptedSecret(priv) || !iscsiHasPS) {
+                if (!iscsiHasPS) {
                     srcPriv->secinfo = qemuDomainSecretInfoNewPlain(usageType,
                                                                     src->auth->username,
                                                                     &src->auth->seclookupdef);
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index ae9d76ec4a..08f33f0f9e 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -853,8 +853,6 @@ int qemuDomainMasterKeyCreate(virDomainObj *vm);

 void qemuDomainMasterKeyRemove(qemuDomainObjPrivate *priv);

-bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivate *priv);
-
 void qemuDomainSecretInfoFree(qemuDomainSecretInfo *secinfo)
     ATTRIBUTE_NONNULL(1);

-- 
2.31.1




More information about the libvir-list mailing list