Merge "Enforce "qos_max_rate" and "qos_burst" in OVN QoS options"

This commit is contained in:
Zuul 2020-02-18 13:57:40 +00:00 committed by Gerrit Code Review
commit 82ebbbd556
3 changed files with 10 additions and 11 deletions

View File

@ -714,9 +714,9 @@ class OVNClient(object):
qos_rule.update(match=match)
# QoS of bandwidth_limit
if 'qos_max_rate' in qos_options:
qos_rule.update(rate=int(qos_options['qos_max_rate']),
burst=int(qos_options['qos_burst']),
dscp=None)
burst = qos_options.get('qos_burst')
qos_rule.update(rate=qos_options['qos_max_rate'],
burst=burst, dscp=None)
# QoS of dscp
elif 'dscp_mark' in qos_options:
qos_rule.update(rate=None, burst=None,

View File

@ -103,12 +103,10 @@ class OVNQosDriver(object):
context, policy_id)
for rule in all_rules:
if isinstance(rule, qos_rule.QosBandwidthLimitRule):
if rule.max_kbps:
options['qos_max_rate'] = str(rule.max_kbps)
options['qos_max_rate'] = rule.max_kbps
if rule.max_burst_kbps:
options['qos_burst'] = str(rule.max_burst_kbps)
if rule.direction:
options['direction'] = rule.direction
options['qos_burst'] = rule.max_burst_kbps
options['direction'] = rule.direction
if isinstance(rule, qos_rule.QosDscpMarkingRule):
options['dscp_mark'] = rule.dscp_mark
options['direction'] = constants.EGRESS_DIRECTION

View File

@ -66,10 +66,11 @@ class TestOVNQosDriver(base.BaseTestCase):
self.policy = self._create_fake_policy()
self.port = self._create_fake_port()
self.bw_rule = self._create_bw_limit_rule()
self.bw_expected = {'direction': 'egress', 'qos_max_rate': '1000',
'qos_burst': '100000'}
self.bw_expected = {'qos_max_rate': 1000, 'qos_burst': 100000,
'direction': constants.EGRESS_DIRECTION}
self.dscp_rule = self._create_dscp_rule()
self.dscp_expected = {'dscp_mark': 16, 'direction': 'egress'}
self.dscp_expected = {'dscp_mark': 16,
'direction': constants.EGRESS_DIRECTION}
def _create_bw_limit_rule(self):
rule_obj = qos_rule.QosBandwidthLimitRule()