[one-users] [patch] Add support for rate-limiting a NIC on XEN

Vivien Bernet-Rollande vivien.bernet-rollande at nexen.alterway.fr
Tue Jun 7 05:00:39 PDT 2011


Hi everyone.

I've a lot of hopes set on those networking setup and teardown hooks 
that were discussed during yesterday's session. They would allow me to 
have much finer control on quite a few items (filtering, traffic 
shaping, etc.) while keeping support for migration.

Anyway, in the meantime, I have a use case where I need to be able to 
limit the upload rate of a VM. Basically, we bill clients based on their 
upload traffic. We need the ability to cap clients who wish to make sure 
they never go over their quota.I'd rather do this in dom0 with tc, which 
allows for nice burst control, but the hooks I would need don't exist yet.

The patch I propose ( see 
http://dev.opennebula.org/attachments/385/one_xen_rate_limit.diff ) adds 
support for rate limiting using the "rate" configuration parameter for a 
Xen vif. There is no support for KVM since I can't test it, but I doubt 
it would be hard to add. There is no support in Sunstone or the various 
API servers either.

The ONE config simply file goes like this :

NIC  = [ NETWORK = "INTERNET",
          RATE = "10Mb/s" ]

This will create the following deployment file :
vif = [
     'mac=02:00:01:02:03:04,ip=1.2.3.4,bridge=xenbr0,rate=10Mb/s',
]

And a "xenstore-ls" will show :
ma
/local/domain/0/backend/vif/20/0/rate = "62500,50000"

Iperf tests show an effective upload rate of 7-8 Mb/s, so provisioning a 
bit over the desired value seems to be necessary.


Something I'd really love to see would be the ability to add raw data on 
a vif or block device. That way, I could have solved my issue using 
something like :

NIC  = [ NETWORK = "INTERNET",
          RAW = "rate=10Mb/s" ]

-- 
Vivien Bernet-Rollande
Systems&  Networking Engineer
Alter Way Hosting




More information about the Users mailing list