qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 14/19] python/qemu/machine: Allow to use other serial console


From: Cleber Rosa
Subject: Re: [PATCH 14/19] python/qemu/machine: Allow to use other serial consoles than default
Date: Wed, 9 Oct 2019 11:28:34 -0400
User-agent: Mutt/1.12.1 (2019-06-15)

On Thu, Sep 26, 2019 at 07:34:22PM +0200, Philippe Mathieu-Daudé wrote:
> Currently we are limited to use the first serial console available.
> Some machines/guest might use another console than the first one as
> the 'boot console'.
> 
> To be able to use the N 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>
> ---
>  python/qemu/machine.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/python/qemu/machine.py b/python/qemu/machine.py
> index 128a3d1dc2..302b158a18 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_id):
> +            args.extend(['-serial', 'null'])
>          if self._console_set:
>              self._console_address = os.path.join(self._temp_dir,
>                                                   self._name + 
> "-console.sock")
> @@ -495,7 +497,7 @@ class QEMUMachine(object):
>          """
>          self._machine = machine_type
>  
> -    def set_console(self, device_type=None):
> +    def set_console(self, device_type=None, console_id=0):

My guts tell me that we'll need to support multiple devices of a single
type shortly, but for now, this looks fine.

Would you please add a docstring parameter entry for console_id
explaining its effect?

Thanks,
- Cleber.

>          """
>          Sets the device type for a console device
>  
> @@ -519,6 +521,7 @@ class QEMUMachine(object):
>          """
>          self._console_set = True
>          self._console_device_type = device_type
> +        self._console_id = console_id
>  
>      @property
>      def console_socket(self):
> -- 
> 2.20.1
> 



reply via email to

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