Commit 6204ee71 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Adding ndparams to gnt-cluster init|modify and man page



This is reverting the revert and adaption to fix the issue which caused
the revert
Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent c033f259
...@@ -223,10 +223,10 @@ def _InitFileStorage(file_storage_dir): ...@@ -223,10 +223,10 @@ def _InitFileStorage(file_storage_dir):
def InitCluster(cluster_name, mac_prefix, def InitCluster(cluster_name, mac_prefix,
master_netdev, file_storage_dir, candidate_pool_size, master_netdev, file_storage_dir, candidate_pool_size,
secondary_ip=None, vg_name=None, beparams=None, secondary_ip=None, vg_name=None, beparams=None,
nicparams=None, hvparams=None, enabled_hypervisors=None, nicparams=None, ndparams=None, hvparams=None,
modify_etc_hosts=True, modify_ssh_setup=True, enabled_hypervisors=None, modify_etc_hosts=True,
maintain_node_health=False, drbd_helper=None, modify_ssh_setup=True, maintain_node_health=False,
uid_pool=None, default_iallocator=None, drbd_helper=None, uid_pool=None, default_iallocator=None,
primary_ip_version=None, prealloc_wipe_disks=False): primary_ip_version=None, prealloc_wipe_disks=False):
"""Initialise the cluster. """Initialise the cluster.
...@@ -340,6 +340,11 @@ def InitCluster(cluster_name, mac_prefix, ...@@ -340,6 +340,11 @@ def InitCluster(cluster_name, mac_prefix,
utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES) utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
objects.NIC.CheckParameterSyntax(nicparams) 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 # hvparams is a mapping of hypervisor->hvparams dict
for hv_name, hv_params in hvparams.iteritems(): for hv_name, hv_params in hvparams.iteritems():
utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES) utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES)
...@@ -383,6 +388,7 @@ def InitCluster(cluster_name, mac_prefix, ...@@ -383,6 +388,7 @@ def InitCluster(cluster_name, mac_prefix,
enabled_hypervisors=enabled_hypervisors, enabled_hypervisors=enabled_hypervisors,
beparams={constants.PP_DEFAULT: beparams}, beparams={constants.PP_DEFAULT: beparams},
nicparams={constants.PP_DEFAULT: nicparams}, nicparams={constants.PP_DEFAULT: nicparams},
ndparams=ndparams,
hvparams=hvparams, hvparams=hvparams,
candidate_pool_size=candidate_pool_size, candidate_pool_size=candidate_pool_size,
modify_etc_hosts=modify_etc_hosts, modify_etc_hosts=modify_etc_hosts,
......
...@@ -87,6 +87,13 @@ def InitCluster(opts, args): ...@@ -87,6 +87,13 @@ def InitCluster(opts, args):
nicparams = objects.FillDict(constants.NICC_DEFAULTS, nicparams) nicparams = objects.FillDict(constants.NICC_DEFAULTS, nicparams)
utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES) 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 # prepare hvparams dict
for hv in constants.HYPER_TYPES: for hv in constants.HYPER_TYPES:
if hv not in hvparams: if hv not in hvparams:
...@@ -123,6 +130,7 @@ def InitCluster(opts, args): ...@@ -123,6 +130,7 @@ def InitCluster(opts, args):
hvparams=hvparams, hvparams=hvparams,
beparams=beparams, beparams=beparams,
nicparams=nicparams, nicparams=nicparams,
ndparams=ndparams,
candidate_pool_size=opts.candidate_pool_size, candidate_pool_size=opts.candidate_pool_size,
modify_etc_hosts=opts.modify_etc_hosts, modify_etc_hosts=opts.modify_etc_hosts,
modify_ssh_setup=opts.modify_ssh_setup, modify_ssh_setup=opts.modify_ssh_setup,
...@@ -706,7 +714,7 @@ def SetClusterParams(opts, args): ...@@ -706,7 +714,7 @@ def SetClusterParams(opts, args):
if not (not opts.lvm_storage or opts.vg_name or if not (not opts.lvm_storage or opts.vg_name or
not opts.drbd_storage or opts.drbd_helper or not opts.drbd_storage or opts.drbd_helper or
opts.enabled_hypervisors or opts.hvparams 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.candidate_pool_size is not None or
opts.uid_pool is not None or opts.uid_pool is not None or
opts.maintain_node_health is not None or opts.maintain_node_health is not None or
...@@ -749,6 +757,9 @@ def SetClusterParams(opts, args): ...@@ -749,6 +757,9 @@ def SetClusterParams(opts, args):
nicparams = opts.nicparams nicparams = opts.nicparams
utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES) 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 mnh = opts.maintain_node_health
...@@ -777,6 +788,7 @@ def SetClusterParams(opts, args): ...@@ -777,6 +788,7 @@ def SetClusterParams(opts, args):
os_hvp=None, os_hvp=None,
beparams=beparams, beparams=beparams,
nicparams=nicparams, nicparams=nicparams,
ndparams=ndparams,
candidate_pool_size=opts.candidate_pool_size, candidate_pool_size=opts.candidate_pool_size,
maintain_node_health=mnh, maintain_node_health=mnh,
uid_pool=uid_pool, uid_pool=uid_pool,
...@@ -868,7 +880,8 @@ commands = { ...@@ -868,7 +880,8 @@ commands = {
NOLVM_STORAGE_OPT, NOMODIFY_ETCHOSTS_OPT, NOMODIFY_SSH_SETUP_OPT, NOLVM_STORAGE_OPT, NOMODIFY_ETCHOSTS_OPT, NOMODIFY_SSH_SETUP_OPT,
SECONDARY_IP_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT, SECONDARY_IP_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
UIDPOOL_OPT, DRBD_HELPER_OPT, NODRBD_STORAGE_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"), "[opts...] <cluster_name>", "Initialises a new cluster configuration"),
'destroy': ( 'destroy': (
DestroyCluster, ARGS_NONE, [YES_DOIT_OPT], DestroyCluster, ARGS_NONE, [YES_DOIT_OPT],
...@@ -944,7 +957,7 @@ commands = { ...@@ -944,7 +957,7 @@ commands = {
NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT, NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT, MAINTAIN_NODE_HEALTH_OPT,
UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT, DRBD_HELPER_OPT, UIDPOOL_OPT, ADD_UIDS_OPT, REMOVE_UIDS_OPT, DRBD_HELPER_OPT,
NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT, RESERVED_LVS_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...]", "[opts...]",
"Alters the parameters of the cluster"), "Alters the parameters of the cluster"),
"renew-crypto": ( "renew-crypto": (
......
...@@ -134,6 +134,7 @@ INIT ...@@ -134,6 +134,7 @@ INIT
| [-I *default instance allocator*] | [-I *default instance allocator*]
| [--primary-ip-version *version*] | [--primary-ip-version *version*]
| [--prealloc-wipe-disks {yes \| no}] | [--prealloc-wipe-disks {yes \| no}]
| [--node-parameters *ndparams*]
| {*clustername*} | {*clustername*}
This commands is only run once initially on the first node of the 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 ...@@ -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 IPv6, respectively. This option is used when resolving node names
and the cluster name. 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 LIST-TAGS
~~~~~~~~~ ~~~~~~~~~
...@@ -378,14 +383,15 @@ MODIFY ...@@ -378,14 +383,15 @@ MODIFY
| [--prealloc-wipe-disks {yes \| no}] | [--prealloc-wipe-disks {yes \| no}]
| [-I *default instance allocator*] | [-I *default instance allocator*]
| [--reserved-lvs=*NAMES*] | [--reserved-lvs=*NAMES*]
| [--node-parameters *ndparams*]
Modify the options for the cluster. Modify the options for the cluster.
The ``--vg-name``, ``--no-lvm-storarge``, The ``--vg-name``, ``--no-lvm-storarge``, ``--enabled-hypervisors``,
``--enabled-hypervisors``, ``--hypervisor-parameters``, ``--hypervisor-parameters``, ``--backend-parameters``,
``--backend-parameters``, ``--nic-parameters``, ``--nic-parameters``, ``--maintain-node-health``,
``--maintain-node-health``, ``--prealloc-wipe-disks``, ``--prealloc-wipe-disks``, ``--uid-pool``, ``--node-parameters`` options
``--uid-pool`` options are described in the **init** command. are described in the **init** command.
The ``-C`` option specifies the ``candidate_pool_size`` cluster The ``-C`` option specifies the ``candidate_pool_size`` cluster
parameter. This is the number of nodes that the master will try to parameter. This is the number of nodes that the master will try to
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment