于 2011年04月07日 18:17, Jiri Denemark 写道:
On Thu, Apr 07, 2011 at 18:04:19 +0800, Osier Yang wrote:
> 于 2011年04月06日 16:51, Jiri Denemark 写道:
>> 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)
Yes, but that's a separate issue, IMHO. virsh hangs at this point since
libvirtd doesn't even get to the point when it is able to accept connections
from client. So introducing a timeout to some specific operations to help
solve this issue might be the right approach but doing all commands with
timeout is certainly not what we should do. Daniel described all the issues
very nicely in his detailed email.
Oh, I didn't mean your proposal won't work for "virsh list", that will
work well I guess. :)
I meant if we consider "virsh list can't work if the monitor dies" as
a problem, then we need to solve the even more bad problem ---
libvirtd can't accept connection anymore if it's restarted.
Regards
Osier