diff --git a/lib/cli.py b/lib/cli.py index e59422efe9b807898c51bca2432b999298bd1e75..feb680e68d8d8ef79e2b4739eb0a469ef9c74b17 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 1a71efac1686a8841c41d179a9d00abf56f0b381..32e012e296eb5eb33800ffeca844419f65ce072d 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"),