]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nodedev: Need to check for vport capable scsi_host for vHBA searches
authorJohn Ferlan <jferlan@redhat.com>
Tue, 16 May 2017 17:21:32 +0000 (13:21 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Sat, 3 Jun 2017 12:34:34 +0000 (08:34 -0400)
When searching for an NPIV capable fc_host, not only does there need to
be an "fc_host" capability with the specified wwnn/wwpn or fabric_wwn,
but that scsi_host must be vport capable; otherwise, one could end up
picking an exising vHBA/NPIV which wouldn't be good.

Currently not a problem since scsi_hosts are in an as found forward linked
list and the vport capable scsi_hosts will always appear before a vHBA by
definition. However, in the near term future a hash table will be used to
lookup the devices and that could cause problems for these algorithms.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/conf/virnodedeviceobj.c

index d460f26ec4abd48bfe277fb8e74f4dd2aa11c113..65c776eceaeb965900e24aa071445033fadf9a56 100644 (file)
@@ -165,7 +165,8 @@ virNodeDeviceFindByWWNs(virNodeDeviceObjListPtr devs,
         virNodeDeviceObjLock(devs->objs[i]);
         if ((cap = virNodeDeviceFindFCCapDef(devs->objs[i])) &&
             STREQ_NULLABLE(cap->data.scsi_host.wwnn, parent_wwnn) &&
-            STREQ_NULLABLE(cap->data.scsi_host.wwpn, parent_wwpn))
+            STREQ_NULLABLE(cap->data.scsi_host.wwpn, parent_wwpn) &&
+            virNodeDeviceFindVPORTCapDef(devs->objs[i]))
             return devs->objs[i];
         virNodeDeviceObjUnlock(devs->objs[i]);
     }
@@ -184,7 +185,8 @@ virNodeDeviceFindByFabricWWN(virNodeDeviceObjListPtr devs,
         virNodeDevCapsDefPtr cap;
         virNodeDeviceObjLock(devs->objs[i]);
         if ((cap = virNodeDeviceFindFCCapDef(devs->objs[i])) &&
-            STREQ_NULLABLE(cap->data.scsi_host.fabric_wwn, parent_fabric_wwn))
+            STREQ_NULLABLE(cap->data.scsi_host.fabric_wwn, parent_fabric_wwn) &&
+            virNodeDeviceFindVPORTCapDef(devs->objs[i]))
             return devs->objs[i];
         virNodeDeviceObjUnlock(devs->objs[i]);
     }