python/qemu: dump a developer friendly version of cmdline to logs
Now we have the arguments nicely split up we can make _console_args a function call and present a slightly different version to the logs to save developers manually hacking the command line up. Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-ID: <20260619155657.944220-4-alex.bennee@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Alex Bennée committed
Jun 19, 2026 at 16:56 UTC
f0e0f4387927a9ab9b99fee47bde1adb6a6cb42a
1 file changed
+15
-4
python/qemu/machine/machine.py
+15
-4
@@ -308,12 +308,15 @@ class QEMUMachine:
308
'chardev=mon,mode=control'])
309
return args
310
311
- @property
312
- def _console_args(self) -> List[str]:
311
+ def _console_args(self, interactive: bool = False) -> List[str]:
312
args: List[str] = []
313
+ # redirect pre_console_index serials to null
314
for _ in range(self._console_index):
315
args.extend(['-serial', 'null'])
316
- if self._console_set:
316
+
317
+ if interactive:
318
+ args.extend(['-serial', 'mon:stdio'])
319
+ elif self._console_set:
320
assert self._cons_sock_pair is not None
321
fd = self._cons_sock_pair[0].fileno()
322
chardev = f"socket,id=console,fd={fd}"
@@ -376,7 +379,7 @@ class QEMUMachine:
379
self._wrapper,
380
[self._binary],
381
self._harness_args,
379
- self._console_args,
382
+ self._console_args(),
383
self._base_args,
384
self._args
385
))
@@ -485,6 +488,14 @@ class QEMUMachine:
488
"""
489
self._pre_launch()
490
LOG.debug('VM launch command: %r', ' '.join(self._qemu_full_args))
491
+ # Log a simplified, developer-runnable command:
492
+ # Exclude harness-managed infrastructure args (harness_args)
493
+ # and wrapper.
494
+ debug_cmd = [self._binary]
495
+ debug_cmd.extend(self._console_args(interactive=True))
496
+ debug_cmd.extend(self._base_args)
497
+ debug_cmd.extend(self._args)
498
+ LOG.debug('Developer-runnable command: %r', ' '.join(debug_cmd))
499
500
# Cleaning up of this subprocess is guaranteed by _do_shutdown.
501
# pylint: disable=consider-using-with