summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kletzander <mkletzan@redhat.com>2013-06-11 09:32:13 +0200
committerMartin Kletzander <mkletzan@redhat.com>2013-06-12 11:10:30 +0200
commit77fb38e60207874d4293448b64945c3d4ec11c30 (patch)
tree5ca3929325c945f2e0f49eeabe18ec34ca544ffb
parent1ca9d6ebd2195ebc9e495c2cae5be28aa11c62a8 (diff)
downloadvirt-manager-77fb38e60207874d4293448b64945c3d4ec11c30.tar.gz
serialcon: Close the console at the end of the stream
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>
-rw-r--r--virtManager/serialcon.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/virtManager/serialcon.py b/virtManager/serialcon.py
index b02a8be7..7288a22e 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