Hello Antoni Segura Puimedon, Francesco Romani,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/30522

to review the following change.

Change subject: connectivty log: log duplex state
......................................................................

connectivty log: log duplex state

Add detected changes of full/half duplex to connectivity.log

Bug-Url: https://bugzilla.redhat.com/1111234
Change-Id: I29745f7e6400cff9f0450273047480221e4e363e
Signed-off-by: Dan Kenigsberg <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/30225
Reviewed-by: Francesco Romani <[email protected]>
Reviewed-by: Antoni Segura Puimedon <[email protected]>
---
M vdsm/virt/sampling.py
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/30522/1

diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 3479eee..1d183a2 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -110,8 +110,9 @@
         self.txErrors = self.readIfaceStat(ifid, 'tx_errors')
         self.operstate = self.readIfaceOperstate(ifid)
         self.speed = _getLinkSpeed(link)
+        self.duplex = _getDuplex(ifid)
 
-    _LOGGED_ATTRS = ('operstate', 'speed')
+    _LOGGED_ATTRS = ('operstate', 'speed', 'duplex')
 
     def _log_attrs(self, attrs):
         return ' '.join(
@@ -670,3 +671,13 @@
     else:
         speed = 0
     return speed
+
+
+def _getDuplex(ifid):
+    """Return whether a device is connected in full-duplex. Return 'unknown' if
+    duplex state is not known"""
+    try:
+        with open('/sys/class/net/%s/duplex' % ifid) as src:
+            return src.read().strip()
+    except IOError:
+        return 'unknown'


-- 
To view, visit http://gerrit.ovirt.org/30522
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29745f7e6400cff9f0450273047480221e4e363e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to