[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/9] Python: close the log file kept by QEMUMachine before reading
From: |
Cleber Rosa |
Subject: |
[PULL 3/9] Python: close the log file kept by QEMUMachine before reading it |
Date: |
Mon, 15 Feb 2021 23:56:59 -0500 |
Closing a file that is open for writing, and then reading from it
sounds like a better idea than the opposite, given that the content
will be flushed.
Reference: https://docs.python.org/3/library/io.html#io.IOBase.close
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20210211220146.2525771-2-crosa@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
python/qemu/machine.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/qemu/machine.py b/python/qemu/machine.py
index 7a40f4604be..6e44bda337e 100644
--- a/python/qemu/machine.py
+++ b/python/qemu/machine.py
@@ -337,12 +337,12 @@ def _post_shutdown(self) -> None:
self._qmp.close()
self._qmp_connection = None
- self._load_io_log()
-
if self._qemu_log_file is not None:
self._qemu_log_file.close()
self._qemu_log_file = None
+ self._load_io_log()
+
self._qemu_log_path = None
if self._temp_dir is not None:
--
2.26.2
- [PULL 0/9] Acceptance Tests and Python libs patches for 2021-02-15, Cleber Rosa, 2021/02/15
- [PULL 2/9] virtiofs_submounts.py test: Note on vmlinuz param, Cleber Rosa, 2021/02/15
- [PULL 1/9] Acceptance Tests: bump Avocado version requirement to 85.0, Cleber Rosa, 2021/02/15
- [PULL 3/9] Python: close the log file kept by QEMUMachine before reading it,
Cleber Rosa <=
- [PULL 5/9] maint: Tell git that *.py files should use python diff hunks, Cleber Rosa, 2021/02/15
- [PULL 4/9] tests/acceptance/virtio-gpu.py: preserve virtio-user-gpu log, Cleber Rosa, 2021/02/15
- [PULL 6/9] Acceptance Tests: introduce LinuxTest base class, Cleber Rosa, 2021/02/15
- [PULL 7/9] Acceptance Tests: introduce method for requiring an accelerator, Cleber Rosa, 2021/02/15
- [PULL 8/9] Acceptance Tests: fix population of public key in cloudinit image, Cleber Rosa, 2021/02/15
- [PULL 9/9] Acceptance Tests: set up existing ssh keys by default, Cleber Rosa, 2021/02/15
- Re: [PULL 0/9] Acceptance Tests and Python libs patches for 2021-02-15, Peter Maydell, 2021/02/16