snl' = map (\ n -> ((fromJust $ lookup (Node.idx n) ktn), n)) snl
m_name = maximum . (map length) . fst . unzip $ snl'
helper = Node.list m_name
- header = printf "%2s %-*s %5s %5s %5s %5s %5s %3s %3s %7s %7s"
- " F" m_name "Name" "t_mem" "f_mem" "r_mem"
+ header = printf "%2s %-*s %5s %5s %5s %5s %5s %5s %3s %3s %7s %7s"
+ " F" m_name "Name" "t_mem" "n_mem" "f_mem" "r_mem"
"t_dsk" "f_dsk"
"pri" "sec" "p_fmem" "p_fdsk"
in unlines $ (header:map (uncurry helper) snl')
String, NameList, NameList)
loadData ndata idata =
let
- {- node file: name t_mem f_mem t_disk f_disk -}
+ {- node file: name t_mem n_mem f_mem t_disk f_disk -}
(ktn, nl) = loadTabular ndata
- (\ (name:tm:fm:td:fd:[]) ->
+ (\ (name:tm:nm:fm:td:fd:[]) ->
(name,
- Node.create (read tm) (read fm) (read td) (read fd)))
+ Node.create (read tm) (read nm)
+ (read fm) (read td) (read fd)))
Node.setIdx
{- instance file: name mem disk pnode snode -}
(kti, il) = loadTabular idata
module Ganeti.HTools.Node
(
- Node(failN1, idx, t_mem, f_mem, t_dsk, f_dsk, p_mem, p_dsk, p_rem,
+ Node(failN1, idx, t_mem, n_mem, f_mem, t_dsk, f_dsk,
+ p_mem, p_dsk, p_rem,
plist, slist, offline)
-- * Constructor
, create
import Ganeti.HTools.Utils
-data Node = Node { t_mem :: Double -- ^ total memory (Mib)
+data Node = Node { t_mem :: Double -- ^ total memory (MiB)
+ , n_mem :: Int -- ^ node memory (MiB)
, f_mem :: Int -- ^ free memory (MiB)
, t_dsk :: Double -- ^ total disk space (MiB)
, f_dsk :: Int -- ^ free disk space (MiB)
later via the 'setIdx' and 'buildPeers' functions.
-}
-create :: Double -> Int -> Double -> Int -> Node
-create mem_t_init mem_f_init dsk_t_init dsk_f_init =
+create :: Double -> Int -> Int -> Double -> Int -> Node
+create mem_t_init mem_n_init mem_f_init dsk_t_init dsk_f_init =
Node
{
t_mem = mem_t_init,
+ n_mem = mem_n_init,
f_mem = mem_f_init,
t_dsk = dsk_t_init,
f_dsk = dsk_f_init,
off = offline t
fn = failN1 t
in
- printf " %c %-*s %5.0f %5d %5d %5.0f %5d %3d %3d %.5f %.5f"
+ printf " %c %-*s %5.0f %5d %5d %5d %5.0f %5d %3d %3d %.5f %.5f"
(if off then '-' else if fn then '*' else ' ')
- mname n (t_mem t) (f_mem t) (r_mem t)
+ mname n (t_mem t) (n_mem t) (f_mem t) (r_mem t)
((t_dsk t) / 1024) ((f_dsk t) `div` 1024)
(length pl) (length sl)
mp dp
parseNode a =
let name = getStringElement "name" a
mtotal = getIntElement "mtotal" a
+ mnode = getIntElement "mnode" a
mfree = getIntElement "mfree" a
dtotal = getIntElement "dtotal" a
dfree = getIntElement "dfree" a
in concatElems name $
concatElems (show `apply1` mtotal) $
+ concatElems (show `apply1` mnode) $
concatElems (show `apply1` mfree) $
concatElems (show `apply1` dtotal) (show `apply1` dfree)
from a cluster via RAPI. For text files, the following two commands
should be run::
- gnt-node list -oname,mtotal,mfree,dtotal,dfree \
+ gnt-node list -oname,mtotal,mnode,mfree,dtotal,dfree \
--separator '|' --no-headers > nodes
gnt-instance list -oname,admin_ram,sda_size,pnode,snodes \
--separator '|' --no-head > instances
node
- the node name
- the total node memory
+ - the memory used by the node itself
- the free node memory
- the reserved node memory, which is the amount of free memory
needed for N+1 compliance
node
- the node name
- the total node memory
+ - the memory used by the node itself
- the free node memory
- the reserved node memory, which is the amount of free memory
needed for N+1 compliance
t_mem = (truncate $ Node.t_mem node)::Int
t_dsk = (truncate $ Node.t_dsk node)::Int
in
- printf "%s|%d|%d|%d|%d" name
- t_mem (Node.f_mem node)
+ printf "%s|%d|%d|%d|%d|%d" name
+ t_mem (Node.n_mem node) (Node.f_mem node)
t_dsk (Node.f_dsk node))
nodes
in unlines nlines