From cb1ef9736dec68d6786359bc7d019f0bbee48c61 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com>
Date: Fri, 26 Nov 2010 15:04:34 +0100
Subject: [PATCH] Adding ndparams to gnt-cluster init|modify and man page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: RenΓ© Nussbaumer <rn@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/client/gnt_cluster.py | 16 +++++++++++++---
 man/gnt-cluster.rst       | 16 +++++++++++-----
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/lib/client/gnt_cluster.py b/lib/client/gnt_cluster.py
index 8714a213e..c643f2c8e 100644
--- a/lib/client/gnt_cluster.py
+++ b/lib/client/gnt_cluster.py
@@ -78,6 +78,7 @@ def InitCluster(opts, args):
   hvparams = dict(opts.hvparams)
   beparams = opts.beparams
   nicparams = opts.nicparams
+  ndparams = opts.ndparams
 
   # prepare beparams dict
   beparams = objects.FillDict(constants.BEC_DEFAULTS, beparams)
@@ -87,6 +88,10 @@ def InitCluster(opts, args):
   nicparams = objects.FillDict(constants.NICC_DEFAULTS, nicparams)
   utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
 
+  # prepare ndparams dict
+  ndparams = objects.FillDict(constants.NDC_DEFAULTS, ndparams)
+  utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES)
+
   # prepare hvparams dict
   for hv in constants.HYPER_TYPES:
     if hv not in hvparams:
@@ -123,6 +128,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 +712,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 +755,8 @@ def SetClusterParams(opts, args):
   nicparams = opts.nicparams
   utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
 
+  ndparams = opts.ndparams
+  utils.ForceDictType(ndparams, constants.NDS_PARAMETER_TYPES)
 
   mnh = opts.maintain_node_health
 
@@ -777,6 +785,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 +877,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 +954,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": (
diff --git a/man/gnt-cluster.rst b/man/gnt-cluster.rst
index 2c35e801f..ca7baa5c1 100644
--- a/man/gnt-cluster.rst
+++ b/man/gnt-cluster.rst
@@ -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
-- 
GitLab