projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make IAlloc.loadData return maps
[ganeti-local]
/
Ganeti
/
HTools
/
Node.hs
diff --git
a/Ganeti/HTools/Node.hs
b/Ganeti/HTools/Node.hs
index
37d3d92
..
9f54f03
100644
(file)
--- a/
Ganeti/HTools/Node.hs
+++ b/
Ganeti/HTools/Node.hs
@@
-6,7
+6,7
@@
module Ganeti.HTools.Node
(
module Ganeti.HTools.Node
(
- Node(failN1, idx, t_mem, n_mem, f_mem, t_dsk, f_dsk,
+ Node(failN1, name, idx, t_mem, n_mem, f_mem, t_dsk, f_dsk,
p_mem, p_dsk, p_rem,
plist, slist, offline)
-- * Constructor
p_mem, p_dsk, p_rem,
plist, slist, offline)
-- * Constructor
@@
-14,6
+14,7
@@
module Ganeti.HTools.Node
-- ** Finalization after data loading
, buildPeers
, setIdx
-- ** Finalization after data loading
, buildPeers
, setIdx
+ , setName
, setOffline
, setXmem
, setFmem
, setOffline
, setXmem
, setFmem
@@
-38,9
+39,8
@@
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Instance as Instance
import qualified Ganeti.HTools.PeerMap as PeerMap
import qualified Ganeti.HTools.Instance as Instance
import qualified Ganeti.HTools.PeerMap as PeerMap
-import Ganeti.HTools.Utils
-
-data Node = Node { t_mem :: Double -- ^ total memory (MiB)
+data Node = Node { name :: String -- ^ the node name
+ , t_mem :: Double -- ^ total memory (MiB)
, n_mem :: Int -- ^ node memory (MiB)
, f_mem :: Int -- ^ free memory (MiB)
, x_mem :: Int -- ^ unaccounted memory (MiB)
, n_mem :: Int -- ^ node memory (MiB)
, f_mem :: Int -- ^ free memory (MiB)
, x_mem :: Int -- ^ unaccounted memory (MiB)
@@
-74,11
+74,12
@@
The index and the peers maps are empty, and will be need to be update
later via the 'setIdx' and 'buildPeers' functions.
-}
later via the 'setIdx' and 'buildPeers' functions.
-}
-create :: Double -> Int -> Int -> Double -> Int -> Bool -> Node
-create mem_t_init mem_n_init mem_f_init dsk_t_init dsk_f_init
- offline_init =
+create :: String -> Double -> Int -> Int -> Double -> Int -> Bool -> Node
+create name_init mem_t_init mem_n_init mem_f_init
+ dsk_t_init dsk_f_init offline_init =
Node
{
Node
{
+ name = name_init,
t_mem = mem_t_init,
n_mem = mem_n_init,
f_mem = mem_f_init,
t_mem = mem_t_init,
n_mem = mem_n_init,
f_mem = mem_f_init,
@@
-102,6
+103,10
@@
create mem_t_init mem_n_init mem_f_init dsk_t_init dsk_f_init
setIdx :: Node -> Int -> Node
setIdx t i = t {idx = i}
setIdx :: Node -> Int -> Node
setIdx t i = t {idx = i}
+-- | Changes the name
+-- This is used only during the building of the data structures.
+setName t s = t {name = s}
+
-- | Sets the offline attribute
setOffline :: Node -> Bool -> Node
setOffline t val = t { offline = val }
-- | Sets the offline attribute
setOffline :: Node -> Bool -> Node
setOffline t val = t { offline = val }