Extend qos DriverBase with validate_rule_for_port()

The openvswitch qos driver supports the min-bw qos rule only on
networks backed by physnets. Currently the qos driver interface does
not have a method that takes both the policy/rule and the network/port,
therefore we don't have enough information in the driver to tell if
we support the min-bw rule for a port or not. This change introduces
validate_rule_for_port(..., rule, port) so we have all the information
to tell.

The base method validate_rule_for_port() is concrete and returns True
for backwards compatibility.

Change-Id: I58a47bb895bede219cfeebbf0665aaf01660ce89
Needed-By: https://review.opendev.org/705695
Partial-Bug: #1861442
Related-Bug: #1819029
This commit is contained in:
Bence Romsics 2020-02-04 14:02:22 +01:00
parent 52f8e49297
commit 6f3fb7fc81
1 changed files with 11 additions and 0 deletions

View File

@ -98,6 +98,17 @@ class DriverBase(object):
return False
return True
def validate_rule_for_port(self, context, rule, port):
"""Return True/False for valid/invalid.
This is only meant to be used when a rule is compatible
with some ports/networks but not with others (depending on
port/network properties).
Returns True by default for backwards compatibility.
"""
return True
def create_policy(self, context, policy):
"""Create policy invocation.