On 07/10/2012 07:00 AM, xuanmao_001 wrote:
Hi, all.
I want to know when I press run button. start a domain. What is the procedure of libvirt
internal.
I know it will call virDomainCreate(),then qemuDomainStart() ->
qemuDomainStartWithFlags(). what is the next?
I'm assuming you pushed the run button within virt-manager or some other
gui. This makes a call into libvirt.so virDomainCreate(), which then
bundles the arguments into an RPC call to pass to libvirtd using the
code in src/remote. Then libvirtd (the code in daemon/) unbundles the
RPC call, calls its own copy of virDomainCreate(), which then forwards
into qemuDomainStart() (src/qemu). So you got that part correct.
Within the body of qemuDomainStart() are calls to helper functions to
build the command line (src/qemu/qemu_command.c) as well as creating the
qemu process (src/qemu/qemu_process.c) and associated monitor connection
(src/qemu/qemu_monitor.c). You can view the guest log to see the
command line that was created.
Beyond that, I'd suggest you compile your own version of libvirtd with
CFLAGS=-O0, then step through virDomainCreate() under gdb if you really
want to know what's happening.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org