
On 02/03/2015 06:55 AM, Shivaprasad G Bhat wrote:
fc_host & vport_ops devices are SCSI devices with additional capabilities. Mere string comparison of basic types is not sufficient in this case. This patch introduces additional capability checks for SCSI devices if the user is looking to list 'fc_host' or 'vport_ops' devices.
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com> --- src/conf/node_device_conf.c | 8 ++++++++ 1 file changed, 8 insertions(+)
While this does work and more or less follows what was done for virNodeDeviceCapMatch, I'm wondering if the 'fc_host' and 'vports_ops' capabilities need to also be returned in a "list" of capabilities for a node device That is I see that virNodeDeviceListCaps() seems to be only returning 1 capability for every device. However, for the scsi_host, it has those additional fc_host and vport_ops capabilities which if returned in the list would then be "found" by the python listDevices code which for some devices (like the scsi_host here) there may be more than one way to "get at" the information. I'm investigating whether modifying nodeDeviceListCaps() in src/node_device/node_device_driver.c to add "fc_host" and "vport_ops" to the return caps_list will resolve the issue... This also means virNodeDeviceNumOfCaps() (and it's driver API nodeDeviceNumOfCaps) will need some tweaking too. Another option would be to fix the libvirt-python code to use ListAllDevices with the flags argument like virsh does. John
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 03b88a2..ab27829 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -78,6 +78,14 @@ int virNodeDeviceHasCap(const virNodeDeviceObj *dev, const char *cap) while (caps) { if (STREQ(cap, virNodeDevCapTypeToString(caps->type))) return 1; + else if (caps->type == VIR_NODE_DEV_CAP_SCSI_HOST) + if ((STREQ(cap, "fc_host") && + (caps->data.scsi_host.flags & + VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST)) || + (STREQ(cap, "vport_ops") && + (caps->data.scsi_host.flags & + VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS))) + return 1; caps = caps->next; } return 0;
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list