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

Re: [virt-tools-list] [virt-manager PATCH] serialcon: Close the console at the end of the stream



On 06/11/2013 03:32 AM, Martin Kletzander wrote:
> When LXC guest was shut down while its console was open, virt-manager
> got stuck in a loop due to the fact that the readable event was not
> properly removed from the callback.  Mimicking the behavior from
> libvirt's tolls/console.c file, this patch properly closes the console
> in case stream.recv() returns empty string.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=968896
> 
> Signed-off-by: Martin Kletzander <mkletzan redhat com>
> ---
>  virtManager/serialcon.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/virtManager/serialcon.py b/virtManager/serialcon.py
> index b02a8be..7288a22 100644
> --- a/virtManager/serialcon.py
> +++ b/virtManager/serialcon.py
> @@ -1,5 +1,5 @@
>  #
> -# Copyright (C) 2006 Red Hat, Inc.
> +# Copyright (C) 2006, 2013 Red Hat, Inc.
>  # Copyright (C) 2006 Daniel P. Berrange <berrange redhat com>
>  #
>  # This program is free software; you can redistribute it and/or modify
> @@ -158,6 +158,8 @@ class LibvirtConsoleConnection(ConsoleConnection):
> 
>              if got == -2:
>                  return
> +            if len(got) == 0:
> +                self.close()
> 
>              queued_text = bool(self.streamToTerminal)
>              self.streamToTerminal += got
> 

ACK, please push.

- Cole


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