[PATCH] nodeinfo: Check for SYSFS_INFINIBAND_DIR before open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <shajyan@xxxxxxxxxx> from run of unit tests

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 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
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]