[PATCH v2 4/8] hostdev: Introduce virDomainHostdevSubsysSCSIHost

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

 



Split virDomainHostdevSubsysSCSI further. In preparation for having
either SCSI or iSCSI data, create a union in virDomainHostdevSubsysSCSI
to contain just a virDomainHostdevSubsysSCSIHost to describe the
'scsi_host' host device

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_audit.c          |  8 ++++--
 src/conf/domain_conf.c           | 59 ++++++++++++++++++++++++----------------
 src/conf/domain_conf.h           | 14 ++++++++--
 src/qemu/qemu_cgroup.c           |  9 ++++--
 src/qemu/qemu_command.c          |  7 +++--
 src/qemu/qemu_conf.c             | 18 ++++++------
 src/qemu/qemu_hotplug.c          | 13 +++++----
 src/security/security_apparmor.c |  5 ++--
 src/security/security_dac.c      | 10 ++++---
 src/security/security_selinux.c  | 10 ++++---
 src/util/virhostdev.c            | 36 ++++++++++++------------
 11 files changed, 113 insertions(+), 76 deletions(-)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 370dc3a..ee9baa2 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -423,14 +423,16 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
                 goto cleanup;
             }
             break;
-        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+            virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
             if (virAsprintfQuiet(&address, "%s:%d:%d:%d",
-                                 scsisrc->adapter, scsisrc->bus,
-                                 scsisrc->target, scsisrc->unit) < 0) {
+                                 scsihostsrc->adapter, scsihostsrc->bus,
+                                 scsihostsrc->target, scsihostsrc->unit) < 0) {
                 VIR_WARN("OOM while encoding audit message");
                 goto cleanup;
             }
             break;
+        }
         default:
             VIR_WARN("Unexpected hostdev type while encoding audit message: %d",
                      hostdev->source.subsys.type);
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 837f4a8..53bd1d5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1740,7 +1740,7 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
         break;
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
         if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
-            VIR_FREE(def->source.subsys.u.scsi.adapter);
+            VIR_FREE(def->source.subsys.u.scsi.u.host.adapter);
         break;
     }
 }
@@ -4025,16 +4025,16 @@ virDomainHostdevSubsysPCIDefParseXML(xmlNodePtr node,
 }
 
 static int
-virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr node,
-                                      virDomainHostdevDefPtr def)
+virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
+                                          virDomainHostdevSubsysSCSIPtr scsisrc)
 {
     int ret = -1;
     bool got_address = false, got_adapter = false;
     xmlNodePtr cur;
     char *bus = NULL, *target = NULL, *unit = NULL;
-    virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
+    virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
 
-    cur = node->children;
+    cur = sourcenode->children;
     while (cur != NULL) {
         if (cur->type == XML_ELEMENT_NODE) {
             if (xmlStrEqual(cur->name, BAD_CAST "address")) {
@@ -4054,19 +4054,20 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr node,
                     goto cleanup;
                 }
 
-                if (virStrToLong_ui(bus, NULL, 0, &scsisrc->bus) < 0) {
+                if (virStrToLong_ui(bus, NULL, 0, &scsihostsrc->bus) < 0) {
                     virReportError(VIR_ERR_INTERNAL_ERROR,
                                    _("cannot parse bus '%s'"), bus);
                     goto cleanup;
                 }
 
-                if (virStrToLong_ui(target, NULL, 0, &scsisrc->target) < 0) {
+                if (virStrToLong_ui(target, NULL, 0,
+                                    &scsihostsrc->target) < 0) {
                     virReportError(VIR_ERR_INTERNAL_ERROR,
                                    _("cannot parse target '%s'"), target);
                     goto cleanup;
                 }
 
-                if (virStrToLong_ui(unit, NULL, 0, &scsisrc->unit) < 0) {
+                if (virStrToLong_ui(unit, NULL, 0, &scsihostsrc->unit) < 0) {
                     virReportError(VIR_ERR_INTERNAL_ERROR,
                                    _("cannot parse unit '%s'"), unit);
                     goto cleanup;
@@ -4080,7 +4081,7 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr node,
                                      "for scsi hostdev source"));
                     goto cleanup;
                 }
-                if (!(scsisrc->adapter = virXMLPropString(cur, "name"))) {
+                if (!(scsihostsrc->adapter = virXMLPropString(cur, "name"))) {
                     virReportError(VIR_ERR_XML_ERROR, "%s",
                                    _("'adapter' must be specified for scsi hostdev source"));
                     goto cleanup;
@@ -4112,6 +4113,13 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr node,
     return ret;
 }
 
+static int
+virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
+                                      virDomainHostdevSubsysSCSIPtr scsisrc)
+{
+    return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
+}
+
 /* Check if a drive type address $controller:0:0:$unit is already
  * taken by a disk or not.
  */
@@ -4350,7 +4358,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
         break;
 
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
-        if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, def) < 0)
+        if (virDomainHostdevSubsysSCSIDefParseXML(sourcenode, scsisrc) < 0)
             goto error;
         break;
 
@@ -10240,17 +10248,18 @@ virDomainHostdevMatchSubsysPCI(virDomainHostdevDefPtr first,
 }
 
 static int
-virDomainHostdevMatchSubsysSCSI(virDomainHostdevDefPtr first,
-                                virDomainHostdevDefPtr second)
-{
-    virDomainHostdevSubsysSCSIPtr first_scsisrc = &first->source.subsys.u.scsi;
-    virDomainHostdevSubsysSCSIPtr second_scsisrc =
-        &second->source.subsys.u.scsi;
-
-    if (STREQ(first_scsisrc->adapter, second_scsisrc->adapter) &&
-        first_scsisrc->bus == second_scsisrc->bus &&
-        first_scsisrc->target == second_scsisrc->target &&
-        first_scsisrc->unit == second_scsisrc->unit)
+virDomainHostdevMatchSubsysSCSIHost(virDomainHostdevDefPtr first,
+                                    virDomainHostdevDefPtr second)
+{
+    virDomainHostdevSubsysSCSIHostPtr first_scsihostsrc =
+        &first->source.subsys.u.scsi.u.host;
+    virDomainHostdevSubsysSCSIHostPtr second_scsihostsrc =
+        &second->source.subsys.u.scsi.u.host;
+
+    if (STREQ(first_scsihostsrc->adapter, second_scsihostsrc->adapter) &&
+        first_scsihostsrc->bus == second_scsihostsrc->bus &&
+        first_scsihostsrc->target == second_scsihostsrc->target &&
+        first_scsihostsrc->unit == second_scsihostsrc->unit)
         return 1;
     return 0;
 }
@@ -10268,7 +10277,7 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
         return virDomainHostdevMatchSubsysUSB(a, b);
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
-        return virDomainHostdevMatchSubsysSCSI(a, b);
+        return virDomainHostdevMatchSubsysSCSIHost(a, b);
     }
     return 0;
 }
@@ -15481,6 +15490,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
     virDomainHostdevSubsysUSBPtr usbsrc = &def->source.subsys.u.usb;
     virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
     virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
+    virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
 
     if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
         pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
@@ -15549,10 +15559,11 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
         break;
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
         virBufferAsprintf(buf, "<adapter name='%s'/>\n",
-                          scsisrc->adapter);
+                          scsihostsrc->adapter);
         virBufferAsprintf(buf, "<address %sbus='%d' target='%d' unit='%d'/>\n",
                           includeTypeInAddr ? "type='scsi' " : "",
-                          scsisrc->bus, scsisrc->target, scsisrc->unit);
+                          scsihostsrc->bus, scsihostsrc->target,
+                          scsihostsrc->unit);
         break;
     default:
         virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ecb92b2..56f6735 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -415,14 +415,22 @@ struct _virDomainHostdevSubsysPCI {
     int backend; /* enum virDomainHostdevSubsysPCIBackendType */
 };
 
-typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI;
-typedef virDomainHostdevSubsysSCSI *virDomainHostdevSubsysSCSIPtr;
-struct _virDomainHostdevSubsysSCSI {
+typedef struct _virDomainHostdevSubsysSCSIHost virDomainHostdevSubsysSCSIHost;
+typedef virDomainHostdevSubsysSCSIHost *virDomainHostdevSubsysSCSIHostPtr;
+struct _virDomainHostdevSubsysSCSIHost {
     char *adapter;
     unsigned bus;
     unsigned target;
     unsigned unit;
+};
+
+typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI;
+typedef virDomainHostdevSubsysSCSI *virDomainHostdevSubsysSCSIPtr;
+struct _virDomainHostdevSubsysSCSI {
     int sgio; /* enum virDomainDeviceSGIO */
+    union {
+        virDomainHostdevSubsysSCSIHost host;
+    } u;
 };
 
 typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 9155b9a..3d69b09 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -306,10 +306,11 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
             }
             break;
 
-        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+            virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
             if ((scsi = virSCSIDeviceNew(NULL,
-                                         scsisrc->adapter, scsisrc->bus,
-                                         scsisrc->target, scsisrc->unit,
+                                         scsihostsrc->adapter, scsihostsrc->bus,
+                                         scsihostsrc->target, scsihostsrc->unit,
                                          dev->readonly,
                                          dev->shareable)) == NULL)
                 goto cleanup;
@@ -318,6 +319,8 @@ qemuSetupHostdevCGroup(virDomainObjPtr vm,
                                          qemuSetupHostSCSIDeviceCgroup,
                                          vm) < 0)
                 goto cleanup;
+            break;
+        }
 
         default:
             break;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c640e59..fa9c72f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5131,11 +5131,14 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
+    virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
     char *sg = NULL;
 
     sg = (callbacks->qemuGetSCSIDeviceSgName)(NULL,
-                                              scsisrc->adapter, scsisrc->bus,
-                                              scsisrc->target, scsisrc->unit);
+                                              scsihostsrc->adapter,
+                                              scsihostsrc->bus,
+                                              scsihostsrc->target,
+                                              scsihostsrc->unit);
     if (!sg)
         goto error;
 
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 9809883..9636a87 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -928,11 +928,12 @@ qemuAddSharedDevice(virQEMUDriverPtr driver,
             goto cleanup;
     } else {
         virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         if (!(dev_name = virSCSIDeviceGetDevName(NULL,
-                                                 scsisrc->adapter,
-                                                 scsisrc->bus,
-                                                 scsisrc->target,
-                                                 scsisrc->unit)))
+                                                 scsihostsrc->adapter,
+                                                 scsihostsrc->bus,
+                                                 scsihostsrc->target,
+                                                 scsihostsrc->unit)))
             goto cleanup;
 
         if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0)
@@ -1034,11 +1035,12 @@ qemuRemoveSharedDevice(virQEMUDriverPtr driver,
             goto cleanup;
     } else {
         virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         if (!(dev_name = virSCSIDeviceGetDevName(NULL,
-                                                 scsisrc->adapter,
-                                                 scsisrc->bus,
-                                                 scsisrc->target,
-                                                 scsisrc->unit)))
+                                                 scsihostsrc->adapter,
+                                                 scsihostsrc->bus,
+                                                 scsihostsrc->target,
+                                                 scsihostsrc->unit)))
             goto cleanup;
 
         if (virAsprintf(&dev_path, "/dev/%s", dev_name) < 0)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1807702..7df5832 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1574,10 +1574,11 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr driver,
     if (qemuPrepareHostdevSCSIDevices(driver, vm->def->name,
                                       &hostdev, 1)) {
         virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("Unable to prepare scsi hostdev: %s:%d:%d:%d"),
-                       scsisrc->adapter, scsisrc->bus,
-                       scsisrc->target, scsisrc->unit);
+                       scsihostsrc->adapter, scsihostsrc->bus,
+                       scsihostsrc->target, scsihostsrc->unit);
         return -1;
     }
 
