Rather than placing/using privateData about secinfo in the hostdev,
let's use the virStorageSource private data instead.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_command.c | 7 ++++---
src/qemu/qemu_domain.c | 24 ++++++++++++++++--------
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dc92fe9c7a..70a389f2a3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4895,13 +4895,14 @@ static char *
qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefPtr dev)
{
char *source = NULL;
- qemuDomainHostdevPrivatePtr hostdevPriv = QEMU_DOMAIN_HOSTDEV_PRIVATE(dev);
-
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
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 */
- source = qemuBuildNetworkDriveStr(iscsisrc->src, hostdevPriv->secinfo);
+ source = qemuBuildNetworkDriveStr(iscsisrc->src, srcPriv ?
+ srcPriv->secinfo : NULL);
return source;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1abba02e42..31ec91fa12 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1463,13 +1463,18 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
void
qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr hostdev)
{
- qemuDomainHostdevPrivatePtr hostdevPriv =
- QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev);
+ qemuDomainStorageSourcePrivatePtr srcPriv;
- if (!hostdevPriv || !hostdevPriv->secinfo)
- return;
+ if (virHostdevIsSCSIDevice(hostdev)) {
+ 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);
+ }
+ }
}
@@ -1491,14 +1496,17 @@ qemuDomainSecretHostdevPrepare(virConnectPtr conn,
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) {
- qemuDomainHostdevPrivatePtr hostdevPriv =
- QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev);
+ if (!(src->privateData = qemuDomainStorageSourcePrivateNew()))
+ return -1;
+
+ srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
- if (!(hostdevPriv->secinfo =
+ if (!(srcPriv->secinfo =
qemuDomainSecretInfoNew(conn, priv, hostdev->info->alias,
VIR_SECRET_USAGE_TYPE_ISCSI,
src->auth->username,
--
2.13.6