Adding ndparams to gnt-cluster init|modify and man page
authorRené Nussbaumer <rn@google.com>
Tue, 30 Nov 2010 09:20:48 +0000 (10:20 +0100)
committerRené Nussbaumer <rn@google.com>
Wed, 1 Dec 2010 13:36:29 +0000 (14:36 +0100)
This is reverting the revert and adaption to fix the issue which caused
the revert

Signed-off-by: René Nussbaumer <rn@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

lib/bootstrap.py
lib/client/gnt_cluster.py
man/gnt-cluster.rst

index ea2a829..47fc021 100644 (file)
@@ -223,10 +223,10 @@ def _InitFileStorage(file_storage_dir):
 def InitCluster(cluster_name, mac_prefix,
                 master_netdev, file_storage_dir, candidate_pool_size,
                 secondary_ip=None, vg_name=None, beparams=None,
-                nicparams=None, hvparams=None, enabled_hypervisors=None,
-                modify_etc_hosts=True, modify_ssh_setup=True,
-                maintain_node_health=False, drbd_helper=None,
-                uid_pool=None, default_iallocator=None,
+                nicparams=None, ndparams=None, hvparams=None,
+                enabled_hypervisors=None, modify_etc_hosts=True,
+                modify_ssh_setup=True, maintain_node_health=False,
+                drbd_helper=None, uid_pool=None, default_iallocator=None,
                 primary_ip_version=None, prealloc_wipe_disks=False):
   """Initialise the cluster.
 
@@ -340,6 +340,11 @@ def InitCluster(cluster_name, mac_prefix,
   utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
   objects.NIC.CheckParameterSyntax(nicparams)
 
+  if ndparams is not None:
+    utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES)
+  else:
+    ndparams = dict(constants.NDC_DEFAULTS)
+
   # hvparams is a mapping of hypervisor->hvparams dict
   for hv_name, hv_params in hvparams.iteritems():
     utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES)
@@ -383,6 +388,7 @@ def InitCluster(cluster_name, mac_prefix,
     enabled_hypervisors=enabled_hypervisors,
     beparams={constants.PP_DEFAULT: beparams},
     nicparams={constants.PP_DEFAULT: nicparams},
+    ndparams=ndparams,
     hvparams=hvparams,
     candidate_pool_size=candidate_pool_size,
     modify_etc_hosts=modify_etc_hosts,
index 8714a21..36fbf49 100644 (file)
@@ -87,6 +87,13 @@ def InitCluster(opts, args):
   nicparams = objects.FillDict(constants.NICC_DEFAULTS, nicparams)
   utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
 
+  # prepare ndparams dict
+  if opts.ndparams is None:
+    ndparams = dict(constants.NDC_DEFAULTS)
+  else:
+    ndparams = objects.FillDict(constants.NDC_DEFAULTS, opts.ndparams)
+    utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES)
+
   # prepare hvparams dict
   for hv in constants.HYPER_TYPES:
     if hv not in hvparams:
@@ -123,6 +130,7 @@ def InitCluster(opts, args):
                         hvparams=hvparams,
                         beparams=beparams,
                         nicparams=nicparams,
+                        ndparams=ndparams,
                         candidate_pool_size=opts.candidate_pool_size,
                         modify_etc_hosts=opts.modify_etc_hosts,
                         modify_ssh_setup=opts.modify_ssh_setup,
@@ -706,7 +714,7 @@ def SetClusterParams(opts, args):
   if not (not opts.lvm_storage or opts.vg_name or
           not opts.drbd_storage or opts.drbd_helper or
           opts.enabled_hypervisors or opts.hvparams or
-          opts.beparams or opts.nicparams or
+          opts.beparams or opts.nicparams or opts.ndparams or
           opts.candidate_pool_size is not None or
           opts.uid_pool is not None or
           opts.maintain_node_health is not None or
@@ -749,6 +757,9 @@ def SetClusterParams(opts, args):
   nicparams = opts.nicparams
   utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
 
+  ndparams = opts.ndparams
+  if ndparams is not None:
+    utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES)
 
   mnh = opts.maintain_node_health
 
@@ -777,6 +788,7 @@ def SetClusterParams(opts, args):
                                   os_hvp=None,
                                   beparams=beparams,
                                   nicparams=nicparams,
+                                  ndparams=ndparams,
                                   candidate_pool_size=opts.candidate_pool_size,
                                   maintain_node_health=mnh,
                                   uid_pool=uid_pool,
@@ -868,7 +880,8 @@ commands = {
      NOLVM_STORAGE_OPT, NOMODIFY_ETCHOSTS_OPT, NOMODIFY_SSH_SETUP_OPT,
      SECONDARY_IP_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
      UIDPOOL_OPT, DRBD_HELPER_OPT, NODRBD_STORAGE_OPT,
-     DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT],
+     DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT,
+     NODE_PARAMS_OPT],
     "[opts...] <cluster_name>", "Initialises a new cluster configuration"),
   'destroy': (
     DestroyCluster, ARGS_NONE, [YES_DOIT_OPT],
@@ -944,7 +957,7 @@ commands = {
      NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
      UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT, DRBD_HELPER_OPT,
      NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT, RESERVED_LVS_OPT,
-     DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT],
+     DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT, NODE_PARAMS_OPT],
     "[opts...]",
     "Alters the parameters of the cluster"),
   "renew-crypto": (
index 2c35e80..ca7baa5 100644 (file)
@@ -134,6 +134,7 @@ INIT
 | [-I *default instance allocator*]
 | [--primary-ip-version *version*]
 | [--prealloc-wipe-disks {yes \| no}]
+| [--node-parameters *ndparams*]
 | {*clustername*}
 
 This commands is only run once initially on the first node of the
@@ -323,6 +324,10 @@ for the primary address. Possible values are 4 and 6 for IPv4 and
 IPv6, respectively. This option is used when resolving node names
 and the cluster name.
 
+The ``--node-parameters`` option allows you to set default node
+parameters for the cluster. Please see **ganeti**(7) for more
+information about supported key=value pairs.
+
 LIST-TAGS
 ~~~~~~~~~
 
@@ -378,14 +383,15 @@ MODIFY
 | [--prealloc-wipe-disks {yes \| no}]
 | [-I *default instance allocator*]
 | [--reserved-lvs=*NAMES*]
+| [--node-parameters *ndparams*]
 
 Modify the options for the cluster.
 
-The ``--vg-name``, ``--no-lvm-storarge``,
-``--enabled-hypervisors``, ``--hypervisor-parameters``,
-``--backend-parameters``, ``--nic-parameters``,
-``--maintain-node-health``, ``--prealloc-wipe-disks``,
-``--uid-pool`` options are described in the **init** command.
+The ``--vg-name``, ``--no-lvm-storarge``, ``--enabled-hypervisors``,
+``--hypervisor-parameters``, ``--backend-parameters``,
+``--nic-parameters``, ``--maintain-node-health``,
+``--prealloc-wipe-disks``, ``--uid-pool``, ``--node-parameters`` options
+are described in the **init** command.
 
 The ``-C`` option specifies the ``candidate_pool_size`` cluster
 parameter. This is the number of nodes that the master will try to