Merge "Change list of available qos rules"
This commit is contained in:
commit
65ce6d6f49
@ -100,12 +100,14 @@ 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
|
||||
the common subset of rules supported by all active QoS drivers.
|
||||
set of rules supported by at least one active QoS driver.
|
||||
|
||||
Note: the list of supported rule types reported by core plugin is not enforced
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
Database models
|
||||
|
@ -137,20 +137,14 @@ class QosServiceDriverManager(object):
|
||||
if not self._drivers:
|
||||
return []
|
||||
|
||||
rule_types = set(qos_consts.VALID_RULE_TYPES)
|
||||
rule_types = set()
|
||||
|
||||
# Recalculate on every call to allow drivers determine supported rule
|
||||
# types dynamically
|
||||
for driver in self._drivers:
|
||||
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
|
||||
rule_types |= set(driver.supported_rules)
|
||||
|
||||
LOG.debug("Supported QoS rule types "
|
||||
"(common subset for all loaded QoS drivers): %s", rule_types)
|
||||
"(rules supported by at least one loaded QoS driver): %s",
|
||||
rule_types)
|
||||
return rule_types
|
||||
|
@ -143,7 +143,7 @@ class TestQoSDriversRulesValidations(TestQosDriversManagerBase):
|
||||
|
||||
class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
||||
"""Test supported rules"""
|
||||
def test_available_rules_one_in_common(self):
|
||||
def test_available_rules(self):
|
||||
driver_manager = self._create_manager_with_drivers({
|
||||
'driver-A': {
|
||||
'is_loaded': True,
|
||||
@ -175,32 +175,6 @@ class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
||||
}
|
||||
})
|
||||
self.assertEqual(driver_manager.supported_rule_types,
|
||||
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([]))
|
||||
set([qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
|
||||
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH,
|
||||
qos_consts.RULE_TYPE_DSCP_MARKING]))
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
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.
|
Loading…
Reference in New Issue
Block a user