[PATCH 2/5] conf: Add 'bus' and 'target' to SCSI address conflict checks

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

 



Modify virDomainDriveAddressIsUsedBy{Disk|Hostdev} and
virDomainSCSIDriveAddressIsUsed to take 'bus' and 'target'
parameters.  Will be used by future patches for more complete
address conflict checks

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ce5093d..3205c43 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5183,6 +5183,8 @@ static bool
 virDomainDriveAddressIsUsedByDisk(const virDomainDef *def,
                                   virDomainDiskBus type,
                                   unsigned int controller,
+                                  unsigned int bus,
+                                  unsigned int target,
                                   unsigned int unit)
 {
     virDomainDiskDefPtr disk;
@@ -5197,8 +5199,8 @@ virDomainDriveAddressIsUsedByDisk(const virDomainDef *def,
 
         if (disk->info.addr.drive.controller == controller &&
             disk->info.addr.drive.unit == unit &&
-            disk->info.addr.drive.bus == 0 &&
-            disk->info.addr.drive.target == 0)
+            disk->info.addr.drive.bus == bus &&
+            disk->info.addr.drive.target == target)
             return true;
     }
 
@@ -5212,6 +5214,8 @@ static bool
 virDomainDriveAddressIsUsedByHostdev(const virDomainDef *def,
                                      virDomainHostdevSubsysType type,
                                      unsigned int controller,
+                                     unsigned int bus,
+                                     unsigned int target,
                                      unsigned int unit)
 {
     virDomainHostdevDefPtr hostdev;
@@ -5225,8 +5229,8 @@ virDomainDriveAddressIsUsedByHostdev(const virDomainDef *def,
 
         if (hostdev->info->addr.drive.controller == controller &&
             hostdev->info->addr.drive.unit == unit &&
-            hostdev->info->addr.drive.bus == 0 &&
-            hostdev->info->addr.drive.target == 0)
+            hostdev->info->addr.drive.bus == bus &&
+            hostdev->info->addr.drive.target == target)
             return true;
     }
 
@@ -5236,6 +5240,8 @@ virDomainDriveAddressIsUsedByHostdev(const virDomainDef *def,
 static bool
 virDomainSCSIDriveAddressIsUsed(const virDomainDef *def,
                                 unsigned int controller,
+                                unsigned int bus,
+                                unsigned int target,
                                 unsigned int unit)
 {
     /* In current implementation, the maximum unit number of a controller
@@ -5245,9 +5251,10 @@ virDomainSCSIDriveAddressIsUsed(const virDomainDef *def,
         return true;
 
     if (virDomainDriveAddressIsUsedByDisk(def, VIR_DOMAIN_DISK_BUS_SCSI,
-                                          controller, unit) ||
-        virDomainDriveAddressIsUsedByHostdev(def, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
-                                             controller, unit))
+                                          controller, bus, target, unit) ||
+        virDomainDriveAddressIsUsedByHostdev(def,
+                                             VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
+                                             controller, bus, target, unit))
         return true;
 
     return false;
@@ -5262,7 +5269,8 @@ virDomainControllerSCSINextUnit(const virDomainDef *def,
     size_t i;
 
     for (i = 0; i < max_unit; i++) {
-        if (!virDomainSCSIDriveAddressIsUsed(def, controller, i))
+        /* Default to assigning addresses using bus = target = 0 */
+        if (!virDomainSCSIDriveAddressIsUsed(def, controller, 0, 0, i))
             return i;
     }
 
-- 
2.1.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]