render / rpms / libvirt

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