From: John Ferlan Date: Wed, 12 Feb 2014 20:33:02 +0000 (-0500) Subject: bandwidth: Adjust documentation X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7eb37a0d65f147f3e50843efd140f169e4ac46e7;p=libvirt.git bandwidth: Adjust documentation Recent autotest/virt-test testing on f20 discovered an anomaly in how the bandwidth options are documented and used. This was discovered due to a bug fix in the /sbin/tc utility found in iproute-3.11.0.1 (on f20) in which overflow was actually caught and returned as an error. The fix was first introduced in iproute-3.10 (search on iproute2 commit 'a303853e'). The autotest/virt-test test for virsh domiftune was attempting to send the largest unsigned integer value (4294967295) for maximum value testing. The libvirt xml implementation was designed to manage values in kilobytes thus when this value was passed to /sbin/tc, it (now) properly rejected the 4294967295kbps value. Investigation of the problem discovered that formatdomain.html.in and formatnetwork.html.in described the elements and property types slightly differently, although they use the same code - virNetDevBandwidthParseRate() (shared by portgroups, domains, and networks xml parsers). Rather than have the descriptions in two places, this patch will combine and reword the description under formatnetwork.html.in and have formatdomain.html.in link to that description. This documentation faux pas was continued into the virsh man page where the bandwidth description for both 'attach-interface' and 'domiftune' did not indicate the format of each value, thus leading to the test using largest unsigned integer value assuming "bps" rather than "kbps", which ultimately was wrong. --- diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 46609830af..ea1a97b0cb 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3750,37 +3750,10 @@ qemu-kvm -net nic,model=? /dev/null

This part of interface XML provides setting quality of service. Incoming - and outgoing traffic can be shaped independently. The - bandwidth element can have at most one inbound - and at most one outbound child elements. Leaving any of these - children element out result in no QoS applied on that traffic direction. - So, when you want to shape only domain's incoming traffic, use - inbound only, and vice versa. Each of these elements have one - mandatory attribute average (or floor as - described below). average specifies average bit rate on - the interface being shaped. Then there are two optional attributes: - peak, which specifies maximum rate at which interface can send - data, and burst, amount of bytes that can be burst at - peak speed. Accepted values for attributes are integer - numbers. The units for average and peak attributes - are kilobytes per second, and for the burst just kilobytes. - Note the limitation of implementation: the peak attribute in - outbound element is ignored (as linux ingress filters don't - know it yet). Since 0.9.4 The inbound can - optionally have floor attribute. This is there for - guaranteeing minimal throughput for shaped interfaces. This, however, - requires that all traffic goes through one point where QoS decisions can - take place. That's why this attribute works only for virtual networks for - now (that is <interface type='network'/> with a - forward type of route, nat, or no forward at all). Moreover, the - virtual network the interface is connected to is required to have at least - inbound QoS set (average at least). Moreover, with - floor attribute users don't need to specify - average. However, peak and burst - attributes still require average. Currently, linux kernel - doesn't allow ingress qdiscs to have any classes therefore - floor can be applied only on inbound and not - outbound. Since 1.0.1 + and outgoing traffic can be shaped independently. + The bandwidth element and its child elements are described + in the QoS section of + the Network XML.

Setting VLAN tag (on supported network types only)
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 1ca1bec63f..fc56b4267a 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -412,49 +412,111 @@

The <bandwidth> element allows setting - quality of service for a particular network. - Since 0.9.4 The limits specified - are applied to the aggregate of all traffic to/from all guest - interfaces attached to that network, not to each guest - interface individually. Setting bandwidth for a - network is supported only for networks with - a <forward> mode + quality of service for a particular network + (since 0.9.4). Setting + bandwidth for a network is supported only + for networks with a <forward> mode of route, nat, or no mode at all - (i.e. an "isolated" network). bandwidth setting + (i.e. an "isolated" network). Setting bandwidth is not supported for forward modes of bridge, passthrough, private, - or hostdev, and attempts to do this will lead to - a failure to define the network (or to create a transient - network). + or hostdev. Attempts to do this will lead to + a failure to define the network or to create a transient network. +

+

+ The <bandwidth> element can only be a + subelement of a domain's <interface>, a + subelement of a <network>, or a subelement of + a <portgroup> in a <network>. +

+

