Merge "Revert "Change list of available qos rules""

This commit is contained in:
Jenkins 2017-06-22 00:21:04 +00:00 committed by Gerrit Code Review
commit dd52e9fbb8
4 changed files with 44 additions and 21 deletions
doc/source/devref
neutron
services/qos/drivers
tests/unit/services/qos/drivers
releasenotes/notes

@ -101,14 +101,12 @@ For a list of all rule types, see:
neutron.services.qos.qos_consts.VALID_RULE_TYPES.
The list of supported QoS rule types exposed by neutron is calculated as
set of rules supported by at least one active QoS driver.
the common subset of rules supported by all active QoS drivers.
Note: the list of supported rule types reported by core plugin is not enforced
when accessing QoS rule resources.
When a policy is attached to a port or a network, or when a rule is created or updated,
core plugins may validate write requests against their backends, and invalidate requests
that don't make sense or can't be implemented by affected backends.
when accessing QoS rule resources. This is mostly because then we would not be
able to create rules while at least one of the QoS driver in gate lacks
support for the rules we're trying to test.
Database models

@ -141,14 +141,20 @@ class QosServiceDriverManager(object):
if not self._drivers:
return []
rule_types = set()
rule_types = set(qos_consts.VALID_RULE_TYPES)
# Recalculate on every call to allow drivers determine supported rule
# types dynamically
for driver in self._drivers:
rule_types |= set(driver.supported_rules)
new_rule_types = rule_types & set(driver.supported_rules)
dropped_rule_types = rule_types - new_rule_types
if dropped_rule_types:
LOG.debug("%(rule_types)s rule types disabled "
"because enabled %(driver)s does not support them",
{'rule_types': ', '.join(dropped_rule_types),
'driver': driver.name})
rule_types = new_rule_types
LOG.debug("Supported QoS rule types "
"(rules supported by at least one loaded QoS driver): %s",
rule_types)
"(common subset for all loaded QoS drivers): %s", rule_types)
return rule_types

@ -144,7 +144,7 @@ class TestQoSDriversRulesValidations(TestQosDriversManagerBase):
class TestQosDriversManagerRules(TestQosDriversManagerBase):
"""Test supported rules"""
def test_available_rules(self):
def test_available_rules_one_in_common(self):
driver_manager = self._create_manager_with_drivers({
'driver-A': {
'is_loaded': True,
@ -176,9 +176,35 @@ class TestQosDriversManagerRules(TestQosDriversManagerBase):
}
})
self.assertEqual(driver_manager.supported_rule_types,
set([qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH,
qos_consts.RULE_TYPE_DSCP_MARKING]))
set([qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH]))
def test_available_rules_no_rule_in_common(self):
driver_manager = self._create_manager_with_drivers({
'driver-A': {
'is_loaded': True,
'rules': {
qos_consts.RULE_TYPE_BANDWIDTH_LIMIT: {
"max_kbps": {'type:values': None},
"max_burst_kbps": {'type:values': None}
}
}
},
'driver-B': {
'is_loaded': True,
'rules': {
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: {
"min_kbps": {'type:values': None},
'direction': {
'type:values': constants.VALID_DIRECTIONS}
},
qos_consts.RULE_TYPE_DSCP_MARKING: {
"dscp_mark": {
'type:values': constants.VALID_DSCP_MARKS}
}
}
}
})
self.assertEqual(driver_manager.supported_rule_types, set([]))
class TestQosDriversCalls(TestQosDriversManagerBase):

@ -1,7 +0,0 @@
---
features:
- |
With `improved validation for QoS rules
<http://specs.openstack.org/openstack/neutron-specs/pike/qos-improved-validation-mechanism-rules.html>`_
API call to /v2.0/qos/rule-types now returns rule types that are supported
by at least one of enabled backends.