Skip to content
Snippets Groups Projects
Commit 8c5b0a0d authored by Iustin Pop's avatar Iustin Pop
Browse files

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.
parent 209b3711
No related branches found
No related tags found
No related merge requests found
......@@ -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 =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment