render / rpms / libvirt

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