[libvirt] [PATCH v2 0/9] New public API for computing baseline CPU

Jiri Denemark jdenemar at redhat.com
Thu Feb 11 15:43:50 UTC 2010


Version 2 changes:
- rebased (mainly for conn argument removal)
- swapped array and number of elements in array parameters
- fixed absolute paths in generated RPC code
- added python bindings for virConnectBaselineCPU
- fixed uninitialized variable in cpuDecode, which wasn't revealed by gcc :-(

This series introduces a new virConnectBaselineCPU() API call for
computing baseline CPU model from a set of host CPU definitions.
The call accepts a list of <cpu>...</cpu> xml definitions taken from
host capabilities and returns an xml description of a guest CPU which is
supported by all hosts.

virsh is little bit less picky and accepts a file containing host CPU
definitions. It doesn't care what is outside of the <cpu/> tag, which
allows for concatenating outputs of virsh capabilities from several
hosts and feeding the result to virsh cpu-baseline.

This series can also be found on cpu-baseline branch of
git://gitorious.org/~jirka/libvirt/jirka-staging.git

In practice it works like this:

# virsh cpu-baseline /dev/stdin >guest-cpu <<EOF
<capabilities>
  <host>
    <cpu>
      <arch>x86_64</arch>
      <model>core2duo</model>
      <topology sockets='1' cores='2' threads='1'/>
      <feature name='lahf_lm'/>
      <feature name='xtpr'/>
      <feature name='cx16'/>
      <feature name='tm2'/>
      <feature name='est'/>
      <feature name='vmx'/>
    </cpu>
  </host>
</capabilities>
    <cpu>
      <arch>i686</arch>
      <model>pentiumpro</model>
      <topology sockets='1' cores='2' threads='1'/>
      <feature name='vme'/>
      <feature name='pse36'/>
      <feature name='pni'/>
      <feature name='monitor'/>
      <feature name='ssse3'/>
    </cpu>
    <cpu>
      <arch>x86_64</arch>
      <model>phenom</model>
    </cpu>
EOF

# cat guest-cpu
<cpu match='exact'>
  <model>qemu32</model>
  <feature policy='require' name='monitor'/>
  <feature policy='require' name='pse36'/>
</cpu>


Jiri Denemark (9):
  Functions for computing baseline CPU from a set of host CPUs
  Implement cpuArchBaseline in generic CPU driver
  Implement cpuArchBaseline in x86 CPU driver
  virConnectBaselineCPU public API
  Internal driver API for virConnectBaselineCPU
  virConnectBaselineCPU public API implementation
  Wire protocol format and dispatcher for virConnectBaselineCPU
  Implement cpuBaseline in remote and qemu drivers
  cpu-baseline command for virsh

 daemon/remote.c                     |   25 +++++++
 daemon/remote_dispatch_args.h       |    1 +
 daemon/remote_dispatch_prototypes.h |    8 ++
 daemon/remote_dispatch_ret.h        |    1 +
 daemon/remote_dispatch_table.h      |    5 ++
 include/libvirt/libvirt.h.in        |   18 +++++
 python/generator.py                 |    1 +
 python/libvirt-override-api.xml     |    7 ++
 python/libvirt-override.c           |   52 +++++++++++++++
 src/cpu/cpu.c                       |  123 ++++++++++++++++++++++++++++++++++-
 src/cpu/cpu.h                       |   21 ++++++-
 src/cpu/cpu_generic.c               |  104 +++++++++++++++++++++++++++++-
 src/cpu/cpu_x86.c                   |   88 ++++++++++++++++++++++++-
 src/driver.h                        |    6 ++
 src/esx/esx_driver.c                |    1 +
 src/libvirt.c                       |   57 ++++++++++++++++
 src/libvirt_private.syms            |    2 +
 src/libvirt_public.syms             |    1 +
 src/lxc/lxc_driver.c                |    1 +
 src/opennebula/one_driver.c         |    1 +
 src/openvz/openvz_driver.c          |    1 +
 src/phyp/phyp_driver.c              |    1 +
 src/qemu/qemu_driver.c              |   14 ++++
 src/remote/remote_driver.c          |   32 +++++++++
 src/remote/remote_protocol.c        |   22 ++++++
 src/remote/remote_protocol.h        |   20 ++++++
 src/remote/remote_protocol.x        |   18 +++++-
 src/test/test_driver.c              |    1 +
 src/uml/uml_driver.c                |    1 +
 src/vbox/vbox_tmpl.c                |    1 +
 src/xen/xen_driver.c                |    1 +
 tools/virsh.c                       |   72 ++++++++++++++++++++
 tools/virsh.pod                     |    8 ++
 33 files changed, 709 insertions(+), 6 deletions(-)




More information about the libvir-list mailing list