diff --git a/htools/Ganeti/HTools/Program/Hcheck.hs b/htools/Ganeti/HTools/Program/Hcheck.hs index 15012ab9c50faa52296ac5b04689fed698ef2acb..ede8794fd2f1815a0eff9b7a2dc1d42d640f573b 100644 --- a/htools/Ganeti/HTools/Program/Hcheck.hs +++ b/htools/Ganeti/HTools/Program/Hcheck.hs @@ -85,21 +85,6 @@ data Level = GroupLvl htcPrefix :: String htcPrefix = "HCHECK" --- | Phase-specific prefix for machine readable version. -phasePrefix :: Phase -> String -phasePrefix Initial = "INIT" -phasePrefix Rebalanced = "FINAL" - --- | Description of phases for human readable version. -phaseDescription :: Phase -> String -phaseDescription Initial = "initially" -phaseDescription Rebalanced = "after rebalancing" - --- | Level-specific prefix for machine readable version. -levelPrefix :: Level -> String -levelPrefix GroupLvl = "GROUP" -levelPrefix ClusterLvl = "CLUSTER" - -- | Data showed both per group and per cluster. commonData :: [(String, String)] commonData =[ ("N1_FAIL", "Nodes not N+1 happy") @@ -119,6 +104,21 @@ clusterData = commonData ++ , ("CAN_REBALANCE", "Possible to run rebalance") ] +-- | Phase-specific prefix for machine readable version. +phasePrefix :: Phase -> String +phasePrefix Initial = "INIT" +phasePrefix Rebalanced = "FINAL" + +-- | Level-specific prefix for machine readable version. +levelPrefix :: Level -> String +levelPrefix GroupLvl = "GROUP" +levelPrefix ClusterLvl = "CLUSTER" + +-- | Description of phases for human readable version. +phaseDescr :: Phase -> String +phaseDescr Initial = "initially" +phaseDescr Rebalanced = "after rebalancing" + -- | Format a list of key, value as a shell fragment. printKeysHTC :: [(String, String)] -> IO () @@ -156,7 +156,7 @@ printGroupStats verbose False phase grp stats score = do unless (verbose == 0) $ do printf "\nStatistics for group %s %s\n" - (Group.name grp) (phaseDescription phase) :: IO () + (Group.name grp) (phaseDescr phase) :: IO () mapM_ (\(a,b) -> printf " %s: %s\n" (snd a) b :: IO ()) (zip groupData printstats) @@ -175,7 +175,7 @@ printClusterStats verbose False phase stats needrebal canrebal = do let printstats = map (printf "%d") stats ++ map (printBool False) [needrebal, canrebal] unless (verbose == 0) $ do - printf "\nCluster statistics %s\n" (phaseDescription phase) :: IO () + printf "\nCluster statistics %s\n" (phaseDescr phase) :: IO () mapM_ (\(a,b) -> printf " %s: %s\n" (snd a) b :: IO ()) (zip clusterData printstats)