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):
try:
result = self.rpc.call_instance_run_rename(inst.primary_node, inst,
old_name)
- if result.failed or not result.data:
+ 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.name, inst.primary_node))
+ " (but the instance has been renamed in Ganeti): %s" %
+ (inst.name, inst.primary_node, msg))
self.proc.LogWarning(msg)
finally:
_ShutdownInstanceDisks(self, inst)