Revision d85a0a0f
b/Ganeti/HTools/Cluster.hs | ||
---|---|---|
117 | 117 |
(bad_nodes, bad_instances) |
118 | 118 |
|
119 | 119 |
-- | Compute the total free disk and memory in the cluster. |
120 |
totalResources :: Container.Container Node.Node -> (Int, Int)
|
|
120 |
totalResources :: Node.List -> (Int, Int)
|
|
121 | 121 |
totalResources nl = |
122 | 122 |
foldl' |
123 | 123 |
(\ (mem, dsk) node -> (mem + (Node.f_mem node), |
b/Ganeti/HTools/Utils.hs | ||
---|---|---|
5 | 5 |
debug |
6 | 6 |
, sepSplit |
7 | 7 |
, varianceCoeff |
8 |
, readData |
|
9 | 8 |
, commaJoin |
10 | 9 |
, readEitherString |
11 | 10 |
, loadJSArray |
... | ... | |
73 | 72 |
varianceCoeff :: Floating a => [a] -> a |
74 | 73 |
varianceCoeff lst = (stdDev lst) / (fromIntegral $ length lst) |
75 | 74 |
|
76 |
-- | Get an Ok result or print the error and exit. |
|
77 |
readData :: Result a -> IO a |
|
78 |
readData nd = |
|
79 |
(case nd of |
|
80 |
Bad x -> do |
|
81 |
putStrLn x |
|
82 |
exitWith $ ExitFailure 1 |
|
83 |
Ok x -> return x) |
|
84 |
|
|
85 | 75 |
-- * JSON-related functions |
86 | 76 |
|
87 | 77 |
-- | Converts a JSON Result into a monadic value. |
Also available in: Unified diff