Commit 5af3da74 authored by Guido Trotter's avatar Guido Trotter
Browse files

Allow modifying of default nic parameters


Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b6a30b0d
......@@ -1486,12 +1486,18 @@ class LUSetClusterParams(LogicalUnit):
(node, vgstatus))
self.cluster = cluster = self.cfg.GetClusterInfo()
# validate beparams changes
# validate params changes
if self.op.beparams:
utils.ForceDictType(self.op.beparams, constants.BES_PARAMETER_TYPES)
self.new_beparams = objects.FillDict(
cluster.beparams[constants.PP_DEFAULT], self.op.beparams)
if self.op.nicparams:
utils.ForceDictType(self.op.nicparams, constants.NICS_PARAMETER_TYPES)
self.new_nicparams = objects.FillDict(
cluster.nicparams[constants.PP_DEFAULT], self.op.nicparams)
objects.NIC.CheckParameterSyntax(self.new_nicparams)
# hypervisor list/parameters
self.new_hvparams = objects.FillDict(cluster.hvparams, {})
if self.op.hvparams:
......@@ -1539,6 +1545,9 @@ class LUSetClusterParams(LogicalUnit):
self.cluster.enabled_hypervisors = self.op.enabled_hypervisors
if self.op.beparams:
self.cluster.beparams[constants.PP_DEFAULT] = self.new_beparams
if self.op.nicparams:
self.cluster.nicparams[constants.PP_DEFAULT] = self.new_nicparams
if self.op.candidate_pool_size is not None:
self.cluster.candidate_pool_size = self.op.candidate_pool_size
......
......@@ -262,6 +262,7 @@ class OpSetClusterParams(OpCode):
"enabled_hypervisors",
"hvparams",
"beparams",
"nicparams",
"candidate_pool_size",
]
......
......@@ -457,7 +457,8 @@ def SetClusterParams(opts, args):
"""
if not (not opts.lvm_storage or opts.vg_name or
opts.enabled_hypervisors or opts.hvparams or
opts.beparams or opts.candidate_pool_size is not None):
opts.beparams or opts.nicparams or
opts.candidate_pool_size is not None):
ToStderr("Please give at least one of the parameters.")
return 1
......@@ -480,10 +481,14 @@ def SetClusterParams(opts, args):
beparams = opts.beparams
utils.ForceDictType(beparams, constants.BES_PARAMETER_TYPES)
nicparams = opts.nicparams
utils.ForceDictType(nicparams, constants.NICS_PARAMETER_TYPES)
op = opcodes.OpSetClusterParams(vg_name=vg_name,
enabled_hypervisors=hvlist,
hvparams=hvparams,
beparams=beparams,
nicparams=nicparams,
candidate_pool_size=opts.candidate_pool_size)
SubmitOpCode(op)
return 0
......@@ -667,6 +672,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=None,
help="Set the candidate pool size",
dest="candidate_pool_size", type="int"),
......
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