Revision e77bc89b
b/htools/Ganeti/HTools/Luxi.hs | ||
---|---|---|
199 | 199 |
parseNode _ v = fail ("Invalid node query result: " ++ show v) |
200 | 200 |
|
201 | 201 |
-- | Parses the cluster tags. |
202 |
getClusterTags :: JSValue -> Result [String]
|
|
203 |
getClusterTags v = do
|
|
202 |
getClusterData :: JSValue -> Result ([String], IPolicy)
|
|
203 |
getClusterData (JSObject obj) = do
|
|
204 | 204 |
let errmsg = "Parsing cluster info" |
205 |
obj <- annotateResult errmsg $ asJSObject v |
|
206 |
tryFromObj errmsg (fromJSObject obj) "tags" |
|
205 |
obj' = fromJSObject obj |
|
206 |
ctags <- tryFromObj errmsg obj' "tags" |
|
207 |
cpol <- tryFromObj errmsg obj' "ipolicy" |
|
208 |
return (ctags, cpol) |
|
209 |
|
|
210 |
getClusterData _ = Bad $ "Cannot parse cluster info, not a JSON record" |
|
207 | 211 |
|
208 | 212 |
-- | Parses the cluster groups. |
209 | 213 |
getGroups :: JSValue -> Result [(String, Group.Group)] |
... | ... | |
248 | 252 |
let (node_names, node_idx) = assignIndices node_data |
249 | 253 |
inst_data <- instances >>= getInstances node_names |
250 | 254 |
let (_, inst_idx) = assignIndices inst_data |
251 |
ctags <- cinfo >>= getClusterTags
|
|
252 |
return (ClusterData group_idx node_idx inst_idx ctags defIPolicy)
|
|
255 |
(ctags, cpol) <- cinfo >>= getClusterData
|
|
256 |
return (ClusterData group_idx node_idx inst_idx ctags cpol)
|
|
253 | 257 |
|
254 | 258 |
-- | Top level function for data loading. |
255 | 259 |
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 ipol) <- loadExternalData opts
|
|
355 | 355 |
|
356 |
when (verbose > 1) $ |
|
356 |
when (verbose > 1) $ do
|
|
357 | 357 |
putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags |
358 |
putStrLn $ "Loaded cluster ipolicy: " ++ show ipol |
|
358 | 359 |
|
359 | 360 |
nlf <- setNodeStatus opts fixed_nl |
360 | 361 |
checkCluster verbose nlf ilf |
Also available in: Unified diff