> On Wed, 7 Oct 2015 at 11:03 'Klaus Aehlig' via ganeti-devel <
> [email protected]> wrote:
> 
> > For each group, make hcheck compute and report the redundancy level; also
> > report the cluster redundancy level as the minimum over all those levels.
> >
> 
> I think it would be good to mention somewhere that the level is the integer
> that is named as "M" in the design. Otherwise one might wonder if it is the
> same or not.

I suggest rewording the log message as follows.


    For each group, make hcheck compute and report the redundancy level, i.e.,
    the maximal M such that the group is N+M redundant; also report the cluster
    redundancy level as the minimum over all those levels.

> >  -- | Print all the statistics on a group level.
> >  printGroupStats :: Options -> Bool -> Phase -> GroupStats -> IO ()
> > -printGroupStats opts machineread phase ((grp, score), stats) = do
> > -  let values = prepareGroupValues stats score
> > +printGroupStats opts machineread phase ((grp, score, rLvl), stats) = do
> >
> 
> I'd spare a few more characters and name rLvl to something more readable,
> like redundancyLevel etc.

I suggest the following interdiff

commit c9c4ae4813792a7ec8aca3c4a81c8bfd64905f18
Author: Klaus Aehlig <[email protected]>
Date:   Tue Oct 13 15:35:06 2015 +0200

    Interdiff [PATCH master 3/4] Make hcheck report the redunancy level

diff --git a/src/Ganeti/HTools/Program/Hcheck.hs 
b/src/Ganeti/HTools/Program/Hcheck.hs
index 3dcfa89..1250ca2 100644
--- a/src/Ganeti/HTools/Program/Hcheck.hs
+++ b/src/Ganeti/HTools/Program/Hcheck.hs
@@ -225,8 +225,8 @@ extractGroupData False grp = Group.name grp
 
 -- | Prepare values for group.
 prepareGroupValues :: [Int] -> Double -> Int -> [String]
-prepareGroupValues stats score rLvl =
-  map show stats ++ [printf "%.8f" score] ++ [show rLvl]
+prepareGroupValues stats score redundancyLevel =
+  map show stats ++ [printf "%.8f" score] ++ [show redundancyLevel]
 
 -- | Prepare values for cluster.
 prepareClusterValues :: Bool -> [Int] -> [Bool] -> [String]
@@ -235,8 +235,9 @@ prepareClusterValues machineread stats bstats =
 
 -- | Print all the statistics on a group level.
 printGroupStats :: Options -> Bool -> Phase -> GroupStats -> IO ()
-printGroupStats opts machineread phase ((grp, score, rLvl), stats) = do
-  let values = prepareGroupValues stats score rLvl
+printGroupStats opts machineread phase
+                ((grp, score, redundancyLevel), stats) = do
+  let values = prepareGroupValues stats score redundancyLevel
       extradata = extractGroupData machineread grp
   printStats opts machineread (GroupLvl extradata) phase values
 
@@ -266,14 +267,14 @@ perGroupChecks opts gl (gidx, (nl, il)) =
       offline_pri = sum . map length $ map Node.pList offnl
       offline_sec = length $ map Node.sList offnl
       score = Metrics.compCV nl
-      rLvl = redundancy (fromCLIOptions opts) nl il
+      redundancyLvl = redundancy (fromCLIOptions opts) nl il
       groupstats = [ n1violated
                    , conflicttags
                    , offline_pri
                    , offline_sec
                    ]
                    ++ [ gn1fail | optCapacity opts ]
-  in ((grp, score, rLvl), groupstats)
+  in ((grp, score, redundancyLvl), groupstats)
 
 -- | Use Hbal's iterateDepth to simulate group rebalance.
 executeSimulation :: Options -> Cluster.Table -> Double


-- 
Klaus Aehlig
Google Germany GmbH, Dienerstr. 12, 80331 Muenchen
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschaeftsfuehrer: Matthew Scott Sucherman, Paul Terence Manicle

Reply via email to