qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/26] python/qemu/machine: Allow to use other serial console


From: Cleber Rosa
Subject: Re: [PATCH 01/26] python/qemu/machine: Allow to use other serial consoles than default
Date: Mon, 28 Oct 2019 10:51:12 -0400
User-agent: Mutt/1.12.1 (2019-06-15)

On Mon, Oct 28, 2019 at 08:34:16AM +0100, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <address@hidden>
> 
> Currently the QEMU Python module limits the QEMUMachine class to
> use the first serial console.
> 
> Some machines/guest might use another console than the first one as
> the 'boot console'. For example the Raspberry Pi uses the second
> (AUX) console.
> 
> To be able to use the Nth console as default, we simply need to
> connect all the N - 1 consoles to the null chardev.
> 
> Add an index argument, so we can use a specific serial console as
> default.
> 
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> v2:
> - renamed 'console_index', added docstring (Cleber)
> - reworded description (pm215)
> ---
>  python/qemu/machine.py | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index 128a3d1dc2..6fa68fa35a 100644
> --- a/python/qemu/machine.py
> +++ b/python/qemu/machine.py
> @@ -235,6 +235,8 @@ class QEMUMachine(object):
>                  '-display', 'none', '-vga', 'none']
>          if self._machine is not None:
>              args.extend(['-machine', self._machine])
> +        for i in range(self._console_index):
> +            args.extend(['-serial', 'null'])

This will get executed even when set_console() is never called, so it
will result in an AttributeError because 'self._console_index' does
not exist.

It's also a good practice to define all attributes on __init__(), so
I'd suggest that as a fix.

- Cleber.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]