Rather than placing/using privateData about secinfo in the hostdev,
let's use the virStorageSource (e.g. disksrc) instead.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_command.c | 5 ++---
src/qemu/qemu_domain.c | 21 +++++++++++++--------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 26a98bd7e9..21f024fb88 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4952,13 +4952,12 @@ 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;
+ qemuDomainDiskSrcPrivatePtr diskSrcPriv =
QEMU_DOMAIN_DISK_SRC_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, diskSrcPriv->secinfo);
return source;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ecf78b426c..916e900e9c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1480,13 +1480,18 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
void
qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr hostdev)
{
- qemuDomainHostdevPrivatePtr hostdevPriv =
- QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev);
+ qemuDomainDiskSrcPrivatePtr diskSrcPriv;
- 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) {
+ diskSrcPriv = QEMU_DOMAIN_DISK_SRC_PRIVATE(iscsisrc->src);
+ if (diskSrcPriv && diskSrcPriv->secinfo)
+ qemuDomainSecretInfoFree(&diskSrcPriv->secinfo);
+ }
+ }
}
@@ -1511,10 +1516,10 @@ qemuDomainSecretHostdevPrepare(virConnectPtr conn,
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI
&&
iscsisrc->src->auth) {
- qemuDomainHostdevPrivatePtr hostdevPriv =
- QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev);
+ qemuDomainDiskSrcPrivatePtr diskSrcPriv =
+ QEMU_DOMAIN_DISK_SRC_PRIVATE(iscsisrc->src);
- if (!(hostdevPriv->secinfo =
+ if (!(diskSrcPriv->secinfo =
qemuDomainSecretInfoNew(conn, priv, hostdev->info->alias,
VIR_SECRET_USAGE_TYPE_ISCSI,
iscsisrc->src->auth->username,
--
2.13.6