@@ -3393,12 +3394,14 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
                                usbsrc->vendor, usbsrc->product);
             }
             break;
-        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+            virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
             virReportError(VIR_ERR_OPERATION_FAILED,
                            _("host scsi device %s:%d:%d.%d not found"),
-                           scsisrc->adapter, scsisrc->bus,
-                           scsisrc->target, scsisrc->unit);
+                           scsihostsrc->adapter, scsihostsrc->bus,
+                           scsihostsrc->target, scsihostsrc->unit);
             break;
+        }
         default:
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("unexpected hostdev type %d"), subsys->type);
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 7796121..a3f1025 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -870,10 +870,11 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
     }
 
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         virSCSIDevicePtr scsi =
             virSCSIDeviceNew(NULL,
-                             scsisrc->adapter, scsisrc->bus,
-                             scsisrc->target, scsisrc->unit,
+                             scsihostsrc->adapter, scsihostsrc->bus,
+                             scsihostsrc->target, scsihostsrc->unit,
                              dev->readonly, dev->shareable);
 
          if (!scsi)
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 968568e..08f5041 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -528,10 +528,11 @@ virSecurityDACSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
     }
 
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         virSCSIDevicePtr scsi =
             virSCSIDeviceNew(NULL,
-                             scsisrc->adapter, scsisrc->bus,
-                             scsisrc->target, scsisrc->unit,
+                             scsihostsrc->adapter, scsihostsrc->bus,
+                             scsihostsrc->target, scsihostsrc->unit,
                              dev->readonly, dev->shareable);
 
         if (!scsi)
@@ -645,10 +646,11 @@ virSecurityDACRestoreSecurityHostdevLabel(virSecurityManagerPtr mgr,
     }
 
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         virSCSIDevicePtr scsi =
             virSCSIDeviceNew(NULL,
-                             scsisrc->adapter, scsisrc->bus,
-                             scsisrc->target, scsisrc->unit,
+                             scsihostsrc->adapter, scsihostsrc->bus,
+                             scsihostsrc->target, scsihostsrc->unit,
                              dev->readonly, dev->shareable);
 
         if (!scsi)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index a33ab45..f32816f 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1367,10 +1367,11 @@ virSecuritySELinuxSetSecurityHostdevSubsysLabel(virDomainDefPtr def,
     }
 
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         virSCSIDevicePtr scsi =
             virSCSIDeviceNew(NULL,
-                             scsisrc->adapter, scsisrc->bus,
-                             scsisrc->target, scsisrc->unit,
+                             scsihostsrc->adapter, scsihostsrc->bus,
+                             scsihostsrc->target, scsihostsrc->unit,
                              dev->readonly, dev->shareable);
 
         if (!scsi)
