Hello Antoni Segura Puimedon, Francesco Romani,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/29643
to review the following change.
Change subject: HostStats: recalculate total line rate every time
......................................................................
HostStats: recalculate total line rate every time
This should have been done when we started supporting host plugging in
commit b7b29e6.
Change-Id: Iad7f7eb1922967e2e8174b2b2a25f06fbf4c7d50
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
Reviewed-on:
http://gerrit.ovirt.org/29469
Reviewed-by: Francesco Romani <fromani(a)redhat.com>
Reviewed-by: Antoni Segura Puimedon <asegurap(a)redhat.com>
---
M vdsm/virt/sampling.py
1 file changed, 4 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/29643/1
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 3b91cee..4ef9890 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -450,8 +450,6 @@
self._stopEvent = threading.Event()
self._samples = []
self._updateIfidsIfrates()
- # in bytes-per-second
- self._lineRate = (sum(self._ifrates) or 1000) * (10 ** 6) / 8
self._lastSampleTime = time.time()
self._pid = os.getpid()
@@ -631,8 +629,10 @@
tx += thisTx
rxDropped += hs1.interfaces[ifid].rxDropped
txDropped += hs1.interfaces[ifid].txDropped
- stats['rxRate'] = 100.0 * rx / interval / self._lineRate
- stats['txRate'] = 100.0 * tx / interval / self._lineRate
+
+ total_bytes_per_sec = (sum(self._ifrates) or 1000) * (10 ** 6) / 8
+ stats['rxRate'] = 100.0 * rx / interval / total_bytes_per_sec
+ stats['txRate'] = 100.0 * tx / interval / total_bytes_per_sec
if stats['txRate'] > 100 or stats['rxRate'] > 100:
stats['txRate'] = min(stats['txRate'], 100.0)
stats['rxRate'] = min(stats['rxRate'], 100.0)
--
To view, visit
http://gerrit.ovirt.org/29643
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iad7f7eb1922967e2e8174b2b2a25f06fbf4c7d50
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>