[Pkg-ganeti-devel] [ganeti] 85/165: hbal: take absolute score bounds relative to N+1 lower bound

Apollon Oikonomopoulos apoikos at moszumanska.debian.org
Tue Aug 11 13:53:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

apoikos pushed a commit to branch master
in repository ganeti.

commit 6c7603698b0c2a46da242dc1fc217d37e37a1822
Author: Klaus Aehlig <aehlig at google.com>
Date:   Tue Mar 17 16:29:27 2015 +0100

    hbal: take absolute score bounds relative to N+1 lower bound
    
    With the recent metric change, a 0 cluster score is no longer
    obtainable due to the need to reserve memory for N+1 redundancy.
    Therefore, interpret all absolute specifications of the cluster
    score relative to the theoretical minimum.
    
    Signed-off-by: Klaus Aehlig <aehlig at google.com>
    Reviewed-by: Petr Pudlak <pudlak at google.com>
---
 src/Ganeti/HTools/Program/Hbal.hs | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/Ganeti/HTools/Program/Hbal.hs b/src/Ganeti/HTools/Program/Hbal.hs
index a396ff9..6137962 100644
--- a/src/Ganeti/HTools/Program/Hbal.hs
+++ b/src/Ganeti/HTools/Program/Hbal.hs
@@ -290,13 +290,14 @@ checkGroup force verbose gname nl il = do
            \ consider using the --ignore-soft-errors option."
 
 -- | Check that we actually need to rebalance.
-checkNeedRebalance :: Options -> Score -> IO ()
-checkNeedRebalance opts ini_cv = do
+checkNeedRebalance :: Options -> Score -> Score -> IO ()
+checkNeedRebalance opts ini_cv opt_cv = do
   let min_cv = optMinScore opts
-  when (ini_cv < min_cv) $ do
+  when (ini_cv - opt_cv < min_cv) $ do
          printf "Cluster is already well balanced (initial score %.6g,\n\
+                \optimum score due to N+1 reservations %.6g,\n\
                 \minimum score %.6g).\nNothing to do, exiting\n"
-                ini_cv min_cv:: IO ()
+                ini_cv opt_cv min_cv:: IO ()
          exitSuccess
 
 -- | Main function.
@@ -329,6 +330,7 @@ main opts args = do
   maybePrintNodes shownodes "Initial cluster" (Cluster.printNodes nl)
 
   let ini_cv = Cluster.compCV nl
+      opt_cv = Cluster.optimalCVScore nl
       ini_tbl = Cluster.Table nl il ini_cv []
       min_cv = optMinScore opts
 
@@ -337,7 +339,7 @@ main opts args = do
            ini_cv (Cluster.printStats "  " nl)::IO ()
     else printf "Initial score: %.8f\n" ini_cv
 
-  checkNeedRebalance opts ini_cv
+  checkNeedRebalance opts ini_cv opt_cv
 
   putStrLn "Trying to minimize the CV..."
   let imlen = maximum . map (length . Instance.alias) $ Container.elems il
@@ -345,7 +347,7 @@ main opts args = do
 
   (fin_tbl, cmd_strs) <- iterateDepth True (fromCLIOptions opts) ini_tbl
                          (optMaxLength opts)
-                         nmlen imlen [] min_cv
+                         nmlen imlen [] (opt_cv + min_cv)
   let (Cluster.Table fin_nl fin_il fin_cv fin_plc) = fin_tbl
       ord_plc = reverse fin_plc
       sol_msg = case () of

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ganeti/ganeti.git



More information about the Pkg-ganeti-devel mailing list