[Kimchi-devel] [PATCH] [Kimchi] Issue #1053: View console, shutdown socket server for VM who's console is not readable instead writeable.

archus at linux.vnet.ibm.com archus at linux.vnet.ibm.com
Thu Oct 13 09:06:55 UTC 2016


From: Archana Singh <archus at linux.vnet.ibm.com>

Socket server gets closed for VM's serial console connection if its not readable instead writeable.
This is due to fact that _is_vm_listening_serial(...) only call _test_output if its readable
and not on writeable. Adding libvirt.VIR_STREAM_EVENT_WRITABLE solve the issue.
Also added libvirt.VIR_STREAM_EVENT_HANGUP event so that in case of hangup also
console gets connected.

Signed-off-by: Archana Singh <archus at linux.vnet.ibm.com>
---
 serialconsole.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/serialconsole.py b/serialconsole.py
index 13ef331..725f55d 100644
--- a/serialconsole.py
+++ b/serialconsole.py
@@ -101,7 +101,9 @@ class SocketServer(Process):
             while not is_listening:
                 libvirt.virEventRunDefaultImpl()
 
-        console.eventAddCallback(libvirt.VIR_STREAM_EVENT_READABLE,
+        console.eventAddCallback(libvirt.VIR_STREAM_EVENT_READABLE |
+                                 libvirt.VIR_STREAM_EVENT_WRITABLE |
+                                 libvirt.VIR_STREAM_EVENT_HANGUP,
                                  _test_output,
                                  None)
         libvirt_loop = threading.Thread(target=_event_loop)
@@ -111,6 +113,7 @@ class SocketServer(Process):
         libvirt_loop.join(1)
 
         if not libvirt_loop.is_alive():
+            wok_log.error("console libvirt stream is not listening to event")
             console.eventRemoveCallback()
             return True
 
-- 
2.7.4




More information about the Kimchi-devel mailing list