Dan Kenigsberg has uploaded a new change for review.

Change subject: vm iface statistics: never report negative rates
......................................................................

vm iface statistics: never report negative rates

When Linux tx/rx couters overflow their 32 bit limit, they wrap back to
zero. This causes our reported rxRate/txRate to become negative for one
nample. 51073875161d9b932b7

Change-Id: I40daeb12172a7f54f135b3018405ef228983fa93
Signed-off-by: Dan Kenigsberg <[email protected]>
---
M vdsm/vm.py
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/23598/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index 7c2d496..c40a78d 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -609,10 +609,12 @@
                 ifStats['txDropped'] = str(eInfo[nic.name][7])
 
                 ifRxBytes = (100.0 *
-                             (eInfo[nic.name][0] - sInfo[nic.name][0]) /
+                             (eInfo[nic.name][0] - sInfo[nic.name][0]) %
+                             2 ** 32 /
                              sampleInterval / ifSpeed / self.MBPS_TO_BPS)
                 ifTxBytes = (100.0 *
-                             (eInfo[nic.name][4] - sInfo[nic.name][4]) /
+                             (eInfo[nic.name][4] - sInfo[nic.name][4]) %
+                             2 ** 32 /
                              sampleInterval / ifSpeed / self.MBPS_TO_BPS)
 
                 ifStats['rxRate'] = '%.1f' % ifRxBytes


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40daeb12172a7f54f135b3018405ef228983fa93
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to