This new option allows to set the importance of the dynamic
memory utilization in the balancing metrics. In this way,
depending on the usage of the cluster a suitable value to avoid
swapping while still keeping other resources balanced can be
set.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 man/hbal.rst                      | 4 ++++
 src/Ganeti/HTools/Program/Hbal.hs | 7 +++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/man/hbal.rst b/man/hbal.rst
index 389458b..9910de1 100644
--- a/man/hbal.rst
+++ b/man/hbal.rst
@@ -468,6 +468,10 @@ The options that can be passed to the program are as 
follows:
   If given, also query the residual set size for kvm instances, provided
   that monitoring daemons are queried at all.
 
+\--mem-weight=*factor*
+  Scale the weight of the dynamic memory utilization in the cluster metrics
+  by the given factor.
+
 \--exit-on-missing-mond-data
   If given, abort if the data obtainable from querying MonDs is incomplete.
   The default behavior is to continue with a best guess based on the static
diff --git a/src/Ganeti/HTools/Program/Hbal.hs 
b/src/Ganeti/HTools/Program/Hbal.hs
index 4c2c9c9..68572dc 100644
--- a/src/Ganeti/HTools/Program/Hbal.hs
+++ b/src/Ganeti/HTools/Program/Hbal.hs
@@ -50,6 +50,7 @@ import System.IO
 import Text.Printf (printf)
 
 import Ganeti.HTools.AlgorithmParams (AlgorithmOptions(..), fromCLIOptions)
+import Ganeti.HTools.Backend.MonD (scaleMemoryWeight)
 import qualified Ganeti.HTools.Container as Container
 import qualified Ganeti.HTools.Cluster as Cluster
 import qualified Ganeti.HTools.Cluster.Metrics as Metrics
@@ -113,6 +114,7 @@ options = do
     , oMonDExitMissing
     , oMonDXen
     , oMonDKvmRSS
+    , oMemWeight
     , oExTags
     , oExInst
     , oSaveCluster
@@ -315,13 +317,14 @@ main opts args = do
       showinsts = optShowInsts opts
       force = optIgnoreSoftErrors opts
 
-  ini_cdata@(ClusterData gl fixed_nl ilf ctags ipol) <- loadExternalData opts
+  ini_cdata@(ClusterData gl fixed_nl ilf' ctags ipol) <- loadExternalData opts
 
   when (verbose > 1) $ do
        putStrLn $ "Loaded cluster tags: " ++ intercalate "," ctags
        putStrLn $ "Loaded cluster ipolicy: " ++ show ipol
 
-  nlf <- setNodeStatus opts fixed_nl
+  nlf' <- setNodeStatus opts fixed_nl
+  let (nlf, ilf) = scaleMemoryWeight (optMemWeight opts) (nlf', ilf')
   checkCluster verbose nlf ilf
 
   maybeSaveData (optSaveCluster opts) "original" "before balancing" ini_cdata
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to