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

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

 



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@xxxxxxxxxx>
---
 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@xxxxxxxxxx>
 #
 # 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
-- 
1.8.2.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux