As new virtualization engine support gets added to libvirt, and to handle cases like QEMU supporting a variety of emulations, a query interface has been added in 0.2.1 allowing to list the set of supported virtualization capabilities on the host:
char * virConnectGetCapabilities (virConnectPtr conn);
The value returned is an XML document listing the virtualization
capabilities of the host and virtualization engine to which
@conn is connected. One can test it using virsh
command line tool command 'capabilities', it dumps the XML
associated to the current connection.
As can be seen seen in the example, the
capabilities XML consists of the capabilities element which
have exactly one host child element to report information on
host capabilities, and zero or more guest element to express
the set of architectures the host can run at the moment.
The <host/> element consists of the following child
elements:
uuidcpupower_managementmigrationtopologysecmodelWhile the previous section aims at host
capabilities, this one focuses on capabilities available to a guest
using a given hypervisor. The <guest/> element will
typically wrap up the following elements:
os_typexenarchfeaturesFor example, in the case of a 64-bit machine with hardware virtualization capabilities enabled in the chip and BIOS you will see:
<capabilities> <host> <cpu> <arch>x86_64</arch> <features> <vmx/> </features> <model>core2duo</model> <vendor>Intel</vendor> <topology sockets="1" cores="2" threads="1"/> <feature name="lahf_lm"/> <feature name='xtpr'/> ... </cpu> <power_management> <suspend_mem/> <suspend_disk/> <suspend_hybrid/> <power_management/> </host> <!-- xen-3.0-x86_64 --> <guest> <os_type>xen</os_type> <arch name="x86_64"> <wordsize>64</wordsize> <domain type="xen"></domain> <emulator>/usr/lib64/xen/bin/qemu-dm</emulator> </arch> <features> </features> </guest> <!-- hvm-3.0-x86_32 --> <guest> <os_type>hvm</os_type> <arch name="i686"> <wordsize>32</wordsize> <domain type="xen"></domain> <emulator>/usr/lib/xen/bin/qemu-dm</emulator> <machine>pc</machine> <machine>isapc</machine> <loader>/usr/lib/xen/boot/hvmloader</loader> </arch> <features> <cpuselection/> <deviceboot/> </features> </guest> ... </capabilities>