Change in vdsm[ovirt-3.3]: vm iface statistics: never report negative rates

danken at redhat.com danken at redhat.com
Tue Feb 11 12:33:39 UTC 2014


Hello Yaniv Bronhaim, Ondřej Svoboda, Antoni Segura Puimedon,

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

    http://gerrit.ovirt.org/24322

to review the following change.

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

Bug-Url: https://bugzilla.redhat.com/1062166
Change-Id: I40daeb12172a7f54f135b3018405ef228983fa93
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/23598
Tested-by: Ondřej Svoboda <osvoboda at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/24152
Reviewed-by: Antoni Segura Puimedon <asegurap at redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M vdsm/vm.py
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/vdsm/vm.py b/vdsm/vm.py
index bb35f0e..3534699 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -616,10 +616,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/24322
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40daeb12172a7f54f135b3018405ef228983fa93
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list