From 592601b3341e6b7dc44530282cb311c323ec6566 Mon Sep 17 00:00:00 2001 From: Agata Murawska <agatamurawska@google.com> Date: Tue, 26 Jun 2012 17:14:07 +0200 Subject: [PATCH] Print idx <-> uuid mappings in machine readable mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per Iustin Pop's suggestion, we are printing group mappings from group idx (known only to htools) to group uuid, which identifies the group uniquely. This is required because group uuid and name may contain characters such as '-' which are not valid parts of bash variable name. Signed-off-by: Agata Murawska <agatamurawska@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- htools/Ganeti/HTools/Program/Hcheck.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htools/Ganeti/HTools/Program/Hcheck.hs b/htools/Ganeti/HTools/Program/Hcheck.hs index f5d73dbbf..e3ab1b128 100644 --- a/htools/Ganeti/HTools/Program/Hcheck.hs +++ b/htools/Ganeti/HTools/Program/Hcheck.hs @@ -132,6 +132,14 @@ printBool True True = "1" printBool True False = "0" printBool False b = show b +-- | Print mapping from group idx to group uuid (only in machine readable mode). +printGroupsMappings :: Group.List -> IO () +printGroupsMappings gl = do + let extract_vals = \g -> (printf "GROUP_UUID_%d" $ Group.idx g :: String, + printf "%s" $ Group.uuid g :: String) + printpairs = map extract_vals (Container.elems gl) + printKeysHTC printpairs + -- | Print all the statistics on a group level. printGroupStats :: Int -> Bool -> Phase -> Group.Group -> [Int] -> Double -> IO () printGroupStats _ True phase grp stats score = do @@ -246,6 +254,7 @@ main opts args = do let splitinstances = Cluster.findSplitInstances nlf ilf splitcluster = Cluster.splitCluster nlf ilf + when machineread $ printGroupsMappings gl groupsstats <- mapM (perGroupChecks verbose machineread Initial gl) splitcluster let clusterstats = map sum (transpose groupsstats) :: [Int] -- GitLab