[libvirt] [PATCH 1/2] xenconfig: support parsing and formatting vif bandwidth

Michal Privoznik mprivozn at redhat.com
Thu Jan 7 14:48:35 UTC 2016


On 29.12.2015 02:09, Jim Fehlig wrote:
> Both xm and xl config have long supported specifying vif rate
> limiting, e.g.
> 
> vif = [ 'mac=00:16:3E:74:3d:76,bridge=br0,rate=10MB/s' ]
> 
> Add support for mapping rate to and from <bandwidth> in the xenconfig
> 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 a unit test to check the conversion logic.
> 
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
> 
> I used a bit of code from libxlu_vif.c to implement xenParseVifRate()
> instead of using the libxlutil lib directly, since in theory rate limiting
> applies to the old xen driver (no libxl) as well.
> 
>  src/xenconfig/xen_common.c           | 77 ++++++++++++++++++++++++++++++++++++
>  tests/xlconfigdata/test-vif-rate.cfg | 26 ++++++++++++
>  tests/xlconfigdata/test-vif-rate.xml | 57 ++++++++++++++++++++++++++
>  tests/xlconfigtest.c                 |  1 +
>  4 files changed, 161 insertions(+)

ACK

Michal




More information about the libvir-list mailing list