Commit 08a61d91 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Adding ndparams to their OpCodes and LU calls


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 0a31dda0
......@@ -2589,6 +2589,7 @@ class LUSetClusterParams(LogicalUnit):
("maintain_node_health", None, ht.TMaybeBool),
("prealloc_wipe_disks", None, ht.TMaybeBool),
("nicparams", None, ht.TOr(ht.TDict, ht.TNone)),
("ndparams", None, ht.TOr(ht.TDict, ht.TNone)),
("drbd_helper", None, ht.TOr(ht.TString, ht.TNone)),
("default_iallocator", None, ht.TOr(ht.TString, ht.TNone)),
("reserved_lvs", None, ht.TOr(ht.TListOf(ht.TNonEmptyString), ht.TNone)),
......@@ -2698,6 +2699,10 @@ class LUSetClusterParams(LogicalUnit):
utils.ForceDictType(self.op.beparams, constants.BES_PARAMETER_TYPES)
self.new_beparams = cluster.SimpleFillBE(self.op.beparams)
if self.op.ndparams:
utils.ForceDictType(self.op.ndparams, constants.NDS_PARAMETER_TYPES)
self.new_ndparams = cluster.SimpleFillND(self.op.ndparams)
if self.op.nicparams:
utils.ForceDictType(self.op.nicparams, constants.NICS_PARAMETER_TYPES)
self.new_nicparams = cluster.SimpleFillNIC(self.op.nicparams)
......@@ -2851,6 +2856,8 @@ class LUSetClusterParams(LogicalUnit):
self.cluster.nicparams[constants.PP_DEFAULT] = self.new_nicparams
if self.op.osparams:
self.cluster.osparams = self.new_osp
if self.op.ndparams:
self.cluster.ndparams = self.new_ndparams
if self.op.candidate_pool_size is not None:
self.cluster.candidate_pool_size = self.op.candidate_pool_size
......@@ -3741,6 +3748,7 @@ class LUAddNode(LogicalUnit):
("group", None, ht.TMaybeString),
("master_capable", None, ht.TMaybeBool),
("vm_capable", None, ht.TMaybeBool),
("ndparams", None, ht.TOr(ht.TDict, ht.TNone)),
]
_NFLAGS = ["master_capable", "vm_capable"]
......@@ -3900,6 +3908,9 @@ class LUAddNode(LogicalUnit):
offline=False, drained=False,
group=node_group)
if self.op.ndparams:
utils.ForceDictType(self.op.ndparams, constants.NDS_PARAMETER_TYPES)
def Exec(self, feedback_fn):
"""Adds the new node to the cluster.
......@@ -3927,6 +3938,9 @@ class LUAddNode(LogicalUnit):
if new_node.master_candidate:
self.LogInfo("Node will be a master candidate")
if self.op.ndparams:
new_node.ndparams = self.op.ndparams
# check connectivity
result = self.rpc.call_version([node])[node]
result.Raise("Can't get version information from node %s" % node)
......@@ -4007,6 +4021,7 @@ class LUSetNodeParams(LogicalUnit):
("master_capable", None, ht.TMaybeBool),
("vm_capable", None, ht.TMaybeBool),
("secondary_ip", None, ht.TMaybeString),
("ndparams", None, ht.TOr(ht.TDict, ht.TNone)),
_PForce,
]
REQ_BGL = False
......@@ -4220,6 +4235,11 @@ class LUSetNodeParams(LogicalUnit):
" based ping to node daemon port",
errors.ECODE_ENVIRON)
if self.op.ndparams:
new_ndparams = _GetUpdatedParams(self.node.ndparams, self.op.ndparams)
utils.ForceDictType(new_ndparams, constants.NDS_PARAMETER_TYPES)
self.new_ndparams = new_ndparams
def Exec(self, feedback_fn):
"""Modifies a node.
......@@ -4230,6 +4250,9 @@ class LUSetNodeParams(LogicalUnit):
result = []
if self.op.ndparams:
node.ndparams = self.new_ndparams
for attr in ["master_capable", "vm_capable"]:
val = getattr(self.op, attr)
if val is not None:
......
......@@ -309,6 +309,7 @@ class OpSetClusterParams(OpCode):
"beparams",
"osparams",
"nicparams",
"ndparams",
"candidate_pool_size",
"maintain_node_health",
"uid_pool",
......@@ -375,7 +376,7 @@ class OpAddNode(OpCode):
OP_ID = "OP_NODE_ADD"
OP_DSC_FIELD = "node_name"
__slots__ = ["node_name", "primary_ip", "secondary_ip", "readd", "group",
"vm_capable", "master_capable"]
"vm_capable", "master_capable", "ndparams"]
class OpQueryNodes(OpCode):
......@@ -438,6 +439,7 @@ class OpSetNodeParams(OpCode):
"master_capable",
"vm_capable",
"secondary_ip",
"ndparams",
]
......
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