[PATCH v2 05/12] conf: Add check for host address type while checking in use

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

 



While searching the hostdevs the drive type can be either *_TYPE_DRIVE
or *_TYPE_NONE.  If the type is _TYPE_NONE on the first scsi_host, then
there is an erroneous "match" that the address already exists.

Although this works by chance currently because hostdev's are added one
at a time and 'nhostdevs' would be zero, thus returning false for the
first hostdev added, a future patch will move the hostdev address
assignment into post processing resulting in the bad match.

This code is only called by path's expecting either drive or none.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6dbe05e..80daba9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3885,7 +3885,8 @@ virDomainDriveAddressIsUsedByHostdev(const virDomainDef *def,
     for (i = 0; i < def->nhostdevs; i++) {
         hostdev = def->hostdevs[i];
 
-        if (hostdev->source.subsys.type != type)
+        if (hostdev->source.subsys.type != type ||
+            hostdev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE)
             continue;
 
         if (hostdev->info->addr.drive.controller == controller &&
-- 
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]