The harep tool prints messages for every action that it performs (or that it doesn't perform). In case nothing is to be done at all, always print some statistics of the current state of the cluster.
Signed-off-by: Dato Simó <[email protected]> --- src/Ganeti/HTools/Program/Harep.hs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Ganeti/HTools/Program/Harep.hs b/src/Ganeti/HTools/Program/Harep.hs index 2ede5f2..4da22cf 100644 --- a/src/Ganeti/HTools/Program/Harep.hs +++ b/src/Ganeti/HTools/Program/Harep.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE TupleSections #-} + {-| Auto-repair tool for Ganeti. -} @@ -35,6 +37,7 @@ import Data.List import Data.Maybe import Data.Ord import System.Time +import qualified Data.Map as Map import Ganeti.BasicTypes import Ganeti.Common @@ -447,7 +450,15 @@ main opts args = do ArHealthy _ -> doRepair c i _ -> const (return i) - _unused_repairDone <- bracket (L.getClient master) L.closeClient $ - forM (zip iniData' repairs) . maybeRepair + repairDone <- bracket (L.getClient master) L.closeClient $ + forM (zip iniData' repairs) . maybeRepair + + -- Print some stats and exit. + let states = map ((, 1 :: Int) . arStateName . arState) repairDone + counts = Map.fromListWith (+) states - return () + putStrLn "---------------------" + putStrLn "Instance status count" + putStrLn "---------------------" + putStr . unlines . Map.elems $ + Map.mapWithKey (\k v -> k ++ ": " ++ show v) counts -- 1.8.0.2-x20-1
