[libvirt] qemu: Add timeout for monitor to avoid virsh getting stuck when monitor gets die.

Osier Yang jyang at redhat.com
Thu Apr 7 10:04:19 UTC 2011


于 2011年04月06日 16:51, Jiri Denemark 写道:
> On Wed, Apr 06, 2011 at 12:13:10 +0800, Mark Wu wrote:
>> Hello Guys,
>>
>> When the qemu process becomes hung,  virsh will get stuck on the hung
>> guest and can't move forward.  It can be reproduced by the following steps:
>>
>> 1. setup a virt guest with qemu-kvm, and start it
>> 2. stop qemu process with following:
>>    kill -STOP  `ps aux | grep qemu | grep -v grep | awk '{print $2}'`
>> 3. run the following command:
>> virsh list
>>
>> I think we can add a timeout for qemu monitor to resolve this problem:
>> using virCondWaitUntil instead of virCondWait in qemuMonitorSend. What's
>> your opinions?
>
> This is not the right approach. Introducing a timeout into all monitor command
> send to qemu is a bad thing. I think the right approach is to have a simple
> API which would just return domain's state without talking to its monitor or
> doing other complicated stuff. The new API could then be used by virsh list to
> list all domains even though they are blocked on qemu monitor. After all,
> virsh is not really interested in current memory consumption of domains when
> listing them.
>

IMHO this won't work, if you restart libvirtd after the monitor gets
dead, you even can't get connection to libvirtd anymore, see:

http://www.redhat.com/archives/libvir-list/2011-March/msg01422.html

How to reproduce:
1. setup a virt guest with qemu-kvm, and start it
2. stop qemu process with following:
    # kill -STOP  `ps aux | grep qemu | grep -v grep | awk '{print $2}'`
3. run the following command:
4. # service libvirtd restart
5. # virsh (hangs here)

> The new API could also provide a reason which lead to current state so that
> one can see the reason even without watching for libvirt events.
>
> Jirka
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list