Commit 7bde3275 authored by Guido Trotter's avatar Guido Trotter
Browse files

Don't allow renaming to an existing instance

Even if the target instance is down or we are not checking for IP conflicts
changing an instance name to a new one which is already in the cluster is
doomed to fail, because in a lot of places (among which figures the mind of
most users/admins) instance names are assumed to be unique.

Reviewed-by: imsnah
parent 5336d63d
......@@ -2315,6 +2315,11 @@ class LURenameInstance(LogicalUnit):
name_info = utils.HostInfo(self.op.new_name)
self.op.new_name = new_name =
instance_list = self.cfg.GetInstanceList()
if new_name in instance_list:
raise errors.OpPrereqError("Instance '%s' is already in the cluster" %
if not getattr(self.op, "ignore_ip", False):
command = ["fping", "-q", name_info.ip]
result = utils.RunCmd(command)
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