On 08/09/2011 06:04 AM, Dave Allan wrote:
I tried it with rhel6u1 guest on rhel6u1 host,I'm trying to write an example serial console implementation in python (attached), but I'm having some trouble getting stream events to do what I want. The console itself works fine as long as the domain stays up, but as soon as the domain shuts down the python script goes into a tight loop repeatedly calling the stream event callback. Debugging indicates that the stream event callback is being requested to be removed, but it never actually is removed which makes me think I am not properly releasing some resource, but I was under the impression that an error on a stream resulting in the stream aborting was supposed to free all the resources for me. Is that not correct? Thanks for any help anybody can provide, Dave-- libvir-list mailing list libvir-list redhat com https://www.redhat.com/mailman/listinfo/libvir-list
there are two problems that causes the problems.
One is the position of console=tty0 and console=ttyS0, 9600n8 in grub.conf
It's ok for me using as follows:
kernel /vmlinuz-2.6.32-131.0.15.el6.x86_64 ro root=/dev/mapper/VolGroup-lv_root rd_LVM_LV=VolGroup/lv_root rd_LVM_LV=VolGroup/lv_swap console=tty0 rhgb quiet console=ttyS0,9600n8
The other one is to add a check to the value of "receivedData",
if it is "" string, stop the while loop by set run_console to False like it in stdin_callback function
The tight loop caused by the continuous calling to virEventRunDefaultImpl()
when no data left in stream.
I attached a modified copy of your scripts and tested it.
Description: Binary data