[libvirt-users] How does libvirt interaction with KVM to create a VM?

Dennis Chen dennis.chen at tnsoft.com.cn
Fri Jun 29 08:12:16 UTC 2012


On 06/29/2012 03:47 PM, Daniel Veillard wrote:
> On Fri, Jun 29, 2012 at 03:07:54PM +0800, Dennis Chen wrote:
>> On 06/29/2012 02:49 PM, Daniel Veillard wrote:
> [...]
>>>    virsh talks to the libvirtd daemon, the libvirtd daemon run those
>>> calls from the qemu driver. The documentation is relatively sparse,
>>> but reading what is available will help:
>>>
>>>     http://libvirt.org/api.html
>>>     http://libvirt.org/internals.html
>>>
>>> so if you want to step though that function you must gdb the libvirt
>>> daemon, not the client application.
>>>
>>> Daniel
>> en, this Daniel is not that Daniel: ) I remember that I joined the
>> presentation about
>> libvirt delivered by you in Nanjing University last year.
>    ah yes, there is Dan and Daniel that can be a bit confusing :-)
>
>> Yes, the document about libvirt is sparse, so I am often confused
>> when I try to
>> understand the internals of the relationship between QEMU, KVM and
>> libvirt...
>    ah, yes the overall stack is a bit complex.
>
>> Let me go through the link you mentioned to see if I can understand
>> libvirtd comes from
>> and the relationship with libvirt...
>    Basically for some driver the application talk to the libvirt daemon
> to implement all the entry points of a driver (qemu/lxc for example),
> it uses the remote driver to connect to the daemon, and the daemon calls
> the real driver. Sometimes, the driver in the applcation does the work
> by talking directly to the hypervisor (ESX/Hyper-V).
>    So if you want to debug/gdb the qemu code you must attach to libvirtd
> daemon not to the application.
>    See slide 5 of the CLK slides ;-)
>      http://veillard.com/Talks/CLKLinux2011.pdf
>
> Daniel
>
Actually I've downloaded your ppt from 
http://v.csdn.hudong.com/linuxkernal2011/page2.html,
slide 5 and 12 is useful for me because it's a overview picture.

About daemon, in my system:

root at dennis-:/home/dennis/workspace/Software# ps aux | grep libvirtd
root     20308  0.0  0.1 102908  3540 ?        Sl   15:25   0:00 
/usr/sbin/libvirtd -d

so the libvirtd daemon is there, but I have questions about this daemon:
1. where is the daemon source code, it's in the libvirt tar package?
2. Who is responsible to start this daemon and when?

BRs,
Dennis




More information about the libvirt-users mailing list