Commit 9c5885e2 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Adding check_name option to the opcode and luxi call for instance rename



This will allow instance rename without dns check as it does for instance
add.
Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 56e4c4a0
......@@ -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" %
......
......@@ -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",
]
......
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