[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 01/12] python/machine.py: consolidate _post_shutdown()
From: |
Cleber Rosa |
Subject: |
Re: [PATCH v5 01/12] python/machine.py: consolidate _post_shutdown() |
Date: |
Mon, 13 Jul 2020 11:11:50 -0400 |
On Fri, Jul 10, 2020 at 01:06:38AM -0400, John Snow wrote:
> Move more cleanup actions into _post_shutdown. As a change, if QEMU
> should so happen to be terminated during a call to wait(), that event
> will now be logged.
>
> This is not likely to occur during normative use.
>
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
> python/qemu/machine.py | 27 +++++++++++++--------------
> 1 file changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index 041c615052..f7e68191c2 100644
> --- a/python/qemu/machine.py
> +++ b/python/qemu/machine.py
> @@ -283,6 +283,8 @@ def _post_launch(self):
> self._qmp.accept()
>
> def _post_shutdown(self):
> + self._load_io_log()
> +
> if self._qemu_log_file is not None:
> self._qemu_log_file.close()
> self._qemu_log_file = None
> @@ -296,6 +298,17 @@ def _post_shutdown(self):
> while len(self._remove_files) > 0:
> self._remove_if_exists(self._remove_files.pop())
>
> + exitcode = self.exitcode()
> + if exitcode is not None and exitcode < 0:
> + msg = 'qemu received signal %i; command: "%s"'
> + if self._qemu_full_args:
> + command = ' '.join(self._qemu_full_args)
> + else:
> + command = ''
> + LOG.warning(msg, -int(exitcode), command)
> +
> + self._launched = False
> +
> def launch(self):
> """
> Launch the VM and make sure we cleanup and expose the
> @@ -344,7 +357,6 @@ def wait(self):
> self._popen.wait()
> if self._qmp:
> self._qmp.close()
> - self._load_io_log()
Nice consolidation of responsibilities!
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
signature.asc
Description: PGP signature
- [PATCH v5 00/12] python/machine.py: refactor shutdown, John Snow, 2020/07/10
- [PATCH v5 02/12] python/machine.py: Close QMP socket in cleanup, John Snow, 2020/07/10
- [PATCH v5 01/12] python/machine.py: consolidate _post_shutdown(), John Snow, 2020/07/10
- [PATCH v5 03/12] python/machine.py: Add _early_cleanup hook, John Snow, 2020/07/10
- [PATCH v5 05/12] python/machine.py: Prohibit multiple shutdown() calls, John Snow, 2020/07/10
- [PATCH v5 04/12] python/machine.py: Perform early cleanup for wait() calls, too, John Snow, 2020/07/10