[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/21] qemu.py: don't launch again before shutdown()
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 17/21] qemu.py: don't launch again before shutdown() |
Date: |
Mon, 5 Feb 2018 21:08:56 -0200 |
From: Amador Pahim <address@hidden>
If a VM is launched, files are created and a cleanup is required before
a new launch. This cleanup is executed by shutdown(), so shutdown() must
be called even if the VM is manually terminated (i.e. using kill).
This patch creates a control to make sure launch() will not be executed
again if shutdown() is not called after the previous launch().
Signed-off-by: Amador Pahim <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
scripts/qemu.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scripts/qemu.py b/scripts/qemu.py
index 09db6249a3..305a946562 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -90,6 +90,7 @@ class QEMUMachine(object):
self._qemu_full_args = None
self._test_dir = test_dir
self._temp_dir = None
+ self._launched = False
# just in case logging wasn't configured by the main script:
logging.basicConfig()
@@ -210,10 +211,15 @@ class QEMUMachine(object):
Launch the VM and make sure we cleanup and expose the
command line/output in case of exception
"""
+
+ if self._launched:
+ raise QEMUMachineError('VM already launched')
+
self._iolog = None
self._qemu_full_args = None
try:
self._launch()
+ self._launched = True
except:
self.shutdown()
@@ -266,6 +272,8 @@ class QEMUMachine(object):
command = ''
LOG.warn(msg, exitcode, command)
+ self._launched = False
+
def qmp(self, cmd, conv_keys=True, **args):
'''Invoke a QMP command and return the response dict'''
qmp_args = dict()
--
2.14.3
- [Qemu-devel] [PULL 05/21] qapi: Adapt to moved location of 'maketrans' function in py3, (continued)
- [Qemu-devel] [PULL 05/21] qapi: Adapt to moved location of 'maketrans' function in py3, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 08/21] qapi: force a UTF-8 locale for running Python, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 09/21] scripts: ensure signrom treats data as bytes, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 10/21] configure: allow use of python 3, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 11/21] qemu.py: remove unused import, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 12/21] qemu.py: better control of created files, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 14/21] qemu.py: always cleanup on shutdown(), Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 13/21] qemu.py: refactor launch(), Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 15/21] qemu.py: use poll() instead of 'returncode', Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 16/21] qemu.py: cleanup redundant calls in launch(), Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 17/21] qemu.py: don't launch again before shutdown(),
Eduardo Habkost <=
- [Qemu-devel] [PULL 18/21] input: add missing JIS keys to virtio input, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 19/21] ui: update keycodemapdb to get py3 fixes, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 20/21] travis: improve python version test coverage, Eduardo Habkost, 2018/02/05
- [Qemu-devel] [PULL 21/21] docker: change Fedora images to run with python3, Eduardo Habkost, 2018/02/05
- Re: [Qemu-devel] [PULL 00/21] Python queue, 2018-02-05, Peter Maydell, 2018/02/07