]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Add check for host address type while checking in use
authorJohn Ferlan <jferlan@redhat.com>
Tue, 21 Jul 2015 21:00:00 +0000 (17:00 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 3 Aug 2015 20:48:45 +0000 (16:48 -0400)
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@redhat.com>
src/conf/domain_conf.c

index 14dcdb48c550175ca5c64bb4a89e7c053036fdc7..a903338d95a6b5268f002bb42277d86d0d3ff012 100644 (file)
@@ -3917,7 +3917,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 &&