[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 13/13] qemu.py: don't launch again before shu
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] [PATCH v8 13/13] qemu.py: don't launch again before shutdown() |
Date: |
Tue, 5 Sep 2017 11:22:55 +0800 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
On Fri, 09/01 13:28, Amador Pahim wrote:
> 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>
> ---
> scripts/qemu.py | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/scripts/qemu.py b/scripts/qemu.py
> index 363f649a7e..05fca4d268 100644
> --- a/scripts/qemu.py
> +++ b/scripts/qemu.py
> @@ -52,6 +52,7 @@ class QEMUMachine(object):
> self._debug = debug
> self._qemu_full_args = None
> self._created_files = []
> + self._pending_shutdown = False
The name is very poor, it can be confused as "user requested a shutdown but the
action is pending for some reason". Maybe "self._launched"?
Fam
>
> # This can be used to add an unused monitor instance.
> def add_monitor_telnet(self, ip, port):
> @@ -168,10 +169,14 @@ class QEMUMachine(object):
> if self.is_running():
> raise QEMUMachineError('VM already running')
>
> + if self._pending_shutdown:
> + raise QEMUMachineError('Shutdown pending after previous launch')
> +
> self._iolog = None
> self._qemu_full_args = None
> try:
> self._launch()
> + self._pending_shutdown = True
> except:
> self.shutdown()
>
> @@ -217,6 +222,8 @@ class QEMUMachine(object):
> command = ''
> LOG.warn(msg, exitcode, command)
>
> + self._pending_shutdown = False
> +
> underscore_to_dash = string.maketrans('_', '-')
> def qmp(self, cmd, conv_keys=True, **args):
> '''Invoke a QMP command and return the result dict'''
> --
> 2.13.5
>
>
- Re: [Qemu-devel] [PATCH v8 09/13] qemu.py: always cleanup on shutdown(), (continued)
- [Qemu-devel] [PATCH v8 08/13] qemu.py: refactor launch(), Amador Pahim, 2017/09/01
- [Qemu-devel] [PATCH v8 10/13] qemu.py: use poll() instead of 'returncode', Amador Pahim, 2017/09/01
- [Qemu-devel] [PATCH v8 11/13] qemu.py: cleanup redundant calls in launch(), Amador Pahim, 2017/09/01
- [Qemu-devel] [PATCH v8 12/13] qemu.py: launch vm only if it's not running, Amador Pahim, 2017/09/01
- [Qemu-devel] [PATCH v8 13/13] qemu.py: don't launch again before shutdown(), Amador Pahim, 2017/09/01
- Re: [Qemu-devel] [PATCH v8 13/13] qemu.py: don't launch again before shutdown(),
Fam Zheng <=
- Re: [Qemu-devel] [PATCH v8 00/13] scripts/qemu.py fixes and cleanups, Stefan Hajnoczi, 2017/09/05
- Re: [Qemu-devel] [PATCH v8 00/13] scripts/qemu.py fixes and cleanups, Eduardo Habkost, 2017/09/14