[libvirt] [PATCH] networkValidate: Disallow bandwidth in portgroups too

In one of the previous commits (eafb53fe) we disallowed network-wide bandwidth to some network types. However, we forgot about <portgroups/> which can have <bandwidth/> too. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/network/bridge_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 9ccc9f8..1459f04 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2711,6 +2711,7 @@ networkValidate(virNetworkDefPtr def, virPortGroupDefPtr defaultPortGroup = NULL; virNetworkIpDefPtr ipdef; bool ipv4def = false, ipv6def = false; + bool bandwidthAllowed = true; /* check for duplicate networks */ if (virNetworkObjIsDuplicate(&driver->networks, def, check_active) < 0) @@ -2772,6 +2773,7 @@ networkValidate(virNetworkDefPtr def, virNetworkForwardTypeToString(def->forward.type)); return -1; } + bandwidthAllowed = false; } /* We only support dhcp on one IPv4 address and @@ -2850,6 +2852,15 @@ networkValidate(virNetworkDefPtr def, } defaultPortGroup = &def->portGroups[i]; } + + if (def->portGroups[i].bandwidth && !bandwidthAllowed) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported <bandwidth> element in network '%s' " + "in portgroup '%s' with forward mode='%s'"), + def->name, def->portGroups[i].name, + virNetworkForwardTypeToString(def->forward.type)); + return -1; + } } if (badVlanUse || (vlanUsed && !vlanAllowed && !defaultPortGroup)) { -- 2.0.4

On 12/03/2014 12:24 PM, Michal Privoznik wrote:
In one of the previous commits (eafb53fe) we disallowed network-wide bandwidth to some network types. However, we forgot about <portgroups/> which can have <bandwidth/> too.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/network/bridge_driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
ACK John
participants (2)
-
John Ferlan
-
Michal Privoznik