Revision ea017cbc
b/Ganeti/HTools/Rapi.hs | ||
---|---|---|
33 | 33 |
import Network.Curl.Code |
34 | 34 |
import Data.List |
35 | 35 |
import Control.Monad |
36 |
import Text.JSON (JSObject, JSValue, fromJSObject) |
|
36 |
import Text.JSON (JSObject, JSValue, fromJSObject, decodeStrict)
|
|
37 | 37 |
import Text.Printf (printf) |
38 | 38 |
|
39 | 39 |
import Ganeti.HTools.Utils |
... | ... | |
119 | 119 |
let url = formatHost master |
120 | 120 |
node_body <- getUrl $ printf "%s/2/nodes?bulk=1" url |
121 | 121 |
inst_body <- getUrl $ printf "%s/2/instances?bulk=1" url |
122 |
tags_body <- getUrl $ printf "%s/2/tags" url |
|
122 | 123 |
return $ do -- Result monad |
123 | 124 |
node_data <- node_body >>= getNodes |
124 | 125 |
let (node_names, node_idx) = assignIndices node_data |
125 | 126 |
inst_data <- inst_body >>= getInstances node_names |
126 | 127 |
let (_, inst_idx) = assignIndices inst_data |
127 |
return (node_idx, inst_idx, []) |
|
128 |
tags_data <- tags_body >>= (fromJResult . decodeStrict) |
|
129 |
return (node_idx, inst_idx, tags_data) |
b/hbal.hs | ||
---|---|---|
187 | 187 |
verbose = optVerbose opts |
188 | 188 |
shownodes = optShowNodes opts |
189 | 189 |
|
190 |
(fixed_nl, il, _, csf) <- loadExternalData opts
|
|
190 |
(fixed_nl, il, ctags, csf) <- loadExternalData opts
|
|
191 | 191 |
|
192 | 192 |
let offline_names = optOffline opts |
193 | 193 |
all_nodes = Container.elems fixed_nl |
... | ... | |
210 | 210 |
nl = Container.map (flip Node.setMdsk m_dsk . flip Node.setMcpu m_cpu) |
211 | 211 |
nm |
212 | 212 |
|
213 |
when (not oneline && verbose > 1) $ |
|
214 |
putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags |
|
215 |
|
|
213 | 216 |
when (Container.size il == 0) $ do |
214 | 217 |
(if oneline then putStrLn $ formatOneline 0 0 0 |
215 | 218 |
else printf "Cluster is empty, exiting.\n") |
Also available in: Unified diff