[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/7] python/machine: move more variable initializations to _pre_la
From: |
John Snow |
Subject: |
[PULL 4/7] python/machine: move more variable initializations to _pre_launch |
Date: |
Mon, 22 Nov 2021 21:38:02 -0500 |
No need to clear them only to set them later.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-id: 20211118204620.1897674-5-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/qemu/machine/machine.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index ad529fd92a..f92e73de40 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -327,6 +327,14 @@ def _pre_launch(self) -> None:
self._qemu_log_path = os.path.join(self.log_dir, self._name + ".log")
self._qemu_log_file = open(self._qemu_log_path, 'wb')
+ self._iolog = None
+ self._qemu_full_args = tuple(chain(
+ self._wrapper,
+ [self._binary],
+ self._base_args,
+ self._args
+ ))
+
def _post_launch(self) -> None:
if self._qmp_connection:
self._qmp.accept(self._qmp_timer)
@@ -390,8 +398,6 @@ def launch(self) -> None:
if self._launched:
raise QEMUMachineError('VM already launched')
- self._iolog = None
- self._qemu_full_args = ()
try:
self._launch()
self._launched = True
@@ -410,12 +416,6 @@ def _launch(self) -> None:
Launch the VM and establish a QMP connection
"""
self._pre_launch()
- self._qemu_full_args = tuple(
- chain(self._wrapper,
- [self._binary],
- self._base_args,
- self._args)
- )
LOG.debug('VM launch command: %r', ' '.join(self._qemu_full_args))
# Cleaning up of this subprocess is guaranteed by _do_shutdown.
--
2.31.1
- [PULL 0/7] Python patches, John Snow, 2021/11/22
- [PULL 1/7] python/machine: add @sock_dir property, John Snow, 2021/11/22
- [PULL 2/7] python/machine: remove _remove_monitor_sockfile property, John Snow, 2021/11/22
- [PULL 3/7] python/machine: add instance disambiguator to default nickname, John Snow, 2021/11/22
- [PULL 5/7] python/machine: handle "fast" QEMU terminations, John Snow, 2021/11/22
- [PULL 4/7] python/machine: move more variable initializations to _pre_launch,
John Snow <=
- [PULL 6/7] scripts/device-crash-test: Use a QMP timeout, John Snow, 2021/11/22
- [PULL 7/7] python/aqmp: fix send_fd_scm for python 3.6.x, John Snow, 2021/11/22
- Re: [PULL 0/7] Python patches, Richard Henderson, 2021/11/23