Revision 71375ef7
b/htools/Ganeti/HTools/IAlloc.hs | ||
---|---|---|
158 | 158 |
let (kti, il) = assignIndices iobj |
159 | 159 |
-- cluster tags |
160 | 160 |
ctags <- extrObj "cluster_tags" |
161 |
cdata1 <- mergeData [] [] [] [] (ClusterData gl nl il ctags) |
|
161 |
cdata1 <- mergeData [] [] [] [] (ClusterData gl nl il ctags defIPolicy)
|
|
162 | 162 |
let (msgs, fix_nl) = checkData (cdNodes cdata1) (cdInstances cdata1) |
163 | 163 |
cdata = cdata1 { cdNodes = fix_nl } |
164 | 164 |
map_n = cdNodes cdata |
... | ... | |
307 | 307 |
-- | Process a request and return new node lists. |
308 | 308 |
processRequest :: Request -> Result IAllocResult |
309 | 309 |
processRequest request = |
310 |
let Request rqtype (ClusterData gl nl il _) = request |
|
310 |
let Request rqtype (ClusterData gl nl il _ _) = request
|
|
311 | 311 |
in case rqtype of |
312 | 312 |
Allocate xi reqn -> |
313 | 313 |
Cluster.tryMGAlloc gl nl il xi reqn >>= formatAllocate il |
b/htools/Ganeti/HTools/Loader.hs | ||
---|---|---|
90 | 90 |
, cdNodes :: Node.List -- ^ The node list |
91 | 91 |
, cdInstances :: Instance.List -- ^ The instance list |
92 | 92 |
, cdTags :: [String] -- ^ The cluster tags |
93 |
, cdIPolicy :: IPolicy -- ^ The cluster instance policy |
|
93 | 94 |
} deriving (Show, Read) |
94 | 95 |
|
95 | 96 |
-- | The priority of a match in a lookup result. |
... | ... | |
116 | 117 |
-- | An empty cluster. |
117 | 118 |
emptyCluster :: ClusterData |
118 | 119 |
emptyCluster = ClusterData Container.empty Container.empty Container.empty [] |
120 |
defIPolicy |
|
119 | 121 |
|
120 | 122 |
-- * Functions |
121 | 123 |
|
... | ... | |
267 | 269 |
-> [String] -- ^ Excluded instances |
268 | 270 |
-> ClusterData -- ^ Data from backends |
269 | 271 |
-> Result ClusterData -- ^ Fixed cluster data |
270 |
mergeData um extags selinsts exinsts cdata@(ClusterData _ nl il2 tags) = |
|
272 |
mergeData um extags selinsts exinsts cdata@(ClusterData _ nl il2 tags _) =
|
|
271 | 273 |
let il = Container.elems il2 |
272 | 274 |
il3 = foldl' (\im (name, n_util) -> |
273 | 275 |
case Container.findByName im name of |
b/htools/Ganeti/HTools/Luxi.hs | ||
---|---|---|
249 | 249 |
inst_data <- instances >>= getInstances node_names |
250 | 250 |
let (_, inst_idx) = assignIndices inst_data |
251 | 251 |
ctags <- cinfo >>= getClusterTags |
252 |
return (ClusterData group_idx node_idx inst_idx ctags) |
|
252 |
return (ClusterData group_idx node_idx inst_idx ctags defIPolicy)
|
|
253 | 253 |
|
254 | 254 |
-- | Top level function for data loading. |
255 | 255 |
loadData :: String -- ^ Unix socket to use as source |
b/htools/Ganeti/HTools/Program/Hbal.hs | ||
---|---|---|
351 | 351 |
shownodes = optShowNodes opts |
352 | 352 |
showinsts = optShowInsts opts |
353 | 353 |
|
354 |
ini_cdata@(ClusterData gl fixed_nl ilf ctags) <- loadExternalData opts |
|
354 |
ini_cdata@(ClusterData gl fixed_nl ilf ctags _) <- loadExternalData opts
|
|
355 | 355 |
|
356 | 356 |
when (verbose > 1) $ |
357 | 357 |
putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags |
... | ... | |
412 | 412 |
saveBalanceCommands opts $ Cluster.formatCmds cmd_jobs |
413 | 413 |
|
414 | 414 |
maybeSaveData (optSaveCluster opts) "balanced" "after balancing" |
415 |
(ClusterData gl fin_nl fin_il ctags)
|
|
415 |
ini_cdata { cdNodes = fin_nl, cdInstances = fin_il }
|
|
416 | 416 |
|
417 | 417 |
maybePrintInsts showinsts "Final" (Cluster.printInsts fin_nl fin_il) |
418 | 418 |
|
b/htools/Ganeti/HTools/Program/Hscan.hs | ||
---|---|---|
82 | 82 |
-- | Generates serialized data from loader input. |
83 | 83 |
processData :: ClusterData -> Result ClusterData |
84 | 84 |
processData input_data = do |
85 |
cdata@(ClusterData _ nl il _) <- mergeData [] [] [] [] input_data |
|
85 |
cdata@(ClusterData _ nl il _ _) <- mergeData [] [] [] [] input_data
|
|
86 | 86 |
let (_, fix_nl) = checkData nl il |
87 | 87 |
return cdata { cdNodes = fix_nl } |
88 | 88 |
|
... | ... | |
111 | 111 |
-> ClusterData |
112 | 112 |
-> IO Bool |
113 | 113 |
writeDataInner nlen name opts cdata fixdata = do |
114 |
let (ClusterData _ nl il _) = fixdata |
|
114 |
let (ClusterData _ nl il _ _) = fixdata
|
|
115 | 115 |
printf "%-*s " nlen name :: IO () |
116 | 116 |
hFlush stdout |
117 | 117 |
let shownodes = optShowNodes opts |
b/htools/Ganeti/HTools/Program/Hspace.hs | ||
---|---|---|
397 | 397 |
req_nodes = Instance.requiredNodes disk_template |
398 | 398 |
machine_r = optMachineReadable opts |
399 | 399 |
|
400 |
(ClusterData gl fixed_nl il ctags) <- loadExternalData opts
|
|
400 |
orig_cdata@(ClusterData gl fixed_nl il _ _) <- loadExternalData opts
|
|
401 | 401 |
nl <- setNodeStatus opts fixed_nl |
402 | 402 |
|
403 | 403 |
let num_instances = Container.size il |
404 | 404 |
all_nodes = Container.elems fixed_nl |
405 |
cdata = ClusterData gl nl il ctags
|
|
405 |
cdata = orig_cdata { cdNodes = fixed_nl }
|
|
406 | 406 |
csf = commonSuffix fixed_nl il |
407 | 407 |
|
408 | 408 |
when (not (null csf) && verbose > 1) $ |
b/htools/Ganeti/HTools/QC.hs | ||
---|---|---|
1035 | 1035 |
in case Loader.mergeData [] [] [] [] |
1036 | 1036 |
(Loader.emptyCluster {Loader.cdNodes = na}) of |
1037 | 1037 |
Types.Bad _ -> False |
1038 |
Types.Ok (Loader.ClusterData _ nl il _) -> |
|
1038 |
Types.Ok (Loader.ClusterData _ nl il _ _) ->
|
|
1039 | 1039 |
let nodes = Container.elems nl |
1040 | 1040 |
instances = Container.elems il |
1041 | 1041 |
in (sum . map (length . Node.pList)) nodes == 0 && |
b/htools/Ganeti/HTools/Rapi.hs | ||
---|---|---|
183 | 183 |
inst_data <- inst_body >>= getInstances node_names |
184 | 184 |
let (_, inst_idx) = assignIndices inst_data |
185 | 185 |
tags_data <- tags_body >>= (fromJResult "Parsing tags data" . decodeStrict) |
186 |
return (ClusterData group_idx node_idx inst_idx tags_data) |
|
186 |
return (ClusterData group_idx node_idx inst_idx tags_data defIPolicy)
|
|
187 | 187 |
|
188 | 188 |
-- | Top level function for data loading. |
189 | 189 |
loadData :: String -- ^ Cluster or URL to use as source |
b/htools/Ganeti/HTools/Simu.hs | ||
---|---|---|
91 | 91 |
$ zip [1..] nodes' |
92 | 92 |
ktg = map (\g -> (Group.idx g, g)) groups |
93 | 93 |
return (ClusterData (Container.fromList ktg) |
94 |
(Container.fromList ktn) Container.empty []) |
|
94 |
(Container.fromList ktn) Container.empty [] defIPolicy)
|
|
95 | 95 |
|
96 | 96 |
-- | Builds the cluster data from node\/instance files. |
97 | 97 |
loadData :: [String] -- ^ Cluster description in text format |
b/htools/Ganeti/HTools/Text.hs | ||
---|---|---|
104 | 104 |
|
105 | 105 |
-- | Generate complete cluster data from node and instance lists. |
106 | 106 |
serializeCluster :: ClusterData -> String |
107 |
serializeCluster (ClusterData gl nl il ctags) = |
|
107 |
serializeCluster (ClusterData gl nl il ctags _) =
|
|
108 | 108 |
let gdata = serializeGroups gl |
109 | 109 |
ndata = serializeNodes gl nl |
110 | 110 |
idata = serializeInstances nl il |
... | ... | |
221 | 221 |
{- instance file: name mem disk status pnode snode -} |
222 | 222 |
(_, il) <- loadTabular ilines (loadInst ktn) |
223 | 223 |
{- the tags are simply line-based, no processing needed -} |
224 |
return (ClusterData gl nl il ctags) |
|
224 |
return (ClusterData gl nl il ctags defIPolicy)
|
|
225 | 225 |
|
226 | 226 |
-- | Top level function for data loading. |
227 | 227 |
loadData :: String -- ^ Path to the text file |
Also available in: Unified diff