On Mon, Jun 25, 2012 at 10:26 AM, Agata Murawska <agatamuraw...@google.com> wrote: > On Fri, Jun 22, 2012 at 1:39 PM, René Nussbaumer <r...@google.com> wrote: >> On Fri, Jun 22, 2012 at 10:46 AM, Agata Murawska >> <agatamuraw...@google.com> wrote: >>> Full hcheck functionality is implemented in this patch. Hcheck runs >>> per-group checks, provides summary for the entire cluster and simulates >>> rebalance if required, the printing the modified metrics. >>> In this patch, only the human-readable output is available. >>> >>> Signed-off-by: Agata Murawska <agatamuraw...@google.com> >>> --- [...] > This interdiff is for the --TODO part. It's just a quick fix and will > be written nicer in next iteration :) > > > diff --git a/htools/Ganeti/HTools/Program/Hcheck.hs > b/htools/Ganeti/HTools/Program/Hcheck.hs > index e593cbb..6ce561f 100644 > --- a/htools/Ganeti/HTools/Program/Hcheck.hs > +++ b/htools/Ganeti/HTools/Program/Hcheck.hs > @@ -192,22 +192,23 @@ simulateRebalance opts (gidx, (nl, il)) = do > ini_tbl = Cluster.Table nl il ini_cv [] > min_cv = optMinScore opts > > - -- TODO: how to write this? this version gives type error > - -- when (ini_cv < min_cv) $ return (gidx, (nl, il)) > - > - let imlen = maximum . map (length . Instance.alias) $ Container.elems il > - nmlen = maximum . map (length . Node.alias) $ Container.elems nl > - > - (fin_tbl, _) <- Hbal.iterateDepth False ini_tbl > - (optMaxLength opts) > - (optDiskMoves opts) > - (optInstMoves opts) > - nmlen imlen [] min_cv > - (optMinGainLim opts) (optMinGain opts) > - (optEvacMode opts) > - > - let (Cluster.Table fin_nl fin_il _ _) = fin_tbl > - return (gidx, (fin_nl, fin_il)) > + > + if (ini_cv < min_cv) > + then return (gidx, (nl, il)) > + else do > + let imlen = maximum . map (length . Instance.alias) $ Container.elems > il > + nmlen = maximum . map (length . Node.alias) $ Container.elems nl > + > + (fin_tbl, _) <- Hbal.iterateDepth False ini_tbl > + (optMaxLength opts) > + (optDiskMoves opts) > + (optInstMoves opts) > + nmlen imlen [] min_cv > + (optMinGainLim opts) (optMinGain > opts) > + (optEvacMode opts) > + > + let (Cluster.Table fin_nl fin_il _ _) = fin_tbl > + return (gidx, (fin_nl, fin_il)) > > -- | Prints the final @OK@ marker in machine readable output. > printFinalHTC :: Bool -> IO ()
LGTM, thanks! René