]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Follow up with some cleanup for agent qos_driver
authorIhar Hrachyshka <ihrachys@redhat.com>
Tue, 4 Aug 2015 13:29:37 +0000 (15:29 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Wed, 5 Aug 2015 15:29:07 +0000 (17:29 +0200)
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

neutron/agent/l2/extensions/qos_agent.py
neutron/plugins/ml2/drivers/openvswitch/agent/extension_drivers/qos_driver.py

index 50e1d8de9827af8bd9e634e73d6424b5b424c239..f3442c8ea2f9938434a0f4dae8665fd3c5320763 100644 (file)
@@ -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
 
index 3dd9285316d98cefa491036213977980e843a599..0ef312077e2a425df9df4dd8e51a30e78bb5999d 100644 (file)
@@ -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'),