A new call to launch() with a running VM will fall in exception and consequently call shutdown().
This patch makes launch() to raise an exception when it's called with VM already running. Signed-off-by: Amador Pahim <apa...@redhat.com> --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 9ae65e454e..46e8ff3232 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -170,6 +170,9 @@ class QEMUMachine(object): self._iolog = None self._qemu_full_args = None devnull = open(os.path.devnull, 'rb') + if self.is_running(): + raise QEMULaunchError('VM already running') + try: self._pre_launch() self._qemu_full_args = (self._wrapper + [self._binary] + -- 2.13.5