summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-08-11 01:04:55 +0000
committerGerrit Code Review <review@openstack.org>2015-08-11 01:04:55 +0000
commit6c92821b98063555e74e1c09569f138580a9f1db (patch)
tree11a55b1d487f64280846fe234256765fea2f57cb
parentdace55ac286ff12928f39aa7bdf44ea3d37a6dce (diff)
parentca0d7bce211d33ef8081684542ba4854cb743d74 (diff)
downloadneutron-6c92821b98063555e74e1c09569f138580a9f1db.tar.gz
Merge "Removed configuration option for qos agent driver selection" into feature/qos
-rw-r--r--etc/neutron/plugins/ml2/openvswitch_agent.ini4
-rw-r--r--neutron/agent/l2/agent_extension.py8
-rw-r--r--neutron/agent/l2/extensions/manager.py12
-rw-r--r--neutron/agent/l2/extensions/qos.py13
-rw-r--r--neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py5
-rw-r--r--neutron/plugins/ml2/drivers/openvswitch/agent/common/constants.py2
-rw-r--r--neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py3
-rw-r--r--neutron/tests/unit/agent/l2/extensions/test_manager.py4
-rwxr-xr-xneutron/tests/unit/agent/l2/extensions/test_qos.py8
9 files changed, 31 insertions, 28 deletions
diff --git a/etc/neutron/plugins/ml2/openvswitch_agent.ini b/etc/neutron/plugins/ml2/openvswitch_agent.ini
index 5a23d1ea2f..b6fd3e01a2 100644
--- a/etc/neutron/plugins/ml2/openvswitch_agent.ini
+++ b/etc/neutron/plugins/ml2/openvswitch_agent.ini
@@ -147,10 +147,6 @@
# It should be false when you use nova security group.
# enable_security_group = True
-[qos]
-# QoS agent driver
-# agent_driver = ovs
-
#-----------------------------------------------------------------------------
# Sample Configurations.
#-----------------------------------------------------------------------------
diff --git a/neutron/agent/l2/agent_extension.py b/neutron/agent/l2/agent_extension.py
index 9399f42379..4144d5fbe5 100644
--- a/neutron/agent/l2/agent_extension.py
+++ b/neutron/agent/l2/agent_extension.py
@@ -25,9 +25,15 @@ class AgentCoreResourceExtension(object):
An agent extension extends the agent core functionality.
"""
- def initialize(self):
+ def initialize(self, connection, driver_type):
"""Perform agent core resource extension initialization.
+ :param connection: RPC connection that can be reused by the extension
+ to define its RPC endpoints
+ :param driver_type: a string that defines the agent type to the
+ extension. Can be used to choose the right backend
+ implementation.
+
Called after all extensions have been loaded.
No port handling will be called before this method.
"""
diff --git a/neutron/agent/l2/extensions/manager.py b/neutron/agent/l2/extensions/manager.py
index ba9b45952b..bc8f3006f0 100644
--- a/neutron/agent/l2/extensions/manager.py
+++ b/neutron/agent/l2/extensions/manager.py
@@ -43,11 +43,19 @@ class AgentExtensionsManager(stevedore.named.NamedExtensionManager):
invoke_on_load=True, name_order=True)
LOG.info(_LI("Loaded agent extensions: %s"), self.names())
- def initialize(self, connection):
+ def initialize(self, connection, driver_type):
+ """Initialize enabled L2 agent extensions.
+
+ :param connection: RPC connection that can be reused by extensions to
+ define their RPC endpoints
+ :param driver_type: a string that defines the agent type to the
+ extension. Can be used by the extension to choose
+ the right backend implementation.
+ """
# Initialize each agent extension in the list.
for extension in self:
LOG.info(_LI("Initializing agent extension '%s'"), extension.name)
- extension.obj.initialize(connection)
+ extension.obj.initialize(connection, driver_type)
def handle_port(self, context, data):
"""Notify all agent extensions to handle port."""
diff --git a/neutron/agent/l2/extensions/qos.py b/neutron/agent/l2/extensions/qos.py
index 42336178ad..13e94cb290 100644
--- a/neutron/agent/l2/extensions/qos.py
+++ b/neutron/agent/l2/extensions/qos.py
@@ -17,7 +17,6 @@ import abc
import collections
from oslo_concurrency import lockutils
-from oslo_config import cfg
import six
from neutron.agent.l2 import agent_extension
@@ -30,7 +29,7 @@ from neutron import manager
@six.add_metaclass(abc.ABCMeta)
class QosAgentDriver(object):
- """Define stable abstract interface for QoS Agent Driver.
+ """Defines stable abstract interface for QoS Agent Driver.
QoS Agent driver defines the interface to be implemented by Agent
for applying QoS Rules on a port.
@@ -40,7 +39,6 @@ class QosAgentDriver(object):
def initialize(self):
"""Perform QoS agent driver initialization.
"""
- pass
@abc.abstractmethod
def create(self, port, qos_policy):
@@ -51,7 +49,6 @@ class QosAgentDriver(object):
"""
#TODO(QoS) we may want to provide default implementations of calling
#delete and then update
- pass
@abc.abstractmethod
def update(self, port, qos_policy):
@@ -60,7 +57,6 @@ class QosAgentDriver(object):
:param port: port object.
:param qos_policy: the QoS policy to be applied on port.
"""
- pass
@abc.abstractmethod
def delete(self, port, qos_policy):
@@ -69,21 +65,18 @@ class QosAgentDriver(object):
:param port: port object.
:param qos_policy: the QoS policy to be removed from port.
"""
- pass
class QosAgentExtension(agent_extension.AgentCoreResourceExtension):
SUPPORTED_RESOURCES = [resources.QOS_POLICY]
- def initialize(self, connection):
+ def initialize(self, connection, driver_type):
"""Perform Agent Extension initialization.
"""
- super(QosAgentExtension, self).initialize()
-
self.resource_rpc = resources_rpc.ResourcesPullRpcApi()
self.qos_driver = manager.NeutronManager.load_class_for_provider(
- 'neutron.qos.agent_drivers', cfg.CONF.qos.agent_driver)()
+ 'neutron.qos.agent_drivers', driver_type)()
self.qos_driver.initialize()
# we cannot use a dict of sets here because port dicts are not hashable
diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py b/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py
index c9afccff67..98b6210f93 100644
--- a/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py
+++ b/neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py
@@ -100,12 +100,7 @@ agent_opts = [
"timeout won't be changed"))
]
-qos_opts = [
- cfg.StrOpt('agent_driver', default='ovs', help=_('QoS agent driver.')),
-]
-
cfg.CONF.register_opts(ovs_opts, "OVS")
cfg.CONF.register_opts(agent_opts, "AGENT")
-cfg.CONF.register_opts(qos_opts, "qos")
config.register_agent_state_opts_helper(cfg.CONF)
diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/common/constants.py b/neutron/plugins/ml2/drivers/openvswitch/agent/common/constants.py
index 40fa8f0f07..ad6b897c26 100644
--- a/neutron/plugins/ml2/drivers/openvswitch/agent/common/constants.py
+++ b/neutron/plugins/ml2/drivers/openvswitch/agent/common/constants.py
@@ -88,3 +88,5 @@ ARP_RESPONDER_ACTIONS = ('move:NXM_OF_ETH_SRC[]->NXM_OF_ETH_DST[],'
OVS_RESTARTED = 0
OVS_NORMAL = 1
OVS_DEAD = 2
+
+EXTENSION_DRIVER_TYPE = 'ovs'
diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
index 211e517617..45e661a7c7 100644
--- a/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
+++ b/neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
@@ -371,7 +371,8 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
ext_manager.register_opts(self.conf)
self.ext_manager = (
ext_manager.AgentExtensionsManager(self.conf))
- self.ext_manager.initialize(connection)
+ self.ext_manager.initialize(
+ connection, constants.EXTENSION_DRIVER_TYPE)
def get_net_uuid(self, vif_id):
for network_id, vlan_mapping in six.iteritems(self.local_vlan_map):
diff --git a/neutron/tests/unit/agent/l2/extensions/test_manager.py b/neutron/tests/unit/agent/l2/extensions/test_manager.py
index 85f8533809..0f0e429404 100644
--- a/neutron/tests/unit/agent/l2/extensions/test_manager.py
+++ b/neutron/tests/unit/agent/l2/extensions/test_manager.py
@@ -33,9 +33,9 @@ class TestAgentExtensionsManager(base.BaseTestCase):
def test_initialize(self):
connection = object()
- self.manager.initialize(connection)
+ self.manager.initialize(connection, 'fake_driver_type')
ext = self._get_extension()
- ext.initialize.assert_called_once_with(connection)
+ ext.initialize.assert_called_once_with(connection, 'fake_driver_type')
def test_handle_port(self):
context = object()
diff --git a/neutron/tests/unit/agent/l2/extensions/test_qos.py b/neutron/tests/unit/agent/l2/extensions/test_qos.py
index 4ed3090b8c..0ff6175c56 100755
--- a/neutron/tests/unit/agent/l2/extensions/test_qos.py
+++ b/neutron/tests/unit/agent/l2/extensions/test_qos.py
@@ -22,7 +22,7 @@ from neutron.api.rpc.callbacks import events
from neutron.api.rpc.callbacks import resources
from neutron.api.rpc.handlers import resources_rpc
from neutron import context
-from neutron.plugins.ml2.drivers.openvswitch.agent.common import config # noqa
+from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
from neutron.tests import base
@@ -48,7 +48,8 @@ class QosExtensionRpcTestCase(QosExtensionBaseTestCase):
def setUp(self):
super(QosExtensionRpcTestCase, self).setUp()
- self.qos_ext.initialize(self.connection)
+ self.qos_ext.initialize(
+ self.connection, constants.EXTENSION_DRIVER_TYPE)
self.pull_mock = mock.patch.object(
self.qos_ext.resource_rpc, 'pull',
@@ -174,7 +175,8 @@ class QosExtensionInitializeTestCase(QosExtensionBaseTestCase):
@mock.patch.object(registry, 'subscribe')
@mock.patch.object(resources_rpc, 'ResourcesPushRpcCallback')
def test_initialize_subscribed_to_rpc(self, rpc_mock, subscribe_mock):
- self.qos_ext.initialize(self.connection)
+ self.qos_ext.initialize(
+ self.connection, constants.EXTENSION_DRIVER_TYPE)
self.connection.create_consumer.assert_has_calls(
[mock.call(
resources_rpc.resource_type_versioned_topic(resource_type),