From 8c5b0a0d39e4df15883d568e0b84c61bc2230c71 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Sun, 22 Mar 2009 10:55:12 +0100 Subject: [PATCH] Add a new node filed x_mem Nodes can have some memory unaccounted for, due to (e.g.) hypervisor overhead, rounding errors in reporting, etc. It is better if we model this memory explicitly instead of hiding it, and actually since the n_mem addition it is actually required to do so. The new attribute is not yet used. --- Ganeti/HTools/Node.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Ganeti/HTools/Node.hs b/Ganeti/HTools/Node.hs index 7694c6d76..3ecf68525 100644 --- a/Ganeti/HTools/Node.hs +++ b/Ganeti/HTools/Node.hs @@ -15,6 +15,7 @@ module Ganeti.HTools.Node , buildPeers , setIdx , setOffline + , setXmem -- * Instance (re)location , removePri , removeSec @@ -38,6 +39,7 @@ import Ganeti.HTools.Utils data Node = Node { t_mem :: Double -- ^ total memory (MiB) , n_mem :: Int -- ^ node memory (MiB) , f_mem :: Int -- ^ free memory (MiB) + , x_mem :: Int -- ^ unaccounted memory (MiB) , t_dsk :: Double -- ^ total disk space (MiB) , f_dsk :: Int -- ^ free disk space (MiB) , plist :: [Int] -- ^ list of primary instance indices @@ -79,7 +81,8 @@ create mem_t_init mem_n_init mem_f_init dsk_t_init dsk_f_init = p_mem = (fromIntegral mem_f_init) / mem_t_init, p_dsk = (fromIntegral dsk_f_init) / dsk_t_init, p_rem = 0, - offline = False + offline = False, + x_mem = 0 } -- | Changes the index. @@ -91,6 +94,10 @@ setIdx t i = t {idx = i} setOffline :: Node -> Bool -> Node setOffline t val = t { offline = val } +-- | Sets the unnaccounted memory +setXmem :: Node -> Int -> Node +setXmem t val = t { x_mem = val } + -- | Given the rmem, free memory and disk, computes the failn1 status. computeFailN1 :: Int -> Int -> Int -> Bool computeFailN1 new_rmem new_mem new_dsk = -- GitLab