From 9c5885e26046c9cd1352e896bcc9f2d67dab084b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Nussbaumer?= <rn@google.com> Date: Wed, 30 Jun 2010 14:37:24 +0200 Subject: [PATCH] Adding check_name option to the opcode and luxi call for instance rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow instance rename without dns check as it does for instance add. Signed-off-by: RenΓ© Nussbaumer <rn@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/cmdlib.py | 11 ++++++++--- lib/opcodes.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index a8f9d176e..7f5f3d529 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -4750,8 +4750,10 @@ class LURenameInstance(LogicalUnit): _OP_REQP = [ ("instance_name", _TNonEmptyString), ("new_name", _TNonEmptyString), + ("ignore_ip", _TBool), + ("check_name", _TBool), ] - _OP_DEFS = [("ignore_ip", False)] + _OP_DEFS = [("ignore_ip", False), ("check_name", True)] def BuildHooksEnv(self): """Build hooks env. @@ -4779,9 +4781,12 @@ class LURenameInstance(LogicalUnit): self.instance = instance # new name verification - name_info = utils.GetHostInfo(self.op.new_name) + if self.op.check_name: + name_info = utils.GetHostInfo(self.op.new_name) + self.op.new_name = name_info.name + + new_name = self.op.new_name - self.op.new_name = new_name = name_info.name instance_list = self.cfg.GetInstanceList() if new_name in instance_list: raise errors.OpPrereqError("Instance '%s' is already in the cluster" % diff --git a/lib/opcodes.py b/lib/opcodes.py index 7a7edd968..c2cc5cf9c 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -502,7 +502,7 @@ class OpRenameInstance(OpCode): """Rename an instance.""" OP_ID = "OP_INSTANCE_RENAME" __slots__ = [ - "instance_name", "ignore_ip", "new_name", + "instance_name", "ignore_ip", "new_name", "check_name", ] -- GitLab