Blame SOURCES/libvirt-domain_conf-Make-virDomainDeviceFindSCSIController-accept-virDomainDeviceDriveAddress-struct.patch

25aafc
From 62bd04e98582005d38a17850afbd25465015ae1b Mon Sep 17 00:00:00 2001
25aafc
Message-Id: <62bd04e98582005d38a17850afbd25465015ae1b@dist-git>
25aafc
From: Michal Privoznik <mprivozn@redhat.com>
25aafc
Date: Thu, 24 Oct 2019 08:45:49 +0200
25aafc
Subject: [PATCH] domain_conf: Make virDomainDeviceFindSCSIController accept
25aafc
 virDomainDeviceDriveAddress struct
25aafc
MIME-Version: 1.0
25aafc
Content-Type: text/plain; charset=UTF-8
25aafc
Content-Transfer-Encoding: 8bit
25aafc
25aafc
So far, the virDomainDeviceFindSCSIController() takes
25aafc
virDomainDeviceInfo structure which is an overkill. It assumes
25aafc
that the passed structure is type of
25aafc
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE which is not obvious.
25aafc
25aafc
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
25aafc
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
25aafc
(cherry picked from commit 9cddc6e8ee9d9ce62dd20a6317c3148f4cd1c0e9)
25aafc
25aafc
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1741782
25aafc
25aafc
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
25aafc
Message-Id: <ee6d546175c25f26c3f95fd5bc4de47be66ae603.1571899509.git.mprivozn@redhat.com>
25aafc
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
25aafc
---
25aafc
 src/conf/domain_conf.c         | 6 +++---
25aafc
 src/conf/domain_conf.h         | 2 +-
25aafc
 src/qemu/qemu_domain_address.c | 2 +-
25aafc
 src/vbox/vbox_common.c         | 2 +-
25aafc
 4 files changed, 6 insertions(+), 6 deletions(-)
25aafc
25aafc
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
25aafc
index 60f426df04..333d9836c1 100644
25aafc
--- a/src/conf/domain_conf.c
25aafc
+++ b/src/conf/domain_conf.c
25aafc
@@ -8235,13 +8235,13 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node ATTRIBUTE_UNUSED,
25aafc
 
25aafc
 virDomainControllerDefPtr
25aafc
 virDomainDeviceFindSCSIController(const virDomainDef *def,
25aafc
-                                  virDomainDeviceInfoPtr info)
25aafc
+                                  const virDomainDeviceDriveAddress *addr)
25aafc
 {
25aafc
     size_t i;
25aafc
 
25aafc
     for (i = 0; i < def->ncontrollers; i++) {
25aafc
         if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
25aafc
-            def->controllers[i]->idx == info->addr.drive.controller)
25aafc
+            def->controllers[i]->idx == addr->controller)
25aafc
             return def->controllers[i];
25aafc
     }
25aafc
 
25aafc
@@ -18606,7 +18606,7 @@ virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def)
25aafc
              * So let's grab the model from it and update the model we're
25aafc
              * going to add as long as this one isn't undefined. The premise
25aafc
              * being keeping the same controller model for all SCSI hostdevs. */
25aafc
-            cont = virDomainDeviceFindSCSIController(def, hostdev->info);
25aafc
+            cont = virDomainDeviceFindSCSIController(def, &hostdev->info->addr.drive);
25aafc
             if (cont && cont->model != -1)
25aafc
                 newModel = cont->model;
25aafc
         }
25aafc
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
25aafc
index ef8f061ae2..5eb9b257a7 100644
25aafc
--- a/src/conf/domain_conf.h
25aafc
+++ b/src/conf/domain_conf.h
25aafc
@@ -2866,7 +2866,7 @@ int virDomainDiskGetFormat(virDomainDiskDefPtr def);
25aafc
 void virDomainDiskSetFormat(virDomainDiskDefPtr def, int format);
25aafc
 virDomainControllerDefPtr
25aafc
 virDomainDeviceFindSCSIController(const virDomainDef *def,
25aafc
-                                  virDomainDeviceInfoPtr info);
25aafc
+                                  const virDomainDeviceDriveAddress *addr);
25aafc
 virDomainDiskDefPtr virDomainDiskFindByBusAndDst(virDomainDefPtr def,
25aafc
                                                  int bus,
25aafc
                                                  char *dst);
25aafc
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
25aafc
index 0cb5af4a87..4f0278d348 100644
25aafc
--- a/src/qemu/qemu_domain_address.c
25aafc
+++ b/src/qemu/qemu_domain_address.c
25aafc
@@ -113,7 +113,7 @@ qemuDomainFindSCSIControllerModel(const virDomainDef *def,
25aafc
 {
25aafc
     virDomainControllerDefPtr cont;
25aafc
 
25aafc
-    if (!(cont = virDomainDeviceFindSCSIController(def, info))) {
25aafc
+    if (!(cont = virDomainDeviceFindSCSIController(def, &info->addr.drive))) {
25aafc
         virReportError(VIR_ERR_INTERNAL_ERROR,
25aafc
                        _("unable to find a SCSI controller for idx=%d"),
25aafc
                        info->addr.drive.controller);
25aafc
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
25aafc
index eed7c83913..fe3c3ab2aa 100644
25aafc
--- a/src/vbox/vbox_common.c
25aafc
+++ b/src/vbox/vbox_common.c
25aafc
@@ -1118,7 +1118,7 @@ vboxAttachDrives(virDomainDefPtr def, vboxDriverPtr data, IMachine *machine)
25aafc
         case VIR_DOMAIN_DISK_BUS_SCSI:
25aafc
             VBOX_UTF8_TO_UTF16(VBOX_CONTROLLER_SCSI_NAME, &storageCtlName);
25aafc
 
25aafc
-            cont = virDomainDeviceFindSCSIController(def, &disk->info);
25aafc
+            cont = virDomainDeviceFindSCSIController(def, &disk->info.addr.drive);
25aafc
             if (cont && cont->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068) {
25aafc
                 VBOX_UTF16_FREE(storageCtlName);
25aafc
                 VBOX_UTF8_TO_UTF16(VBOX_CONTROLLER_SAS_NAME, &storageCtlName);
25aafc
-- 
25aafc
2.23.0
25aafc