Change in vdsm[master]: Rounding up swap usage

ybronhei at redhat.com ybronhei at redhat.com
Sun Sep 14 16:41:31 UTC 2014


Yaniv Bronhaim has uploaded a new change for review.

Change subject: Rounding up swap usage
......................................................................

Rounding up swap usage

While dividing swap memory in 1024 we cut the floating number and round
it down. This patch rounds the value up.

Change-Id: I7eb33f0f003f7442efb103f43bbc60c5faa6a439
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1135909
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M vdsm/API.py
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/32911/1

diff --git a/vdsm/API.py b/vdsm/API.py
index eeb813c..3d5daf9 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -29,6 +29,7 @@
 import threading
 import logging
 import errno
+import math
 
 from network.errors import ConfigNetworkError
 from network.errors import ERR_BAD_NIC
@@ -1298,7 +1299,8 @@
 
         def _readSwapTotalFree():
             meminfo = utils.readMemInfo()
-            return meminfo['SwapTotal'] / 1024, meminfo['SwapFree'] / 1024
+            return (int(math.ceil(float(meminfo['SwapTotal']) / 1024)),
+                    int(math.ceil(float(meminfo['SwapFree']) / 1024)))
 
         stats = {}
         decStats = self._cif._hostStats.get()


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7eb33f0f003f7442efb103f43bbc60c5faa6a439
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list