nodedev: Need to check for vport capable scsi_host for vHBA searches

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>
This commit is contained in:
John Ferlan 2017-05-16 13:21:32 -04:00
parent 9c9a12ca31
commit 51ed8907a3

View File

@ -165,7 +165,8 @@ virNodeDeviceFindByWWNs(virNodeDeviceObjListPtr devs,
virNodeDeviceObjLock(devs->objs[i]); virNodeDeviceObjLock(devs->objs[i]);
if ((cap = virNodeDeviceFindFCCapDef(devs->objs[i])) && if ((cap = virNodeDeviceFindFCCapDef(devs->objs[i])) &&
STREQ_NULLABLE(cap->data.scsi_host.wwnn, parent_wwnn) && 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]; return devs->objs[i];
virNodeDeviceObjUnlock(devs->objs[i]); virNodeDeviceObjUnlock(devs->objs[i]);
} }
@ -184,7 +185,8 @@ virNodeDeviceFindByFabricWWN(virNodeDeviceObjListPtr devs,
virNodeDevCapsDefPtr cap; virNodeDevCapsDefPtr cap;
virNodeDeviceObjLock(devs->objs[i]); virNodeDeviceObjLock(devs->objs[i]);
if ((cap = virNodeDeviceFindFCCapDef(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]; return devs->objs[i];
virNodeDeviceObjUnlock(devs->objs[i]); virNodeDeviceObjUnlock(devs->objs[i]);
} }