Commit 83fc0ab6 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Skip rename when OS scripts are absent



When an instance does not have OS scripts because, for example, it
uses an OS image, do not rename the instance after an import.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 3473fb81
......@@ -1609,14 +1609,16 @@ class LUInstanceCreate(LogicalUnit):
raise errors.ProgrammerError("Unknown OS initialization mode '%s'"
% self.op.mode)
# Run rename script on newly imported instance
assert iobj.name == self.op.instance_name
feedback_fn("Running rename script for %s" % self.op.instance_name)
result = self.rpc.call_instance_run_rename(self.pnode.uuid, iobj,
rename_from,
self.op.debug_level)
result.Warn("Failed to run rename script for %s on node %s" %
(self.op.instance_name, self.pnode.name), self.LogWarning)
# Run rename script on newly imported instance
if iobj.os:
feedback_fn("Running rename script for %s" % self.op.instance_name)
result = self.rpc.call_instance_run_rename(self.pnode.uuid, iobj,
rename_from,
self.op.debug_level)
result.Warn("Failed to run rename script for %s on node %s" %
(self.op.instance_name, self.pnode.name), self.LogWarning)
assert not self.owned_locks(locking.LEVEL_NODE_RES)
......
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