[PATCH v2 1/2] domain_conf: Make virDomainDeviceFindSCSIController accept virDomainDeviceDriveAddress struct

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

 



So far, the virDomainDeviceFindSCSIController() takes
virDomainDeviceInfo structure which is an overkill. It assumes
that the passed structure is type of
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE which is not obvious.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/domain_conf.c         | 6 +++---
 src/conf/domain_conf.h         | 2 +-
 src/qemu/qemu_domain_address.c | 2 +-
 src/vbox/vbox_common.c         | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3dc638f0de..69c486f382 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8542,13 +8542,13 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node ATTRIBUTE_UNUSED,
 
 virDomainControllerDefPtr
 virDomainDeviceFindSCSIController(const virDomainDef *def,
-                                  virDomainDeviceInfoPtr info)
+                                  const virDomainDeviceDriveAddress *addr)
 {
     size_t i;
 
     for (i = 0; i < def->ncontrollers; i++) {
         if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
-            def->controllers[i]->idx == info->addr.drive.controller)
+            def->controllers[i]->idx == addr->controller)
             return def->controllers[i];
     }
 
@@ -18527,7 +18527,7 @@ virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def)
              * So let's grab the model from it and update the model we're
              * going to add as long as this one isn't undefined. The premise
              * being keeping the same controller model for all SCSI hostdevs. */
-            cont = virDomainDeviceFindSCSIController(def, hostdev->info);
+            cont = virDomainDeviceFindSCSIController(def, &hostdev->info->addr.drive);
             if (cont && cont->model != -1)
                 newModel = cont->model;
         }
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 82631ecb07..93de663cc1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2832,7 +2832,7 @@ int virDomainDiskGetFormat(virDomainDiskDefPtr def);
 void virDomainDiskSetFormat(virDomainDiskDefPtr def, int format);
 virDomainControllerDefPtr
 virDomainDeviceFindSCSIController(const virDomainDef *def,
-                                  virDomainDeviceInfoPtr info);
+                                  const virDomainDeviceDriveAddress *addr);
 virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
                                                  int bus,
                                                  char *dst);
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 216ba6235e..ce117e1669 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -111,7 +111,7 @@ qemuDomainFindSCSIControllerModel(const virDomainDef *def,
 {
     virDomainControllerDefPtr cont;
 
-    if (!(cont = virDomainDeviceFindSCSIController(def, info))) {
+    if (!(cont = virDomainDeviceFindSCSIController(def, &info->addr.drive))) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("unable to find a SCSI controller for idx=%d"),
                        info->addr.drive.controller);
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index ddabcb80ca..749c1b807d 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -1121,7 +1121,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
         case VIR_DOMAIN_DISK_BUS_SCSI:
             VBOX_UTF8_TO_UTF16(VBOX_CONTROLLER_SCSI_NAME, &storageCtlName);
 
-            cont = virDomainDeviceFindSCSIController(def, &disk->info);
+            cont = virDomainDeviceFindSCSIController(def, &disk->info.addr.drive);
             if (cont && cont->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068) {
                 VBOX_UTF16_FREE(storageCtlName);
                 VBOX_UTF8_TO_UTF16(VBOX_CONTROLLER_SAS_NAME, &storageCtlName);
-- 
2.21.0

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