diff --git a/neutron_lib/exceptions/qos.py b/neutron_lib/exceptions/qos.py index ee5fd1475..7b5bdb7c2 100644 --- a/neutron_lib/exceptions/qos.py +++ b/neutron_lib/exceptions/qos.py @@ -69,6 +69,11 @@ class QosRuleNotSupported(e.Conflict): message = _("Rule %(rule_type)s is not supported by port %(port_id)s") +class QosRuleNotSupportedByNetwork(e.Conflict): + message = _("Rule %(rule_type)s is not supported " + "by network %(network_id)s") + + class QoSRuleParameterConflict(e.Conflict): message = _("Unable to add the rule with value %(rule_value)s to the " "policy %(policy_id)s as the existing rule of type " diff --git a/neutron_lib/services/qos/base.py b/neutron_lib/services/qos/base.py index 574a6f99a..938e40351 100644 --- a/neutron_lib/services/qos/base.py +++ b/neutron_lib/services/qos/base.py @@ -109,6 +109,17 @@ class DriverBase(object): """ return True + def validate_rule_for_network(self, context, rule, network_id): + """Return True/False for valid/invalid. + + This is only meant to be used when a rule is compatible + with some networks but not with others (depending on + network properties). + + Returns True by default for backwards compatibility. + """ + return True + def create_policy(self, context, policy): """Create policy invocation.