Commit 0d89fb60 authored by Nikos Skalkotos's avatar Nikos Skalkotos

Detect when qemu gets terminated by a signal

If qemu catches a signal, it terminates with 0 and prints a message in
stderr. Try to detect if the process has been terminated by a signal
by examining the stderr.
parent 8fb10dd2
......@@ -566,7 +566,10 @@ class Windows(OSBase):
self._exec_sysprep_tasks()
self.out.output("Waiting for windows to shut down ...", False)
self.vm.wait(shutdown_timeout)
(_, stderr, rc) = self.vm.wait(shutdown_timeout)
if rc != 0 or "terminating on signal" in stderr:
raise FatalError("Windows VM died unexpectedly!\n\n"
"(rc=%d)\n%s" % (rc, stderr))
self.out.success("done")
finally:
# if the VM is not already dead here, a Fatal Error will have
......@@ -951,7 +954,10 @@ class Windows(OSBase):
raise FatalError("Windows VirtIO installation timed out!")
self.out.success('done')
self.out.output('Shutting down ...', False)
self.vm.wait(shutdown_timeout)
(_, stderr, rc) = self.vm.wait(shutdown_timeout)
if rc != 0 or "terminating on signal" in stderr:
raise FatalError("Windows VM died unexpectedly!\n\n"
"(rc=%d)\n%s" % (rc, stderr))
self.out.success('done')
finally:
self.vm.stop(shutdown_timeout if booted else 1, fatal=False)
......@@ -969,7 +975,10 @@ class Windows(OSBase):
try:
self.out.output('Rebooting Windows VM in safe mode ...', False)
self.vm.start()
self.vm.wait(timeout + shutdown_timeout)
(_, stderr, rc) = self.vm.wait(timeout + shutdown_timeout)
if rc != 0 or "terminating on signal" in stderr:
raise FatalError("Windows VM died unexpectedly!\n\n"
"(rc=%d)\n%s" % (rc, stderr))
self.out.success('done')
finally:
self.vm.stop(1, fatal=True)
......
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