[libvirt] [PATCH] check "fc_host" and "vport_ops" capabilities in SCSI host nodedevs

Shivaprasad G Bhat shivaprasadbhat at gmail.com
Tue Feb 3 11:55:16 UTC 2015


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 at linux.vnet.ibm.com>
---
 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;




More information about the libvir-list mailing list