qemu: domain: Remove qemuDomainSupportsEncryptedSecret

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-09-21 17:58:30 +02:00
parent b5411ce535
commit 3d13acc3bc
2 changed files with 2 additions and 25 deletions

View File

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

View File

@ -853,8 +853,6 @@ int qemuDomainMasterKeyCreate(virDomainObj *vm);
void qemuDomainMasterKeyRemove(qemuDomainObjPrivate *priv);
bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivate *priv);
void qemuDomainSecretInfoFree(qemuDomainSecretInfo *secinfo)
ATTRIBUTE_NONNULL(1);