Revision 608efcce Ganeti/HTools/Node.hs
b/Ganeti/HTools/Node.hs  

48  48 
, x_mem :: Int  ^ unaccounted memory (MiB) 
49  49 
, t_dsk :: Double  ^ total disk space (MiB) 
50  50 
, f_dsk :: Int  ^ free disk space (MiB) 
51 
, plist :: [Int]  ^ list of primary instance indices


52 
, slist :: [Int]  ^ list of secondary instance indices


53 
, idx :: Int  ^ internal index for bookkeeping


51 
, plist :: [T.Idx] ^ list of primary instance indices


52 
, slist :: [T.Idx] ^ list of secondary instance indices


53 
, idx :: T.Ndx  ^ internal index for bookkeeping


54  54 
, peers :: PeerMap.PeerMap  ^ pnode to instance mapping 
55  55 
, failN1:: Bool  ^ whether the node has failed n1 
56  56 
, r_mem :: Int  ^ maximum memory needed for 
...  ...  
70  70 
setIdx = setIdx 
71  71  
72  72 
  A simple name for the int, node association list 
73 
type AssocList = [(Int, Node)]


73 
type AssocList = [(T.Ndx, Node)]


74  74  
75  75 
  A simple name for a node map 
76  76 
type List = Container.Container Node 
77  77  
78  78 
  Constant node index for a nonmoveable instance 
79 
noSecondary :: Int


79 
noSecondary :: T.Ndx


80  80 
noSecondary = 1 
81  81  
82  82 
{  Create a new node. 
...  ...  
111  111  
112  112 
  Changes the index. 
113  113 
 This is used only during the building of the data structures. 
114 
setIdx :: Node > Int > Node


114 
setIdx :: Node > T.Ndx > Node


115  115 
setIdx t i = t {idx = i} 
116  116  
117  117 
  Changes the name 
...  ...  
148  148 
computeMaxRes new_peers = PeerMap.maxElem new_peers 
149  149  
150  150 
  Builds the peer map for a given node. 
151 
buildPeers :: Node > Container.Container Instance.Instance > Int > Node


151 
buildPeers :: Node > Instance.List > Int > Node


152  152 
buildPeers t il num_nodes = 
153  153 
let mdata = map 
154  154 
(\i_idx > let inst = Container.find i_idx il 
...  ...  
214  214 
failN1 = new_failn1, p_mem = new_mp, p_dsk = new_dp} 
215  215  
216  216 
  Adds a secondary instance. 
217 
addSec :: Node > Instance.Instance > Int > Maybe Node


217 
addSec :: Node > Instance.Instance > T.Ndx > Maybe Node


218  218 
addSec t inst pdx = 
219  219 
let iname = Instance.idx inst 
220  220 
old_peers = peers t 
...  ...  
237  237 
p_rem = new_prem} 
238  238  
239  239 
  Add a primary instance to a node without other updates 
240 
setPri :: Node > Int > Node


240 
setPri :: Node > T.Idx > Node


241  241 
setPri t idx = t { plist = idx:(plist t) } 
242  242  
243  243 
  Add a secondary instance to a node without other updates 
244 
setSec :: Node > Int > Node


244 
setSec :: Node > T.Idx > Node


245  245 
setSec t idx = t { slist = idx:(slist t) } 
246  246  
247  247 
  String converter for the node list functionality. 
Also available in: Unified diff