From: Ihar Hrachyshka Date: Tue, 4 Aug 2015 13:29:37 +0000 (+0200) Subject: Follow up with some cleanup for agent qos_driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=0e2ce9c5c4cf5a44b32858c1842a3e4bc9a46e37;p=openstack-build%2Fneutron-build.git Follow up with some cleanup for agent qos_driver Removed error handling for missing rule type handler since the rule type is already filtered thru supported types for the backend, so in case the handler is really not present, that's a huge bug in the qos driver extension and should not be handled gracefully. Also fixed some grammar in docstrings. Change-Id: Id157bd1e105051a583fea8e5107326289c551739 Partially-Implements: quantum-qos-api --- diff --git a/neutron/agent/l2/extensions/qos_agent.py b/neutron/agent/l2/extensions/qos_agent.py index 50e1d8de9..f3442c8ea 100644 --- a/neutron/agent/l2/extensions/qos_agent.py +++ b/neutron/agent/l2/extensions/qos_agent.py @@ -44,7 +44,7 @@ class QosAgentDriver(object): """Apply QoS rules on port for the first time. :param port: port object. - :param qos_policy: the QoS policy to be apply on port. + :param qos_policy: the QoS policy to be applied on port. """ #TODO(QoS) we may want to provide default implementations of calling #delete and then update @@ -55,7 +55,7 @@ class QosAgentDriver(object): """Apply QoS rules on port. :param port: port object. - :param qos_policy: the QoS policy to be apply on port. + :param qos_policy: the QoS policy to be applied on port. """ pass diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py b/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py index 3dd928531..0ef312077 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py @@ -16,8 +16,8 @@ from oslo_config import cfg from oslo_log import log as logging from neutron.agent.common import ovs_lib -from neutron.i18n import _LE, _LW from neutron.agent.l2.extensions import qos_agent +from neutron.i18n import _LW from neutron.plugins.ml2.drivers.openvswitch.mech_driver import ( mech_openvswitch) @@ -52,13 +52,8 @@ class QosOVSAgentDriver(qos_agent.QosAgentDriver): for rule in qos_policy.rules: if rule.rule_type in self._SUPPORTED_RULES: handler_name = ("".join(("_", action, "_", rule.rule_type))) - try: - handler = getattr(self, handler_name) - handler(port, rule) - except AttributeError: - LOG.error( - _LE('Failed to locate a handler for %(rule_type) ' - 'rules; skipping.'), handler_name) + handler = getattr(self, handler_name) + handler(port, rule) else: LOG.warning(_LW('Unsupported QoS rule type for %(rule_id)s: ' '%(rule_type)s; skipping'),