From b5b19d5e3571c48e27956085630719fbed9dd986 Mon Sep 17 00:00:00 2001 From: Agata Murawska <agatamurawska@google.com> Date: Tue, 26 Jun 2012 11:21:17 +0200 Subject: [PATCH] Small reordering and renaming in hcheck MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reordered functions and shortened one function name. Signed-off-by: Agata Murawska <agatamurawska@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- htools/Ganeti/HTools/Program/Hcheck.hs | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htools/Ganeti/HTools/Program/Hcheck.hs b/htools/Ganeti/HTools/Program/Hcheck.hs index 15012ab9c..ede8794fd 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) -- GitLab