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

From: Archana Singh <archus@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@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

Reviewed and Tested-by: Chandra Shekhar Reddy Potula <chandra@linux.vnet.ibm.com> On 10/13/16 2:36 PM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@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@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

Hi Archana, With this patch, the test_model hangs and I need to kill the process. On 10/13/2016 06:06 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@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@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

On 10/14/2016 03:37 PM, Aline Manera wrote:
Hi Archana,
With this patch, the test_model hangs and I need to kill the process.
I tested on Fedora 24 x86.
On 10/13/2016 06:06 AM, archus@linux.vnet.ibm.com wrote:
From: Archana Singh <archus@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@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
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (3)
-
Aline Manera
-
archus@linux.vnet.ibm.com
-
Chandra Shekhar Reddy Potula