From abef0164963dbbe75ba7cd7ce06926e17d2eb326 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Wed, 3 Dec 2014 18:15:40 +0100 Subject: [PATCH] networkValidate: Disallow bandwidth in portgroups too https://bugzilla.redhat.com/show_bug.cgi?id=1115292 In one of the previous commits (eafb53fe) we disallowed network-wide bandwidth to some network types. However, we forgot about which can have too. Signed-off-by: Michal Privoznik --- 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 9ccc9f8f8d..1459f0401c 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 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)) {