@@ -1554,10 +1555,11 @@ virSecuritySELinuxRestoreSecurityHostdevSubsysLabel(virSecurityManagerPtr mgr,
     }
 
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
         virSCSIDevicePtr scsi =
             virSCSIDeviceNew(NULL,
-                             scsisrc->adapter, scsisrc->bus,
-                             scsisrc->target, scsisrc->unit,
+                             scsihostsrc->adapter, scsihostsrc->bus,
+                             scsihostsrc->target, scsihostsrc->unit,
                              dev->readonly, dev->shareable);
 
             if (!scsi)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 1e52cc9..83f85aa 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -938,17 +938,17 @@ virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr,
 
     virObjectLock(mgr->activeSCSIHostdevs);
     for (i = 0; i < nhostdevs; i++) {
-        virDomainHostdevSubsysSCSIPtr scsisrc;
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc;
         hostdev = hostdevs[i];
-        scsisrc = &hostdev->source.subsys.u.scsi;
+        scsihostsrc = &hostdev->source.subsys.u.scsi.u.host;
 
         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
             hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
             continue;
 
         if (!(scsi = virSCSIDeviceNew(NULL,
-                                      scsisrc->adapter, scsisrc->bus,
-                                      scsisrc->target, scsisrc->unit,
+                                      scsihostsrc->adapter, scsihostsrc->bus,
+                                      scsihostsrc->target, scsihostsrc->unit,
                                       hostdev->readonly, hostdev->shareable)))
             goto cleanup;
 
@@ -1219,8 +1219,8 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
     /* Loop 1: build temporary list */
     for (i = 0; i < nhostdevs; i++) {
         virDomainHostdevDefPtr hostdev = hostdevs[i];
-        virDomainHostdevSubsysSCSIPtr scsisrc =
-            &hostdev->source.subsys.u.scsi;
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
+            &hostdev->source.subsys.u.scsi.u.host;
         virSCSIDevicePtr scsi;
 
         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
@@ -1234,8 +1234,8 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr,
         }
 
         if (!(scsi = virSCSIDeviceNew(NULL,
-                                      scsisrc->adapter, scsisrc->bus,
-                                      scsisrc->target, scsisrc->unit,
+                                      scsihostsrc->adapter, scsihostsrc->bus,
+                                      scsihostsrc->target, scsihostsrc->unit,
                                       hostdev->readonly, hostdev->shareable)))
             goto cleanup;
 
@@ -1381,8 +1381,8 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
     virObjectLock(hostdev_mgr->activeSCSIHostdevs);
     for (i = 0; i < nhostdevs; i++) {
         virDomainHostdevDefPtr hostdev = hostdevs[i];
-        virDomainHostdevSubsysSCSIPtr scsisrc =
-            &hostdev->source.subsys.u.scsi;
+        virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
+            &hostdev->source.subsys.u.scsi.u.host;
         virSCSIDevicePtr scsi;
         virSCSIDevicePtr tmp;
 
@@ -1391,12 +1391,12 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
             continue;
 
         if (!(scsi = virSCSIDeviceNew(NULL,
-                                      scsisrc->adapter, scsisrc->bus,
-                                      scsisrc->target, scsisrc->unit,
+                                      scsihostsrc->adapter, scsihostsrc->bus,
+                                      scsihostsrc->target, scsihostsrc->unit,
                                       hostdev->readonly, hostdev->shareable))) {
             VIR_WARN("Unable to reattach SCSI device %s:%d:%d:%d on domain %s",
-                     scsisrc->adapter, scsisrc->bus, scsisrc->target,
-                     scsisrc->unit, dom_name);
+                     scsihostsrc->adapter, scsihostsrc->bus,
+                     scsihostsrc->target, scsihostsrc->unit, dom_name);
             continue;
         }
 
@@ -1406,15 +1406,15 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hostdev_mgr,
         if (!(tmp = virSCSIDeviceListFind(hostdev_mgr->activeSCSIHostdevs, scsi))) {
             VIR_WARN("Unable to find device %s:%d:%d:%d "
                      "in list of active SCSI devices",
-                     scsisrc->adapter, scsisrc->bus,
-                     scsisrc->target, scsisrc->unit);
+                     scsihostsrc->adapter, scsihostsrc->bus,
+                     scsihostsrc->target, scsihostsrc->unit);
             virSCSIDeviceFree(scsi);
             continue;
         }
 
         VIR_DEBUG("Removing %s:%d:%d:%d dom=%s from activeSCSIHostdevs",
-                   scsisrc->adapter, scsisrc->bus, scsisrc->target,
-                   scsisrc->unit, dom_name);
+                   scsihostsrc->adapter, scsihostsrc->bus,
+                   scsihostsrc->target, scsihostsrc->unit, dom_name);
 
         virSCSIDeviceListDel(hostdev_mgr->activeSCSIHostdevs, tmp,
                              drv_name, dom_name);
-- 
1.9.3

--
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]