hcheck: rework output mode
authorIustin Pop <iustin@google.com>
Thu, 28 Jun 2012 22:48:47 +0000 (15:48 -0700)
committerIustin Pop <iustin@google.com>
Fri, 29 Jun 2012 17:34:54 +0000 (10:34 -0700)
commit4b77c2a2ba840c1116476967d409f260ee5203c6
treed546abbbbcace73c6ae13ac9fbac6ba9b6c175ed
parent85890a9d65560de0eb665796914b8fe588dc09d4
hcheck: rework output mode

Looking at the output of hcheck, in human readable mode, it looks like
it always starts with a blank line. This is not nice, so I wanted to
redo this to start cleanly.

However, looking at the code, I realised that we need some internal
cleanup; 'perGroupChecks' was doing both pure computation (computing
the score/stats) and I/O work (printing the stats), which is ugly, so
I split that in two; this allows perGroupChecks to be simpler, and we
can therefore first compute the group stats, and start the output with
the mode in which we run.

So right now, hcheck will first output whether we need to run a
rebalance, or if no-simulation is selected, etc., and only then
display the actual stats, making the output a bit more consistent.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Agata Murawska <agatamurawska@google.com>
htools/Ganeti/HTools/Program/Hcheck.hs