LGTM
On 10/21/2015 01:39 PM, 'Klaus Aehlig' via ganeti-devel wrote:
On Mon, Oct 19, 2015 at 08:09:26PM +0200, Oleg Ponomarev wrote:
What about big pages?
Anyway, I would prefer to make 256 a literal constant.
Rest, LGTM.
Interdiff [PATCH stable-2.17 06/14] Also support the kvm RSS collector at
MonD backend
diff --git a/src/Ganeti/HTools/Backend/MonD.hs
b/src/Ganeti/HTools/Backend/MonD.hs
index 53fd2f6..d7d8b4c 100644
--- a/src/Ganeti/HTools/Backend/MonD.hs
+++ b/src/Ganeti/HTools/Backend/MonD.hs
@@ -207,6 +207,12 @@ mkKvmRSSReport :: DCReport -> Maybe Report
mkKvmRSSReport =
liftM InstanceRSSReport . maybeParseMap . dcReportData
+-- | Conversion constant from htools' internal memory unit,
+-- which is MiB to RSS unit, which reported in pages (of 4kiB
+-- each).
+pagesPerMiB :: Double
+pagesPerMiB = 256.0
+
-- | Update cluster data based on per-instance RSS data.
-- Also set the node's memoy util pool correctly. Our unit
-- of memory usage is pages; there are 256 pages per MiB
@@ -237,7 +243,8 @@ useInstanceRSSData reports (nl, il) = do
dynU = Node.utilLoad node
dynU' = dynU { memWeight = mem }
pool = Node.utilPool node
- nodePages = (Node.tMem node - fromIntegral (Node.nMem node)) *
256.0
+ nodePages = (Node.tMem node - fromIntegral (Node.nMem node))
+ * pagesPerMiB
pool' = pool { memWeight = nodePages }
in node { Node.utilLoad = dynU', Node.utilPool = pool' }
let nl' = IntMap.map updateNode nl