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 <[email protected]>
---
 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 <[email protected]>
 #
 # 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
[email protected]
https://www.redhat.com/mailman/listinfo/virt-tools-list

Reply via email to