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:
parent
b5411ce535
commit
3d13acc3bc
@ -1154,12 +1154,6 @@ qemuDomainSecretAESSetup(qemuDomainObjPrivate *priv,
|
|||||||
g_autofree uint8_t *ciphertext = NULL;
|
g_autofree uint8_t *ciphertext = NULL;
|
||||||
size_t ciphertextlen = 0;
|
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 = g_new0(qemuDomainSecretInfo, 1);
|
||||||
|
|
||||||
secinfo->type = VIR_DOMAIN_SECRET_INFO_TYPE_AES;
|
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:
|
/* qemuDomainSecretInfoNewPlain:
|
||||||
* @usageType: Secret usage type
|
* @usageType: Secret usage type
|
||||||
* @username: username
|
* @username: username
|
||||||
@ -1404,8 +1384,7 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivate *priv,
|
|||||||
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD)
|
||||||
usageType = VIR_SECRET_USAGE_TYPE_CEPH;
|
usageType = VIR_SECRET_USAGE_TYPE_CEPH;
|
||||||
|
|
||||||
if (!qemuDomainSupportsEncryptedSecret(priv) ||
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && !iscsiHasPS) {
|
||||||
(src->protocol == VIR_STORAGE_NET_PROTOCOL_ISCSI && !iscsiHasPS)) {
|
|
||||||
srcPriv->secinfo = qemuDomainSecretInfoNewPlain(usageType,
|
srcPriv->secinfo = qemuDomainSecretInfoNewPlain(usageType,
|
||||||
src->auth->username,
|
src->auth->username,
|
||||||
&src->auth->seclookupdef);
|
&src->auth->seclookupdef);
|
||||||
@ -10888,7 +10867,7 @@ qemuDomainPrepareHostdev(virDomainHostdevDef *hostdev,
|
|||||||
virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
||||||
qemuDomainStorageSourcePrivate *srcPriv = qemuDomainStorageSourcePrivateFetch(src);
|
qemuDomainStorageSourcePrivate *srcPriv = qemuDomainStorageSourcePrivateFetch(src);
|
||||||
|
|
||||||
if (!qemuDomainSupportsEncryptedSecret(priv) || !iscsiHasPS) {
|
if (!iscsiHasPS) {
|
||||||
srcPriv->secinfo = qemuDomainSecretInfoNewPlain(usageType,
|
srcPriv->secinfo = qemuDomainSecretInfoNewPlain(usageType,
|
||||||
src->auth->username,
|
src->auth->username,
|
||||||
&src->auth->seclookupdef);
|
&src->auth->seclookupdef);
|
||||||
|
@ -853,8 +853,6 @@ int qemuDomainMasterKeyCreate(virDomainObj *vm);
|
|||||||
|
|
||||||
void qemuDomainMasterKeyRemove(qemuDomainObjPrivate *priv);
|
void qemuDomainMasterKeyRemove(qemuDomainObjPrivate *priv);
|
||||||
|
|
||||||
bool qemuDomainSupportsEncryptedSecret(qemuDomainObjPrivate *priv);
|
|
||||||
|
|
||||||
void qemuDomainSecretInfoFree(qemuDomainSecretInfo *secinfo)
|
void qemuDomainSecretInfoFree(qemuDomainSecretInfo *secinfo)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user