In this way, we have a convenient way to enable and configure
the automatic balancing my the maintenance daemon.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 lib/cli_opts.py           | 12 ++++++++++++
 lib/client/gnt_cluster.py |  6 +++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lib/cli_opts.py b/lib/cli_opts.py
index c0bd234..00d722b 100644
--- a/lib/cli_opts.py
+++ b/lib/cli_opts.py
@@ -135,6 +135,8 @@ __all__ = [
   "IPOLICY_VCPU_RATIO",
   "LONG_SLEEP_OPT",
   "MAC_PREFIX_OPT",
+  "MAINT_BALANCE_OPT",
+  "MAINT_BALANCE_THRESHOLD_OPT",
   "MAINT_INTERVAL_OPT",
   "MAINTAIN_NODE_HEALTH_OPT",
   "MASTER_NETDEV_OPT",
@@ -1102,6 +1104,16 @@ MAINT_INTERVAL_OPT = \
              default=None, help="Minimal time in seconds, the maintenance"
              " daemon waits between rounds")
 
+MAINT_BALANCE_OPT = \
+  cli_option("--auto-balance-cluster", dest="maint_balance", type="bool",
+             default=None, metavar=_YORNO, help="Whether the maintenance"
+             " daemon should balance the cluster")
+
+MAINT_BALANCE_THRESHOLD_OPT = \
+  cli_option("--auto-balance-threshold", dest="maint_balance_threshold",
+             type="float", default=None, metavar="CLUSTERSCORE",
+             help="Minimal gain for an auto-balancing step to be taken")
+
 VG_NAME_OPT = cli_option("--vg-name", dest="vg_name",
                          help=("Enables LVM and specifies the volume group"
                                " name (cluster-wide) for disk allocation"
diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index f62e16e..8ca1751 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -1361,6 +1361,8 @@ def SetClusterParams(opts, args):
           opts.shared_file_storage_dir is not None or
           opts.enabled_user_shutdown is not None or
           opts.maint_round_delay is not None or
+          opts.maint_balance is not None or
+          opts.maint_balance_threshold is not None or
           opts.data_collector_interval or
           opts.enabled_data_collectors):
     ToStderr("Please give at least one of the parameters.")
@@ -1507,6 +1509,8 @@ def SetClusterParams(opts, args):
     compression_tools=compression_tools,
     enabled_user_shutdown=opts.enabled_user_shutdown,
     maint_round_delay=opts.maint_round_delay,
+    maint_balance=opts.maint_balance,
+    maint_balance_threshold=opts.maint_balance_threshold,
     enabled_data_collectors=enabled_data_collectors,
     data_collector_interval=data_collector_interval,
     )
@@ -2498,7 +2502,7 @@ commands = {
      [GLOBAL_FILEDIR_OPT, GLOBAL_SHARED_FILEDIR_OPT, ZEROING_IMAGE_OPT,
       COMPRESSION_TOOLS_OPT] +
      [ENABLED_DATA_COLLECTORS_OPT, DATA_COLLECTOR_INTERVAL_OPT,
-      MAINT_INTERVAL_OPT],
+      MAINT_INTERVAL_OPT, MAINT_BALANCE_OPT, MAINT_BALANCE_THRESHOLD_OPT],
     "[opts...]",
     "Alters the parameters of the cluster"),
   "renew-crypto": (
-- 
2.4.3.573.g4eafbef

Reply via email to