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

Dennis Chen xschen at tnsoft.com.cn
Thu Jun 28 09:21:57 UTC 2012


All,

These days I am trying to understand the interaction relationship 
between the libvirt and KVM kernel module, eg. kvm_intel.ko.

We know that KVM kernel module expose an entry in form of device file 
"/dev/kvm" which can be accessed by user space application to control, 
for example, create a VM using KVM_CREATE_VM with help of ioctl.

Now let's say the tool virsh based upon libvirt, we can create a guest 
domain with the command looks like:
#virsh create guest.xml
Obviously, the above command will create a VM. But when I try to 
investigate the libvirt code, I can't find any code play with the 
"/dev/kvm" to send KVM_CREATE_VM ioctl code to KVM kernel module.  But  
I do found that the reference count of the kvm_intel.ko changed before 
the virsh create command launched and after.

So my question is: how does the libvirt interaction with KVM to create a 
VM? Anybody can give me some tips about that, eg, the corresponding 
codes in libvirt?

BRs.
Dennis




More information about the libvirt-users mailing list