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 <portgroups/> which can have <bandwidth/> too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2014-12-03 18:15:40 +01:00
parent 9d31a0e4f6
commit abef016496

View File

@ -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)) {