]> Git Repo - qemu.git/commitdiff
python/machine: move more variable initializations to _pre_launch
authorJohn Snow <[email protected]>
Thu, 18 Nov 2021 20:46:17 +0000 (15:46 -0500)
committerJohn Snow <[email protected]>
Mon, 22 Nov 2021 23:40:59 +0000 (18:40 -0500)
No need to clear them only to set them later.

Signed-off-by: John Snow <[email protected]>
Reviewed-by: Willian Rampazzo <[email protected]>
Message-id: 20211118204620.1897674[email protected]
Signed-off-by: John Snow <[email protected]>
python/qemu/machine/machine.py

index ad529fd92a6022150fd0156d005d6c7175565574..f92e73de4010d10c9e062259c70638020e039121 100644 (file)
@@ -327,6 +327,14 @@ class QEMUMachine:
         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 @@ class QEMUMachine:
         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 @@ class QEMUMachine:
         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.
This page took 0.033661 seconds and 4 git commands to generate.