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 <[email protected]>
---
 src/conf/node_device_conf.c |    8 ++++++++
 1 file changed, 8 insertions(+)

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
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to