[libvirt] qemu or kvm?

Jun Koi junkoi2004 at gmail.com
Fri Sep 12 12:50:35 UTC 2008


On Fri, Sep 12, 2008 at 6:37 PM, Richard W.M. Jones <rjones at redhat.com> wrote:
> On Fri, Sep 12, 2008 at 04:26:28PM +0900, Jun Koi wrote:
>> Given a virDomainPtr variable, how can we know that it is a QEMU or
>> KVM machine? Is there any API for that?
>
> Yes - use virDomainGetXMLDesc[1] to get the XML description of the
> domain, then parse out the <domain type='...'> field[2] which will be
> either 'qemu' or 'kvm'.  This is a pain if you're using a language
> which doesn't support XML parsing, but you can usually find a library
> to help you, eg. in C use libxml2.
>
> Now there's an additional question: is KVM using hardware acceleration
> or is it falling back to software emulation (ie. because the hardware
> doesn't support hardware virtualization)?  IIRC you can answer this by
> looking at the capabilities XML[3], but I think you'll need to do a
> bit of experimentation and look at the source code.
>

That is clear now, thanks!

Yes, I am using C. Is there any code sample on using libxml2 in libvirt code?

Thanks,
Jun




More information about the libvir-list mailing list