Commit b6a30b0d authored by Guido Trotter's avatar Guido Trotter

Allow setting NIC parameters at gnt-cluster init

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent d3cfe525
......@@ -122,9 +122,9 @@ def _InitGanetiServerSetup():
def InitCluster(cluster_name, mac_prefix, def_bridge,
master_netdev, file_storage_dir, candidate_pool_size,
secondary_ip=None, vg_name=None, beparams=None, hvparams=None,
enabled_hypervisors=None, default_hypervisor=None,
modify_etc_hosts=True):
secondary_ip=None, vg_name=None, beparams=None,
nicparams=None, hvparams=None, enabled_hypervisors=None,
default_hypervisor=None, modify_etc_hosts=True):
"""Initialise the cluster.
@type candidate_pool_size: int
......@@ -209,6 +209,9 @@ def InitCluster(cluster_name, mac_prefix, def_bridge,
utils.EnsureDirs(dirs)
utils.ForceDictType(beparams, constants.BES_PARAMETER_TYPES)
utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
objects.NIC.CheckParameterSyntax(nicparams)
# hvparams is a mapping of hypervisor->hvparams dict
for hv_name, hv_params in hvparams.iteritems():
utils.ForceDictType(hv_params, constants.HVS_PARAMETER_TYPES)
......@@ -248,6 +251,7 @@ def InitCluster(cluster_name, mac_prefix, def_bridge,
enabled_hypervisors=enabled_hypervisors,
default_hypervisor=default_hypervisor,
beparams={constants.PP_DEFAULT: beparams},
nicparams={constants.PP_DEFAULT: nicparams},
hvparams=hvparams,
candidate_pool_size=candidate_pool_size,
modify_etc_hosts=modify_etc_hosts,
......
......@@ -72,11 +72,16 @@ def InitCluster(opts, args):
hvparams = dict(opts.hvparams)
beparams = opts.beparams
nicparams = opts.nicparams
# prepare beparams dict
beparams = objects.FillDict(constants.BEC_DEFAULTS, beparams)
utils.ForceDictType(beparams, constants.BES_PARAMETER_TYPES)
# prepare nicparams dict
nicparams = objects.FillDict(constants.NICC_DEFAULTS, nicparams)
utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
# prepare hvparams dict
for hv in constants.HYPER_TYPES:
if hv not in hvparams:
......@@ -100,6 +105,7 @@ def InitCluster(opts, args):
default_hypervisor=opts.default_hypervisor,
hvparams=hvparams,
beparams=beparams,
nicparams=nicparams,
candidate_pool_size=opts.candidate_pool_size,
modify_etc_hosts=opts.modify_etc_hosts,
)
......@@ -579,6 +585,9 @@ commands = {
keyval_option("-B", "--backend-parameters", dest="beparams",
type="keyval", default={},
help="Backend parameters"),
keyval_option("-N", "--nic-parameters", dest="nicparams",
type="keyval", default={},
help="NIC parameters"),
make_option("-C", "--candidate-pool-size",
default=constants.MASTER_POOL_SIZE_DEFAULT,
help="Set the candidate pool size",
......
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