Change list of available qos rules
This patch changes way how neutron calculates which QoS rules are available to use. It now returns all rule types which are supported by at least one loaded QoS driver. If user will want to apply policy with rule unsupported by driver used by port then it will be catched on port/network update event. This validation mechanism was introduced in I75bd18b3a1875daa5639dd141fb7bbd6e1c54118 DocImpact: list of returned available QoS rule types is changed Change-Id: Ia00d349625db358ab486802fc0ff2e69eaa3895e Closes-Bug: #1686898
This commit is contained in:
parent
e8e89d8a87
commit
3299cdffae
@ -100,12 +100,14 @@ For a list of all rule types, see:
|
|||||||
neutron.services.qos.qos_consts.VALID_RULE_TYPES.
|
neutron.services.qos.qos_consts.VALID_RULE_TYPES.
|
||||||
|
|
||||||
The list of supported QoS rule types exposed by neutron is calculated as
|
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
|
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
|
when accessing QoS rule resources.
|
||||||
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 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
|
Database models
|
||||||
|
@ -137,20 +137,14 @@ class QosServiceDriverManager(object):
|
|||||||
if not self._drivers:
|
if not self._drivers:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
rule_types = set(qos_consts.VALID_RULE_TYPES)
|
rule_types = set()
|
||||||
|
|
||||||
# Recalculate on every call to allow drivers determine supported rule
|
# Recalculate on every call to allow drivers determine supported rule
|
||||||
# types dynamically
|
# types dynamically
|
||||||
for driver in self._drivers:
|
for driver in self._drivers:
|
||||||
new_rule_types = rule_types & set(driver.supported_rules)
|
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 "
|
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
|
return rule_types
|
||||||
|
@ -143,7 +143,7 @@ class TestQoSDriversRulesValidations(TestQosDriversManagerBase):
|
|||||||
|
|
||||||
class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
||||||
"""Test supported rules"""
|
"""Test supported rules"""
|
||||||
def test_available_rules_one_in_common(self):
|
def test_available_rules(self):
|
||||||
driver_manager = self._create_manager_with_drivers({
|
driver_manager = self._create_manager_with_drivers({
|
||||||
'driver-A': {
|
'driver-A': {
|
||||||
'is_loaded': True,
|
'is_loaded': True,
|
||||||
@ -175,32 +175,6 @@ class TestQosDriversManagerRules(TestQosDriversManagerBase):
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.assertEqual(driver_manager.supported_rule_types,
|
self.assertEqual(driver_manager.supported_rule_types,
|
||||||
set([qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH]))
|
set([qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
|
||||||
|
qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH,
|
||||||
def test_available_rules_no_rule_in_common(self):
|
qos_consts.RULE_TYPE_DSCP_MARKING]))
|
||||||
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([]))
|
|
||||||
|
@ -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