mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
qemu: Split out initialization of secrets for 'iscsi' hostdevs
Currently we don't have infrastructure to remember the secret aliases for hostdevs. Since an upcoming patch is going to change aliases for the disks, initialize the iscsi hostdevs separately so that we can keep the alias. At the same time let's use qemuAliasForSecret instead of qemuDomainGetSecretAESAlias when unplugging the iscsi hostdev. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
95a8c4332d
commit
740dd1a4e5
@ -1840,8 +1840,29 @@ qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
|
||||
|
||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI &&
|
||||
src->auth) {
|
||||
if (qemuDomainSecretStorageSourcePrepare(priv, src,
|
||||
hostdev->info->alias, NULL) < 0)
|
||||
bool iscsiHasPS = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ISCSI_PASSWORD_SECRET);
|
||||
virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv;
|
||||
|
||||
if (!(src->privateData = qemuDomainStorageSourcePrivateNew()))
|
||||
return -1;
|
||||
|
||||
srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
||||
|
||||
if (!qemuDomainSupportsEncryptedSecret(priv) || !iscsiHasPS) {
|
||||
srcPriv->secinfo = qemuDomainSecretInfoNewPlain(usageType,
|
||||
src->auth->username,
|
||||
&src->auth->seclookupdef);
|
||||
} else {
|
||||
srcPriv->secinfo = qemuDomainSecretAESSetupFromSecret(priv,
|
||||
hostdev->info->alias,
|
||||
usageType,
|
||||
src->auth->username,
|
||||
&src->auth->seclookupdef,
|
||||
false);
|
||||
}
|
||||
|
||||
if (!srcPriv->secinfo)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -4471,7 +4471,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
|
||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI &&
|
||||
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ISCSI_PASSWORD_SECRET) &&
|
||||
qemuDomainStorageSourceHasAuth(iscsisrc->src)) {
|
||||
if (!(objAlias = qemuDomainGetSecretAESAlias(hostdev->info->alias, false)))
|
||||
if (!(objAlias = qemuAliasForSecret(hostdev->info->alias, NULL)))
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user