My last post failed, resend...
Max Zhen at 2008-12-24 18:39 wrote:
Hi,
I'm working on adding bandwidth control support in
virt-install/virsh/libvirt on Xen.
This support can allow setting bandwidth control in dom0 (I'm working on
Solaris dom0 now) for virtual nic devices used in a domU.
I've attached my design in this email.
Basically, this design is about how to represent bandwidth limit
information in command line for virsh/virt-install and how to represent
it in current XML configuration file for a domU.
Your comments will be highly appreciated :).
Thanks,
Max
There are a few things to do to achieve this goal:
1. extend current command line syntax of 'virsh attach-interface'
2. extend current command line syntax of 'virt-install'
3. define bandwidth representation in XML format
For 1.
I will change the current command line syntax to:
virsh attach-interface <domain> <type> <source> [--target
<target>]
[--mac <mac>] [--script <script>] [--rate <rate-string>]
So that we are able to specify bandwidth as "--rate 100M" in command line,
like:
#virsh attach-interface domu bridge bge0 --rate 100M
In this case, bandwidth is specified as an integer with one of the scale
suffixes K, M, or G for Kbps, Mbps, or Gbps.
For 2.
I will add one more option "--rate=rate-string" to current option set of
virt-install command. Users can repeatedly add more than one 'rate' options
to set bandwidth for multiple nic devices respectively, if needed.
For example, with below command line, we start installing a domain with two
nic devices whose bandwidth are set to 100Mb/s and 200Mb/s respectively:
#virt-install -n snv105 -r 2048 -p --file=/root/snv105
--location=/solarisdvd.iso -b bge0 --rate=100M -b bge1 --rate=200M
In this case, bandwidth is specified as an integer with one of the scale
suffixes K, M, or G for Kbps, Mbps, or Gbps.
For 3.
All user specified bandwidth will be represented as part of interface
element currently defined in XML configuration file.
The new format looks like:
<interface type='bridge'>
<source bridge='e1000g1'/>
<flowcontrol>
<rate unit='megabit' period='second' value='100'/>
</flowcontrol>
</interface>
So, I create a new element, "flowcontrol", inside "interface" element.
Inside
"flowcontrol", I provide bandwidth by setting "rate" element with
three
attributes, "unit", "period" and "value" to express the
bandwidth limit.
The supported unit can be 'gigabit', 'megabit' and 'kilobit'.
The supported period can be 'second', 'millisecond' and
'microsecond'.
And value is an integer to express the amount of data in unit allowed to be
transfered in period of time.
More elements can be added inside "flowcontrol" element, if we want to add more
flow control policies in the future.