From 436a5bfc8ba30e043c25e634d2da9a9cea817f05 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 12 Jun 2013 21:10:52 -0400 Subject: [PATCH] serialcon: Fix tracebacks when we get EOF on stream --- virtManager/serialcon.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/virtManager/serialcon.py b/virtManager/serialcon.py index 7288a22e2..e56a47cc1 100644 --- a/virtManager/serialcon.py +++ b/virtManager/serialcon.py @@ -147,6 +147,7 @@ class LibvirtConsoleConnection(ConsoleConnection): events & libvirt.VIR_EVENT_HANDLE_HANGUP): logging.debug("Received stream ERROR/HANGUP, closing console") self.close() + return if events & libvirt.VIR_EVENT_HANDLE_READABLE: try: @@ -157,9 +158,12 @@ class LibvirtConsoleConnection(ConsoleConnection): return if got == -2: + # This is basically EAGAIN return if len(got) == 0: + logging.debug("Received EOF from stream, closing") self.close() + return queued_text = bool(self.streamToTerminal) self.streamToTerminal += got @@ -177,6 +181,7 @@ class LibvirtConsoleConnection(ConsoleConnection): return if done == -2: + # This is basically EAGAIN return self.terminalToStream = self.terminalToStream[done:]