This required a slight tweak since in init we want a different default.
---
 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 b696965..9344169 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 1a71efa..32e012e 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"),
-- 
1.6.3.3

Reply via email to