mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemu: domain: Reuse code when preparing hostdev auth secrets
Use qemuDomainSecretStorageSourcePrepare in qemuDomainSecretHostdevPrepare as it uses a virStorageSource to prepare the authentication secret object data. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
2d309f961e
commit
6a2faa1344
@ -1600,22 +1600,11 @@ qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
|
||||
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
||||
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
||||
virStorageSourcePtr src = iscsisrc->src;
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv;
|
||||
|
||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI &&
|
||||
src->auth) {
|
||||
|
||||
if (!(src->privateData = qemuDomainStorageSourcePrivateNew()))
|
||||
return -1;
|
||||
|
||||
srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
||||
|
||||
if (!(srcPriv->secinfo =
|
||||
qemuDomainSecretInfoNew(priv, hostdev->info->alias,
|
||||
VIR_SECRET_USAGE_TYPE_ISCSI,
|
||||
src->auth->username,
|
||||
&src->auth->seclookupdef,
|
||||
false)))
|
||||
if (qemuDomainSecretStorageSourcePrepare(priv, src,
|
||||
hostdev->info->alias, NULL) < 0)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user