conf: Validate QoS values

Since we use 'tc' to set QoS, or we instruct OVS which then uses
'tc', we have to make sure values are within range acceptable to
'tc'.

Resolves: https://issues.redhat.com/browse/RHEL-45200
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2024-08-13 13:39:16 +02:00
parent ab489ea318
commit a70cdeeb2a
3 changed files with 15 additions and 1 deletions

View File

@ -22,6 +22,7 @@
#include "domain_validate.h"
#include "domain_conf.h"
#include "netdev_bandwidth_conf.h"
#include "vircgroup.h"
#include "virconftypes.h"
#include "virlog.h"
@ -2068,6 +2069,10 @@ virDomainActualNetDefValidate(const virDomainNetDef *net)
return -1;
}
if (!virNetDevBandwidthValidate(bandwidth)) {
return -1;
}
if (virDomainNetDefValidatePortOptions(macstr, actualType, vport,
virDomainNetGetActualPortOptionsIsolated(net)) < 0) {
return -1;
@ -2143,6 +2148,10 @@ virDomainNetDefValidate(const virDomainNetDef *net)
return -1;
}
if (!virNetDevBandwidthValidate(net->bandwidth)) {
return -1;
}
switch (net->type) {
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
if (!virDomainNetIsVirtioModel(net)) {

View File

@ -180,9 +180,10 @@
</define>
<define name="speed">
<data type="unsignedInt">
<data type="unsignedLong">
<param name="pattern">[0-9]+</param>
<param name="minInclusive">1</param>
<param name="maxInclusive">18014398509481984</param>
</data>
</define>
<define name="BurstSize">

View File

@ -2838,6 +2838,10 @@ networkValidate(virNetworkDriverState *driver,
return -1;
}
if (!virNetDevBandwidthValidate(def->bandwidth)) {
return -1;
}
/* we support configs with a single PF defined:
* <pf dev='eth0'/>
* or with a list of netdev names: