Commit id 'ac3ed2085' causes 'virsh nodedev-list --cap net' to fail
on any system without SYSFS_INFINIBAND_DIR (/sys/class/infiniband).

Rather than assume it's there and fail on the attempt to open the
non-existent directory, check if it's there - if not, return
success and move on.

As reported by Suren Hajyan <[email protected]> from run of unit tests

Signed-off-by: John Ferlan <[email protected]>
---
 src/util/virnetdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 7d91e2c..eb6a9fb 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2976,6 +2976,9 @@ virNetDevRDMAFeature(const char *ifname,
     struct dirent *dp;
     int ret = -1;
 
+    if (!virFileExists(SYSFS_INFINIBAND_DIR))
+        return 0;
+
     if (!(dirp = opendir(SYSFS_INFINIBAND_DIR))) {
         virReportSystemError(errno,
                              _("Failed to opendir path '%s'"),
-- 
2.1.0

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to