Fix a rare crash when stopping qemu

Fix #821
This commit is contained in:
Julien Duponchelle committed 2016-12-12 09:16:29 +01:00
1 parent c4327ec74c
commit 508edf5cc5
1 file changed
+7 -6
+7 -6
View File
@@ -972,12 +972,13 @@ class QemuVM(BaseNode):
except ProcessLookupError:
pass
except asyncio.TimeoutError:
try:
self._process.kill()
except ProcessLookupError:
pass
if self._process.returncode is None:
log.warn('QEMU VM "{}" PID={} is still running'.format(self._name, self._process.pid))
if self._process:
try:
self._process.kill()
except ProcessLookupError:
pass
if self._process.returncode is None:
log.warn('QEMU VM "{}" PID={} is still running'.format(self._name, self._process.pid))
self._process = None
self._stop_cpulimit()
yield from super().stop()