[libvirt] inquiry, get native capabilities of the host

Daniel P. Berrange berrange at redhat.com
Fri May 13 09:34:09 UTC 2011


On Thu, May 12, 2011 at 03:39:44PM -0700, Dong-In David Kang wrote:
> 
>  
>  Hello,
> 
>  I'm interested in getting native capabilities of host CPU using libvirt.
> I've looked at .../src/cpu/cpu_map.xml.
> And it does describe native capabilities of host CPU very well. 
> But, libvirt always returns a subset of the native capabilities which is far different from the feature lists in the xml file.
> (I'm testing with <model name='Westmere'>.)
> The sponsor of my project is interested is high-performance computing. 
> And knowing native feature of the host CPU that can also be available to a virtual machine is very important for performance reason.
> 
>  I couldn't find how to get the native features of the host that is described in .../src/cpu/cpu_map.xml.

Libvirt provides a set of APIs for CPU compatibility comparisons, such that
you don't actually need to know the precise CPU flags. The 'virsh capabilities'
command returns an XML description of the host. This description takes the form
of a CPU model that has the closest feature set to your physical CPU, plus a
set of flags to make up the remainining delta.

You can put that host CPU XML description unchanged in the guest XML and the
guest will use the same set of features as the host.

If you have a different CPU XML description for the guest CPU, you can also
query whether it is supported by the host, eg

 cat > cpu.xml
  <cpu>
      <model>Penryn</model>
      <feature name='xtpr'/>
      <feature name='tm2'/>
      <feature name='est'/>
      <feature name='vmx'/>
      <feature name='ds_cpl'/>
      <feature name='monitor'/>
      <feature name='pbe'/>
    </cpu>
 <<EOF
 $ virsh cpu-compare cpu.xml 
 CPU described in cpu.xml is incompatible with host CPU

There is much more you can do besides this, see this guide

http://berrange.com/posts/2010/02/15/guest-cpu-model-configuration-in-libvirt-with-qemukvm/

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list