From e32df52890669e39c00723b49e7361fbbc0c031f Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Thu, 17 Sep 2009 14:21:33 +0200 Subject: [PATCH] =?UTF-8?q?Unify=20the=20=E2=80=9C--candidate-pool-size?= =?UTF-8?q?=E2=80=9D=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This required a slight tweak since in init we want a different default. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/cli.py | 5 +++++ scripts/gnt-cluster | 12 +++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/cli.py b/lib/cli.py index e59422efe..feb680e68 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -50,6 +50,7 @@ __all__ = [ "BACKEND_OPT", "CLEANUP_OPT", "CONFIRM_OPT", + "CP_SIZE_OPT", "DEBUG_OPT", "DEBUG_SIMERR_OPT", "DISKIDX_OPT", @@ -732,6 +733,10 @@ NIC_PARAMS_OPT = cli_option("-N", "--nic-parameters", dest="nicparams", type="keyval", default={}, help="NIC parameters") +CP_SIZE_OPT = cli_option("-C", "--candidate-pool-size", default=None, + dest="candidate_pool_size", type="int", + help="Set the candidate pool size") + def _ParseArgs(argv, commands, aliases): """Parser for the command line arguments. diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index 1a71efac1..32e012e29 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -81,6 +81,9 @@ def InitCluster(opts, args): hvparams[hv] = objects.FillDict(constants.HVC_DEFAULTS[hv], hvparams[hv]) utils.ForceDictType(hvparams[hv], constants.HVS_PARAMETER_TYPES) + if opts.candidate_pool_size is None: + opts.candidate_pool_size = constants.MASTER_POOL_SIZE_DEFAULT + bootstrap.InitCluster(cluster_name=args[0], secondary_ip=opts.secondary_ip, vg_name=vg_name, @@ -623,10 +626,7 @@ commands = { HVLIST_OPT, BACKEND_OPT, NIC_PARAMS_OPT, - cli_option("-C", "--candidate-pool-size", - default=constants.MASTER_POOL_SIZE_DEFAULT, - help="Set the candidate pool size", - dest="candidate_pool_size", type="int"), + CP_SIZE_OPT, ], "[opts...] <cluster_name>", "Initialises a new cluster configuration"), @@ -711,9 +711,7 @@ commands = { HVLIST_OPT, BACKEND_OPT, NIC_PARAMS_OPT, - cli_option("-C", "--candidate-pool-size", default=None, - help="Set the candidate pool size", - dest="candidate_pool_size", type="int"), + CP_SIZE_OPT, ], "[opts...]", "Alters the parameters of the cluster"), -- GitLab