From 21d7064250ba06509d9df83038bedce54eb4e631 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Mon, 23 May 2011 15:58:29 +0200 Subject: [PATCH] Remove old node evacuation opcode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LUNodeEvacStrategy has been replaced with LUNodeEvacuate. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/cmdlib.py | 47 ----------------------------------------------- lib/opcodes.py | 10 ---------- 2 files changed, 57 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 164111895..607c8209c 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -9754,53 +9754,6 @@ class LURepairNodeStorage(NoHooksLU): (self.op.name, self.op.node_name)) -class LUNodeEvacStrategy(NoHooksLU): - """Computes the node evacuation strategy. - - """ - REQ_BGL = False - - def CheckArguments(self): - _CheckIAllocatorOrNode(self, "iallocator", "remote_node") - - def ExpandNames(self): - self.op.nodes = _GetWantedNodes(self, self.op.nodes) - self.needed_locks = locks = {} - if self.op.remote_node is None: - locks[locking.LEVEL_NODE] = locking.ALL_SET - else: - self.op.remote_node = _ExpandNodeName(self.cfg, self.op.remote_node) - locks[locking.LEVEL_NODE] = self.op.nodes + [self.op.remote_node] - - def Exec(self, feedback_fn): - instances = [] - for node in self.op.nodes: - instances.extend(_GetNodeSecondaryInstances(self.cfg, node)) - if not instances: - return [] - - if self.op.remote_node is not None: - result = [] - for i in instances: - if i.primary_node == self.op.remote_node: - raise errors.OpPrereqError("Node %s is the primary node of" - " instance %s, cannot use it as" - " secondary" % - (self.op.remote_node, i.name), - errors.ECODE_INVAL) - result.append([i.name, self.op.remote_node]) - else: - ial = IAllocator(self.cfg, self.rpc, - mode=constants.IALLOCATOR_MODE_MEVAC, - evac_nodes=self.op.nodes) - ial.Run(self.op.iallocator, validate=True) - if not ial.success: - raise errors.OpExecError("No valid evacuation solution: %s" % ial.info, - errors.ECODE_NORES) - result = ial.result - return result - - class LUNodeEvacuate(NoHooksLU): """Evacuates instances off a list of nodes. diff --git a/lib/opcodes.py b/lib/opcodes.py index cd1a48679..d0f6208ce 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -887,16 +887,6 @@ class OpNodeMigrate(OpCode): ] -class OpNodeEvacStrategy(OpCode): - """Compute the evacuation strategy for a list of nodes.""" - OP_DSC_FIELD = "nodes" - OP_PARAMS = [ - ("nodes", ht.NoDefault, ht.TListOf(ht.TNonEmptyString), None), - ("remote_node", None, ht.TMaybeString, None), - ("iallocator", None, ht.TMaybeString, None), - ] - - class OpNodeEvacuate(OpCode): """Evacuate instances off a number of nodes.""" OP_DSC_FIELD = "node_name" -- GitLab