[libvirt] [PATCH 4/8] hostdev: Introduce virDomainHostdevSubsysSCSIHost

John Ferlan jferlan at redhat.com
Fri Jul 11 12:35:33 UTC 2014


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 at redhat.com>
---
 src/conf/domain_audit.c          |  8 +++---
 src/conf/domain_conf.c           | 58 ++++++++++++++++++++++++----------------
 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(+), 75 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 e38771c..55c0822 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1733,7 +1733,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;
     }
 }
@@ -4018,16 +4018,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")) {
@@ -4047,19 +4047,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;
@@ -4073,7 +4074,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;
@@ -4105,6 +4106,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.
  */
@@ -4343,7 +4351,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;
 
@@ -10136,16 +10144,18 @@ virDomainHostdevMatchSubsysPCI(virDomainHostdevDefPtr a,
 }
 
 static int
-virDomainHostdevMatchSubsysSCSI(virDomainHostdevDefPtr a,
-                                virDomainHostdevDefPtr b)
-{
-    virDomainHostdevSubsysSCSIPtr ascsisrc = &a->source.subsys.u.scsi;
-    virDomainHostdevSubsysSCSIPtr bscsisrc = &b->source.subsys.u.scsi;
-
-    if (STREQ(ascsisrc->adapter, bscsisrc->adapter) &&
-        ascsisrc->bus == bscsisrc->bus &&
-        ascsisrc->target == bscsisrc->target &&
-        ascsisrc->unit == bscsisrc->unit)
+virDomainHostdevMatchSubsysSCSIHost(virDomainHostdevDefPtr a,
+                                    virDomainHostdevDefPtr b)
+{
+    virDomainHostdevSubsysSCSIHostPtr ascsihostsrc =
+        &a->source.subsys.u.scsi.u.host;
+    virDomainHostdevSubsysSCSIHostPtr bscsihostsrc =
+        &b->source.subsys.u.scsi.u.host;
+
+    if (STREQ(ascsihostsrc->adapter, bscsihostsrc->adapter) &&
+        ascsihostsrc->bus == bscsihostsrc->bus &&
+        ascsihostsrc->target == bscsihostsrc->target &&
+        ascsihostsrc->unit == bscsihostsrc->unit)
         return 1;
     return 0;
 }
@@ -10163,7 +10173,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;
 }
@@ -15495,6 +15505,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) {
@@ -15563,10 +15574,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 273be7b..e9a4214 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -409,14 +409,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 0f95cbc..9a5459b 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 d990b6a..dbdb871 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5126,11 +5126,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 93841d1..40c667e 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -859,10 +859,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




More information about the libvir-list mailing list