When dynamic utilization information for a resource is not
available, the default value is used, which is maximal utilization.
This effectively makes hbal spread out an equal number of instances
per node. Of course, dynamic utilization can be ignored all together
by the --ignore-dynu option. However, neither covers the use case
only one resource is scarce and hence should be balanced optimally,
whereas the other resources are not measured, but still should be
ignored. Therefore, add a new option telling hbal to assume 0 utilization
for all resources where no data is provided.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/HTools/CLI.hs | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/Ganeti/HTools/CLI.hs b/src/Ganeti/HTools/CLI.hs
index 232f66a..98a7e33 100644
--- a/src/Ganeti/HTools/CLI.hs
+++ b/src/Ganeti/HTools/CLI.hs
@@ -8,7 +8,7 @@ used in many other places and this is more IO oriented.
 
 {-
 
-Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc.
+Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015 Google Inc.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -72,6 +72,7 @@ module Ganeti.HTools.CLI
   , oForce
   , oFullEvacuation
   , oGroup
+  , oIdleDefault
   , oIAllocSrc
   , oIgnoreDyn
   , oIgnoreNonRedundant
@@ -151,6 +152,8 @@ data Options = Options
   , optSpindleUse  :: Maybe Int      -- ^ Override for the spindle usage
   , optDynuFile    :: Maybe FilePath -- ^ Optional file with dynamic use data
   , optIgnoreDynu  :: Bool           -- ^ Do not use dynamic use data
+  , optIdleDefault :: Bool           -- ^ Assume idle load for all not provided
+                                     -- dynamic utilisation
   , optIgnoreSoftErrors :: Bool      -- ^ Ignore soft errors in balancing moves
   , optIndependentGroups :: Bool     -- ^ consider groups independently
   , optAcceptExisting :: Bool        -- ^ accept existing N+1 violations
@@ -227,6 +230,7 @@ defaultOptions  = Options
   , optDiskTemplate = Nothing
   , optSpindleUse  = Nothing
   , optIgnoreDynu  = False
+  , optIdleDefault = False
   , optIgnoreSoftErrors = False
   , optDynuFile    = Nothing
   , optMonD        = False
@@ -432,6 +436,13 @@ oIgnoreDyn =
    "Ignore any dynamic utilisation information",
    OptComplNone)
 
+oIdleDefault :: OptType
+oIdleDefault =
+  (Option "" ["idle-default"]
+   (NoArg (\ opts -> Ok opts {optIdleDefault = True}))
+   "Assume idleness for any non-availabe dynamic utilisation data",
+   OptComplNone)
+
 oIgnoreSoftErrors :: OptType
 oIgnoreSoftErrors =
   (Option "" ["ignore-soft-errors"]
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to