When a qemu VM crash send the log to the client.

Fix #243
This commit is contained in:
Julien Duponchelle committed 2015-06-26 14:41:58 +02:00
1 parent ccd3224490
commit e8805d3fdc
3 files changed
+52

No files matched your search

+3
View File
@@ -704,6 +704,7 @@ class QemuVM(BaseVM):
self._stdout_file = os.path.join(self.working_dir, "qemu.log")
log.info("logging to {}".format(self._stdout_file))
with open(self._stdout_file, "w", encoding="utf-8") as fd:
fd.write("Start QEMU with {}\n\nExecution log:\n".format(command_string))
self._process = yield from asyncio.create_subprocess_exec(*self._command,
stdout=fd,
stderr=subprocess.STDOUT,
@@ -732,6 +733,8 @@ class QemuVM(BaseVM):
log.info("QEMU process has stopped, return code: %d", returncode)
self.status = "stopped"
self._process = None
if returncode != 0:
self.project.emit("log.error", "QEMU process has stopped, return code: {}\n{}".format(returncode, self.read_stdout()))
@asyncio.coroutine
def stop(self):