mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: Use private storage source for iscsi instead of private hostdev
Rather than placing/using privateData about secinfo in the hostdev, let's use the virStorageSource private data instead.
This commit is contained in:
parent
626ea2d596
commit
16eef5c2b4
@ -4959,13 +4959,14 @@ static char *
|
|||||||
qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev)
|
qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev)
|
||||||
{
|
{
|
||||||
char *source = NULL;
|
char *source = NULL;
|
||||||
qemuDomainHostdevPrivatePtr hostdevPriv = QEMU_DOMAIN_HOSTDEV_PRIVATE(dev);
|
|
||||||
|
|
||||||
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
|
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
|
||||||
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
||||||
|
qemuDomainStorageSourcePrivatePtr srcPriv =
|
||||||
|
QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src);
|
||||||
|
|
||||||
/* Rather than pull what we think we want - use the network disk code */
|
/* Rather than pull what we think we want - use the network disk code */
|
||||||
source = qemuBuildNetworkDriveStr(iscsisrc->src, hostdevPriv->secinfo);
|
source = qemuBuildNetworkDriveStr(iscsisrc->src, srcPriv ?
|
||||||
|
srcPriv->secinfo : NULL);
|
||||||
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
@ -1469,13 +1469,18 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
|
|||||||
void
|
void
|
||||||
qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr hostdev)
|
qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr hostdev)
|
||||||
{
|
{
|
||||||
qemuDomainHostdevPrivatePtr hostdevPriv =
|
qemuDomainStorageSourcePrivatePtr srcPriv;
|
||||||
QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev);
|
|
||||||
|
|
||||||
if (!hostdevPriv || !hostdevPriv->secinfo)
|
if (virHostdevIsSCSIDevice(hostdev)) {
|
||||||
return;
|
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
||||||
|
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
||||||
|
|
||||||
qemuDomainSecretInfoFree(&hostdevPriv->secinfo);
|
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
|
||||||
|
srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(iscsisrc->src);
|
||||||
|
if (srcPriv && srcPriv->secinfo)
|
||||||
|
qemuDomainSecretInfoFree(&srcPriv->secinfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1497,14 +1502,17 @@ qemuDomainSecretHostdevPrepare(virConnectPtr conn,
|
|||||||
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
||||||
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
|
||||||
virStorageSourcePtr src = iscsisrc->src;
|
virStorageSourcePtr src = iscsisrc->src;
|
||||||
|
qemuDomainStorageSourcePrivatePtr srcPriv;
|
||||||
|
|
||||||
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI &&
|
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI &&
|
||||||
src->auth) {
|
src->auth) {
|
||||||
|
|
||||||
qemuDomainHostdevPrivatePtr hostdevPriv =
|
if (!(src->privateData = qemuDomainStorageSourcePrivateNew()))
|
||||||
QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev);
|
return -1;
|
||||||
|
|
||||||
if (!(hostdevPriv->secinfo =
|
srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
|
||||||
|
|
||||||
|
if (!(srcPriv->secinfo =
|
||||||
qemuDomainSecretInfoNew(conn, priv, hostdev->info->alias,
|
qemuDomainSecretInfoNew(conn, priv, hostdev->info->alias,
|
||||||
VIR_SECRET_USAGE_TYPE_ISCSI,
|
VIR_SECRET_USAGE_TYPE_ISCSI,
|
||||||
src->auth->username,
|
src->auth->username,
|
||||||
|
Loading…
Reference in New Issue
Block a user