render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
Pablo Greco 40546a
From dce9613ddab9d780ce9aabeb9a084ffec307899c Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <dce9613ddab9d780ce9aabeb9a084ffec307899c@dist-git>
Pablo Greco 40546a
From: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Date: Mon, 20 May 2019 10:12:55 +0200
Pablo Greco 40546a
Subject: [PATCH] util: skip RDMA detection for non-PCI network devices
Pablo Greco 40546a
Pablo Greco 40546a
Only PCI devices have '/sys/class/net/<ifname>/device/resource' so we
Pablo Greco 40546a
need to skip this check for all other network devices.
Pablo Greco 40546a
Pablo Greco 40546a
Without this patch and RDMA enabled libvirt will not detect any network
Pablo Greco 40546a
device that doesn't have the path above which includes 'lo', 'virbr',
Pablo Greco 40546a
'tun', etc.
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1639258
Pablo Greco 40546a
Pablo Greco 40546a
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
(cherry picked from commit f38ef0fac0582ac0cbb749af9d3f8ba515a6084a)
Pablo Greco 40546a
Pablo Greco 40546a
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1693299
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Pablo Greco 40546a
Message-Id: <5d2c32fd3f2d7e3f9664d395c00cdfc942c738ce.1558339954.git.phrdina@redhat.com>
Pablo Greco 40546a
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/virnetdev.c | 8 +++++++-
Pablo Greco 40546a
 1 file changed, 7 insertions(+), 1 deletion(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
Pablo Greco 40546a
index b250af9e2c..9ca3ce69bc 100644
Pablo Greco 40546a
--- a/src/util/virnetdev.c
Pablo Greco 40546a
+++ b/src/util/virnetdev.c
Pablo Greco 40546a
@@ -3016,8 +3016,14 @@ virNetDevRDMAFeature(const char *ifname,
Pablo Greco 40546a
 
Pablo Greco 40546a
     if (virAsprintf(&eth_devpath, SYSFS_NET_DIR "%s/device/resource", ifname) < 0)
Pablo Greco 40546a
         goto cleanup;
Pablo Greco 40546a
-    if (!virFileExists(eth_devpath))
Pablo Greco 40546a
+
Pablo Greco 40546a
+    /* If /sys/class/net/<ifname>/device/resource doesn't exist it is not a PCI
Pablo Greco 40546a
+     * device and therefore it will not have RDMA. */
Pablo Greco 40546a
+    if (!virFileExists(eth_devpath)) {
Pablo Greco 40546a
+        ret = 0;
Pablo Greco 40546a
         goto cleanup;
Pablo Greco 40546a
+    }
Pablo Greco 40546a
+
Pablo Greco 40546a
     if (virFileReadAll(eth_devpath, RESOURCE_FILE_LEN, &eth_res_buf) < 0)
Pablo Greco 40546a
         goto cleanup;
Pablo Greco 40546a
 
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a