Revision ebf38064 htools/Ganeti/HTools/Program/Hscan.hs
b/htools/Ganeti/HTools/Program/Hscan.hs | ||
---|---|---|
49 | 49 |
-- | Options list and functions. |
50 | 50 |
options :: [OptType] |
51 | 51 |
options = |
52 |
[ oPrintNodes
|
|
53 |
, oOutputDir
|
|
54 |
, oLuxiSocket
|
|
55 |
, oVerbose
|
|
56 |
, oNoHeaders
|
|
57 |
, oShowVer
|
|
58 |
, oShowHelp
|
|
59 |
]
|
|
52 |
[ oPrintNodes |
|
53 |
, oOutputDir |
|
54 |
, oLuxiSocket |
|
55 |
, oVerbose |
|
56 |
, oNoHeaders |
|
57 |
, oShowVer |
|
58 |
, oShowHelp |
|
59 |
] |
|
60 | 60 |
|
61 | 61 |
-- | Return a one-line summary of cluster state. |
62 | 62 |
printCluster :: Node.List -> Instance.List |
63 | 63 |
-> String |
64 | 64 |
printCluster nl il = |
65 |
let (bad_nodes, bad_instances) = Cluster.computeBadItems nl il |
|
66 |
ccv = Cluster.compCV nl |
|
67 |
nodes = Container.elems nl |
|
68 |
insts = Container.elems il |
|
69 |
t_ram = sum . map Node.tMem $ nodes |
|
70 |
t_dsk = sum . map Node.tDsk $ nodes |
|
71 |
f_ram = sum . map Node.fMem $ nodes |
|
72 |
f_dsk = sum . map Node.fDsk $ nodes |
|
73 |
in |
|
74 |
printf "%5d %5d %5d %5d %6.0f %6d %6.0f %6d %.8f" |
|
75 |
(length nodes) (length insts) |
|
76 |
(length bad_nodes) (length bad_instances) |
|
77 |
t_ram f_ram |
|
78 |
(t_dsk / 1024) (f_dsk `div` 1024) |
|
79 |
ccv |
|
80 |
|
|
65 |
let (bad_nodes, bad_instances) = Cluster.computeBadItems nl il |
|
66 |
ccv = Cluster.compCV nl |
|
67 |
nodes = Container.elems nl |
|
68 |
insts = Container.elems il |
|
69 |
t_ram = sum . map Node.tMem $ nodes |
|
70 |
t_dsk = sum . map Node.tDsk $ nodes |
|
71 |
f_ram = sum . map Node.fMem $ nodes |
|
72 |
f_dsk = sum . map Node.fDsk $ nodes |
|
73 |
in printf "%5d %5d %5d %5d %6.0f %6d %6.0f %6d %.8f" |
|
74 |
(length nodes) (length insts) |
|
75 |
(length bad_nodes) (length bad_instances) |
|
76 |
t_ram f_ram (t_dsk / 1024) (f_dsk `div` 1024) ccv |
|
81 | 77 |
|
82 | 78 |
-- | Replace slashes with underscore for saving to filesystem. |
83 | 79 |
fixSlash :: String -> String |
84 | 80 |
fixSlash = map (\x -> if x == '/' then '_' else x) |
85 | 81 |
|
86 |
|
|
87 | 82 |
-- | Generates serialized data from loader input. |
88 | 83 |
processData :: ClusterData -> Result ClusterData |
89 | 84 |
processData input_data = do |
Also available in: Unified diff