]> git.ipfire.org Git - thirdparty/libvirt.git/commit
xenconfig: support vif bandwidth in sexpr parser and formatter
authorJim Fehlig <jfehlig@suse.com>
Tue, 5 Jan 2016 00:46:31 +0000 (17:46 -0700)
committerJim Fehlig <jfehlig@suse.com>
Sat, 9 Jan 2016 01:56:00 +0000 (18:56 -0700)
commit1dd34bbb4b70e163f1b303f43b7c3507d2db086b
tree75e7166ca97c82da339c7a758f22266831f9b170
parent3d92a000ff51225b3afb4dbb83e58e4446f9b035
xenconfig: support vif bandwidth in sexpr parser and formatter

The xen sexpr config format has long supported specifying vif rate
limiting, e.g.

  (device
    (vif
      (mac '00:16:3e:1b:b1:47')
      (rate '10240KB/s')
      ...
    )
  )

Add support for mapping rate to and from <bandwidth> in the xenconfig
sexpr parser and formatter. rate is mapped to the required 'average'
attribute of the <outbound> element, e.g.

  <interface type='bridge'>
    ...
    <bandwidth>
      <outbound average='10240'/>
    </bandwidth>
  </interface>

Also add unit tests to check the conversion logic.

This patch benefits both the old xen driver and the libxl driver.
Both drivers gain support for vif bandwidth when converting to/from
domXML and xen-sxpr. In addition, the old xen driver will now be
able to handle vif 'rate' setting when communicating with xend.
src/libvirt_xenconfig.syms
src/xenconfig/xen_sxpr.c
src/xenconfig/xen_sxpr.h
tests/sexpr2xmldata/sexpr2xml-vif-rate.sexpr [new file with mode: 0644]
tests/sexpr2xmldata/sexpr2xml-vif-rate.xml [new file with mode: 0644]
tests/sexpr2xmltest.c
tests/xml2sexprdata/xml2sexpr-fv-net-rate.sexpr [new file with mode: 0644]
tests/xml2sexprdata/xml2sexpr-fv-net-rate.xml [new file with mode: 0644]
tests/xml2sexprtest.c