Ondřej Svoboda has uploaded a new change for review.
Change subject: netinfo: Hacked InfiniBand speed.
......................................................................
netinfo: Hacked InfiniBand speed.
Currently, the kernel errors out with EINVAL when
reading the speed of ib* devices. Report a speed
of 10000 for them.
Change-Id: I55089558d59d33da7f44a2f6d7059d291c064f8a
Bug-Url:
https://bugzilla.redhat.com/1103469
Signed-off-by: Ondřej Svoboda <osvoboda(a)redhat.com>
---
M lib/vdsm/netinfo.py
1 file changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/02/28502/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index cfcc5ef..2625470 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -274,6 +274,14 @@
return speed
+def _ibHackedSpeed(nicName):
+ """If the nic is an InfiniBand device, return a speed of 10000
Mbps."""
+ with open('/sys/class/net/%s/addr_len' % nicName) as addrFile:
+ if int(addrFile.read()) == 20:
+ return 10000
+ return 0
+
+
def nicSpeed(nicName):
"""Returns the nic speed if it is a legal value and nicName refers to
a
nic, 0 otherwise."""
@@ -289,7 +297,9 @@
if s not in (2 ** 16 - 1, 2 ** 32 - 1) or s > 0:
return s
except IOError as ose:
- if ose.errno != errno.EINVAL:
+ if ose.errno == errno.EINVAL:
+ return _ibHackedSpeed(nicName)
+ else:
logging.exception('cannot read %s nic speed', nicName)
except Exception:
logging.exception('cannot read %s speed', nicName)
--
To view, visit
http://gerrit.ovirt.org/28502
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I55089558d59d33da7f44a2f6d7059d291c064f8a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda(a)redhat.com>