From 08a61d91e6afcc255d25c0be6b095ab319f12312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Wed, 24 Nov 2010 11:59:35 +0100 Subject: [PATCH] Adding ndparams to their OpCodes and LU calls 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/cmdlib.py | 23 +++++++++++++++++++++++ lib/opcodes.py | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 267e4e81f..79a2629b0 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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: diff --git a/lib/opcodes.py b/lib/opcodes.py index b9162870c..6cfffbea8 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -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", ] -- GitLab