Change in vdsm[ovirt-3.3]: vm iface stats: fix arithmetic

danken at redhat.com danken at redhat.com
Tue Mar 25 17:34:56 UTC 2014


Dan Kenigsberg has uploaded a new change for review.

Change subject: vm iface stats: fix arithmetic
......................................................................

vm iface stats: fix arithmetic

My commit 672ff43 has a serious arithmetic flaw: the modulu must be
taken on the sample difference!

Bug-Url: https://bugzilla.redhat.com/1062166
Change-Id: Ie356d5f96c73b65925b38f6149d5eb36f43023ad
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/25960
Reviewed-by: Antoni Segura Puimedon <asegurap at redhat.com>
Tested-by: Martin Pavlik <xpavli44 at gmail.com>
(cherry picked from commit d0c9357bbf6b6c61dc633edba6691a53b592e895)
---
M vdsm/vm.py
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/91/26091/1

diff --git a/vdsm/vm.py b/vdsm/vm.py
index 529b1bc..debc874 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -618,12 +618,12 @@
                 ifStats['txDropped'] = str(eInfo[nic.name][7])
 
                 ifRxBytes = (100.0 *
-                             (eInfo[nic.name][0] - sInfo[nic.name][0]) %
-                             2 ** 32 /
+                             ((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]) %
-                             2 ** 32 /
+                             ((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/26091
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie356d5f96c73b65925b38f6149d5eb36f43023ad
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list