In this way there is, again, only one balancing
function left. This will simplify the removal of the
positional flags in the following commits.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/HTools/Cluster.hs          | 33 ++++++++++-----------------------
 src/Ganeti/HTools/Program/Hbal.hs     |  2 +-
 src/Ganeti/HTools/Program/Hsqueeze.hs |  3 ++-
 3 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/src/Ganeti/HTools/Cluster.hs b/src/Ganeti/HTools/Cluster.hs
index f79ac71..79e2085 100644
--- a/src/Ganeti/HTools/Cluster.hs
+++ b/src/Ganeti/HTools/Cluster.hs
@@ -56,7 +56,6 @@ module Ganeti.HTools.Cluster
   , checkMove
   , doNextBalance
   , tryBalance
-  , tryBalanceEx
   , compCV
   , compCVNodes
   , compDetailedCV
@@ -728,16 +727,16 @@ doNextBalance ini_tbl max_rounds min_score =
   in (max_rounds < 0 || ini_plc_len < max_rounds) && ini_cv > min_score
 
 -- | Run a balance move.
-tryBalanceEx :: Bool           -- ^ Ignore soft errors
-                -> Table       -- ^ The starting table
-                -> Bool        -- ^ Allow disk moves
-                -> Bool        -- ^ Allow instance moves
-                -> Bool        -- ^ Only evacuate moves
-                -> Bool        -- ^ Restrict migration
-                -> Score       -- ^ Min gain threshold
-                -> Score       -- ^ Min gain
-                -> Maybe Table -- ^ The resulting table and commands
-tryBalanceEx force ini_tbl disk_moves inst_moves evac_mode rest_mig mg_limit
+tryBalance :: Bool           -- ^ Ignore soft errors
+              -> Table       -- ^ The starting table
+              -> Bool        -- ^ Allow disk moves
+              -> Bool        -- ^ Allow instance moves
+              -> Bool        -- ^ Only evacuate moves
+              -> Bool        -- ^ Restrict migration
+              -> Score       -- ^ Min gain threshold
+              -> Score       -- ^ Min gain
+              -> Maybe Table -- ^ The resulting table and commands
+tryBalance force ini_tbl disk_moves inst_moves evac_mode rest_mig mg_limit
              min_gain =
     let Table ini_nl ini_il ini_cv _ = ini_tbl
         all_inst = Container.elems ini_il
@@ -759,18 +758,6 @@ tryBalanceEx force ini_tbl disk_moves inst_moves evac_mode 
rest_mig mg_limit
       then Just fin_tbl -- this round made success, return the new table
       else Nothing
 
--- | Run a balance move.
-tryBalance :: Table       -- ^ The starting table
-           -> Bool        -- ^ Allow disk moves
-           -> Bool        -- ^ Allow instance moves
-           -> Bool        -- ^ Only evacuate moves
-           -> Bool        -- ^ Restrict migration
-           -> Score       -- ^ Min gain threshold
-           -> Score       -- ^ Min gain
-           -> Maybe Table -- ^ The resulting table and commands
-tryBalance = tryBalanceEx False
-
-
 -- * Allocation functions
 
 -- | Build failure stats out of a list of failures.
diff --git a/src/Ganeti/HTools/Program/Hbal.hs 
b/src/Ganeti/HTools/Program/Hbal.hs
index 885b973..3780525 100644
--- a/src/Ganeti/HTools/Program/Hbal.hs
+++ b/src/Ganeti/HTools/Program/Hbal.hs
@@ -141,7 +141,7 @@ iterateDepth force printmove ini_tbl max_rounds disk_moves 
inst_moves rest_mig
   let Cluster.Table ini_nl ini_il _ _ = ini_tbl
       allowed_next = Cluster.doNextBalance ini_tbl max_rounds min_score
       m_fin_tbl = if allowed_next
-                    then Cluster.tryBalanceEx force ini_tbl disk_moves
+                    then Cluster.tryBalance force ini_tbl disk_moves
                            inst_moves evac_mode rest_mig mg_limit min_gain
                     else Nothing
   in case m_fin_tbl of
diff --git a/src/Ganeti/HTools/Program/Hsqueeze.hs 
b/src/Ganeti/HTools/Program/Hsqueeze.hs
index 90cd419..b518195 100644
--- a/src/Ganeti/HTools/Program/Hsqueeze.hs
+++ b/src/Ganeti/HTools/Program/Hsqueeze.hs
@@ -110,7 +110,8 @@ balance :: (Node.List, Instance.List)
 balance (nl, il) =
   let ini_cv = Cluster.compCV nl
       ini_tbl = Cluster.Table nl il ini_cv []
-      balanceStep tbl = Cluster.tryBalance tbl True True False False 0.0 0.0
+      balanceStep tbl = Cluster.tryBalance False tbl True True False False
+                                           0.0 0.0
       bTables = map fromJust . takeWhile isJust
                   $ iterate (>>= balanceStep) (Just ini_tbl)
       (Cluster.Table nl' il' _ _) = last bTables
-- 
2.0.0.526.g5318336

Reply via email to