+ As a subelement of a domain's <interface>, + the bandwidth only applies to that one interface of the domain. + As a subelement of a <network>, the bandwidth + is a total aggregate bandwidth to/from all guest interfaces attached + to that network, not to each guest interface individually. + If a domain's <interface> has + <bandwidth> element values higher + than the aggregate for the entire network, then the aggregate + bandwidth for the <network> takes precedence. + This is because the two choke points are independent of each other + where the domain's <interface> bandwidth control + is applied on the interface's tap device, while the + <network> bandwidth control is applied on the + interface part of the bridge device created for that network. +

+

+ As a subelement of a + <portgroup> in a <network>, + if a domain's <interface> has a + portgroup attribute in its + <source> element and if the + <interface> + itself has no <bandwidth> element, then the + <bandwidth> element of the portgroup will be + applied individually to each guest interface defined to be a + member of that portgroup. Any <bandwidth> + element in the domain's <interface> definition + will override the setting in the portgroup + (since 1.0.1).

Incoming and outgoing traffic can be shaped independently. The - bandwidth element can have at most - one inbound and at most one outbound + bandwidth element can have at most one + inbound and at most one outbound child element. Leaving either of these children elements out results in no QoS applied for that traffic direction. So, - when you want to shape only a network's incoming traffic, use + when you want to shape only incoming traffic, use inbound only, and vice versa. Each of these - elements have one mandatory attribute - average, - which specifies the desired average bit rate for the interface - being shaped (in kibibytes/second). There are also two - optional attributes: peak, which specifies the - maximum rate at which the bridge can send data (again in - kibibytes/second), and burst - the amount of - bytes that can be transmitted in a single burst at - peak speed (in kibibytes). Accepted values for - attributes are integer numbers. The allotted bandwidth is - shared equally between domains connected to the network. + elements have one mandatory attribute - average (or + floor as described below). The attributes are as follows, + where accepted values for each attribute is an integer number.

+
+
average
+
+ Specifies the desired average bit rate for the interface + being shaped (in kilobytes/second). +
+
peak
+
+ Optional attribute which specifies the maximum rate at + which the bridge can send data (in kilobytes/second). + Note the limitation of implementation: this attribute in the + outbound element is ignored (as Linux ingress + filters don't know it yet). +
+
burst
+
+ Optional attribute which specifies the amount of kilobytes that + can be transmitted in a single burst at peak speed. +
+
floor
+
+ Optional attribute available only for the inbound + element. This attribute guarantees minimal throughput for + shaped interfaces. This, however, requires that all traffic + goes through one point where QoS decisions can take place, hence + why this attribute works only for virtual networks for now + (that is <interface type='network'/> with a + forward type of route, nat, or no forward at all). Moreover, the + virtual network the interface is connected to is required to have + at least inbound QoS set (average at least). If + using the floor attribute users don't need to specify + average. However, peak and + burst attributes still require average. + Currently, the Linux kernel doesn't allow ingress qdiscs to have + any classes therefore floor can be applied only + on inbound and not outbound. +
+
+

- A <portgroup> element can also include - a <bandwidth> element. In that case, the - specified bandwidth will be applied individually to each guest - interface defined to be a member of that portgroup. - Any <bandwidth> element in the guest's - interface definition will override the setting in the - portgroup. - Since 1.0.1 + Attributes average, peak, and + burst are available + since 0.9.4, while the + floor attribute is available + since 1.0.1.

Setting VLAN tag (on supported network types only)
@@ -561,7 +623,7 @@ network), and each portgroup has a name, as well as various subelements associated with it. The currently supported subelements are <bandwidth> - (documented here) + (described here) and <virtualport> (documented here). If a domain interface definition specifies a portgroup (by diff --git a/tools/virsh.pod b/tools/virsh.pod index a13a1c74c6..301043f0a0 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -681,7 +681,10 @@ or the MAC address. If no I<--inbound> or I<--outbound> is specified, this command will query and show the bandwidth settings. Otherwise, it will set the inbound or outbound bandwidth. I is the same as -in command I. +in command I. Values for I and I are +expressed in kilobytes per second, while I is expressed in kilobytes +in a single burst at -I speed as described in the Network XML +documentation at L. If I<--live> is specified, affect a running guest. If I<--config> is specified, affect the next boot of a persistent guest. @@ -2020,7 +2023,10 @@ of the network interface. I