Revision b5b19d5e
b/htools/Ganeti/HTools/Program/Hcheck.hs | ||
---|---|---|
85 | 85 |
htcPrefix :: String |
86 | 86 |
htcPrefix = "HCHECK" |
87 | 87 |
|
88 |
-- | Phase-specific prefix for machine readable version. |
|
89 |
phasePrefix :: Phase -> String |
|
90 |
phasePrefix Initial = "INIT" |
|
91 |
phasePrefix Rebalanced = "FINAL" |
|
92 |
|
|
93 |
-- | Description of phases for human readable version. |
|
94 |
phaseDescription :: Phase -> String |
|
95 |
phaseDescription Initial = "initially" |
|
96 |
phaseDescription Rebalanced = "after rebalancing" |
|
97 |
|
|
98 |
-- | Level-specific prefix for machine readable version. |
|
99 |
levelPrefix :: Level -> String |
|
100 |
levelPrefix GroupLvl = "GROUP" |
|
101 |
levelPrefix ClusterLvl = "CLUSTER" |
|
102 |
|
|
103 | 88 |
-- | Data showed both per group and per cluster. |
104 | 89 |
commonData :: [(String, String)] |
105 | 90 |
commonData =[ ("N1_FAIL", "Nodes not N+1 happy") |
... | ... | |
119 | 104 |
, ("CAN_REBALANCE", "Possible to run rebalance") |
120 | 105 |
] |
121 | 106 |
|
107 |
-- | Phase-specific prefix for machine readable version. |
|
108 |
phasePrefix :: Phase -> String |
|
109 |
phasePrefix Initial = "INIT" |
|
110 |
phasePrefix Rebalanced = "FINAL" |
|
111 |
|
|
112 |
-- | Level-specific prefix for machine readable version. |
|
113 |
levelPrefix :: Level -> String |
|
114 |
levelPrefix GroupLvl = "GROUP" |
|
115 |
levelPrefix ClusterLvl = "CLUSTER" |
|
116 |
|
|
117 |
-- | Description of phases for human readable version. |
|
118 |
phaseDescr :: Phase -> String |
|
119 |
phaseDescr Initial = "initially" |
|
120 |
phaseDescr Rebalanced = "after rebalancing" |
|
121 |
|
|
122 | 122 |
|
123 | 123 |
-- | Format a list of key, value as a shell fragment. |
124 | 124 |
printKeysHTC :: [(String, String)] -> IO () |
... | ... | |
156 | 156 |
|
157 | 157 |
unless (verbose == 0) $ do |
158 | 158 |
printf "\nStatistics for group %s %s\n" |
159 |
(Group.name grp) (phaseDescription phase) :: IO ()
|
|
159 |
(Group.name grp) (phaseDescr phase) :: IO () |
|
160 | 160 |
mapM_ (\(a,b) -> printf " %s: %s\n" (snd a) b :: IO ()) |
161 | 161 |
(zip groupData printstats) |
162 | 162 |
|
... | ... | |
175 | 175 |
let printstats = map (printf "%d") stats ++ |
176 | 176 |
map (printBool False) [needrebal, canrebal] |
177 | 177 |
unless (verbose == 0) $ do |
178 |
printf "\nCluster statistics %s\n" (phaseDescription phase) :: IO ()
|
|
178 |
printf "\nCluster statistics %s\n" (phaseDescr phase) :: IO () |
|
179 | 179 |
mapM_ (\(a,b) -> printf " %s: %s\n" (snd a) b :: IO ()) |
180 | 180 |
(zip clusterData printstats) |
181 | 181 |
|
Also available in: Unified diff