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 76130c3de1..8e0044684c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4950,13 +4950,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 3bdb22314c..afd306f062 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