Commit 96841384 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert RenameInstance to (status, data)

This allows the rename failures to show the ouput of OS scripts.

Reviewed-by: ultrotter
parent b903ba35
......@@ -723,9 +723,12 @@ def RunRenameInstance(instance, old_name):
if result.failed:
logging.error("os create command '%s' returned error: %s output: %s",
result.cmd, result.fail_reason, result.output)
return False
lines = [val.encode("string_escape")
for val in utils.TailFile(logfile, lines=20)]
return (False, "OS rename script failed (%s), last lines in the"
" log file:\n%s" % (result.fail_reason, "\n".join(lines)))
return True
return (True, "Rename successful")
def _GetVGInfo(vg_name):
......@@ -2973,10 +2973,11 @@ class LURenameInstance(LogicalUnit):
result = self.rpc.call_instance_run_rename(inst.primary_node, inst,
if result.failed or not
msg = result.RemoteFailMsg()
if msg:
msg = ("Could not run OS rename script for instance %s on node %s"
" (but the instance has been renamed in Ganeti)" %
(, inst.primary_node))
" (but the instance has been renamed in Ganeti): %s" %
(, inst.primary_node, msg))
_ShutdownInstanceDisks(self, inst)
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