[PATCH v5 11/16] qemu: Use private disksrc for iscsi instead of private hostdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux