Merge "Cleanup of SecurityGroup classes"

This commit is contained in:
Jenkins 2016-10-21 04:18:22 +00:00 committed by Gerrit Code Review
commit 81f1650bb7
8 changed files with 31 additions and 19 deletions

View File

@ -55,7 +55,7 @@ running on the compute nodes, and modifying the IPTables rules on each hyperviso
* `SecurityGroupServerRpcMixin <https://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/securitygroups_rpc_base.py>`_ - defines the RPC API that the plugin uses to communicate with the agents running on the compute nodes * `SecurityGroupServerRpcMixin <https://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/securitygroups_rpc_base.py>`_ - defines the RPC API that the plugin uses to communicate with the agents running on the compute nodes
* SecurityGroupServerRpcMixin - Defines the API methods used to fetch data from the database, in order to return responses to agents via the RPC API * SecurityGroupServerRpcMixin - Defines the API methods used to fetch data from the database, in order to return responses to agents via the RPC API
* `Agent RPC classes <https://git.openstack.org/cgit/openstack/neutron/tree/neutron/agent/securitygroups_rpc.py>`_ * `Agent RPC classes <https://git.openstack.org/cgit/openstack/neutron/tree/neutron/api/rpc/handlers/securitygroups_rpc.py>`_
* The SecurityGroupServerRpcApi defines the API methods that can be called by agents, back to the plugin that runs on the Neutron controller * The SecurityGroupServerRpcApi defines the API methods that can be called by agents, back to the plugin that runs on the Neutron controller
* The SecurityGroupAgentRpcCallbackMixin defines methods that a plugin uses to call back to an agent after performing an action called by an agent. * The SecurityGroupAgentRpcCallbackMixin defines methods that a plugin uses to call back to an agent after performing an action called by an agent.

View File

@ -16,6 +16,7 @@
import functools import functools
from debtcollector import moves
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
import oslo_messaging import oslo_messaging
@ -283,16 +284,24 @@ class SecurityGroupAgentRpc(object):
self.refresh_firewall(updated_devices) self.refresh_firewall(updated_devices)
# TODO(armax): For bw compat with external dependencies; to be dropped in M. # TODO(armax): For bw compat with external dependencies; to be dropped in P.
SG_RPC_VERSION = ( # NOTE(dasm): Should be already removed, but didn't have DeprecationWarning.
securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION SG_RPC_VERSION = moves.moved_function(
securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION,
'SG_RPC_VERSION', __name__, version='Liberty', removal_version='Pike'
) )
SecurityGroupServerRpcApi = ( SecurityGroupServerRpcApi = moves.moved_class(
securitygroups_rpc.SecurityGroupServerRpcApi securitygroups_rpc.SecurityGroupServerRpcApi,
'SecurityGroupServerRpcApi', old_module_name=__name__, version='Liberty',
removal_version='Pike'
) )
SecurityGroupAgentRpcApiMixin = ( SecurityGroupAgentRpcApiMixin = moves.moved_class(
securitygroups_rpc.SecurityGroupAgentRpcApiMixin securitygroups_rpc.SecurityGroupAgentRpcApiMixin,
'SecurityGroupAgentRpcApiMixin', old_module_name=__name__,
version='Liberty', removal_version='Pike'
) )
SecurityGroupAgentRpcCallbackMixin = ( SecurityGroupAgentRpcCallbackMixin = moves.moved_class(
securitygroups_rpc.SecurityGroupAgentRpcCallbackMixin securitygroups_rpc.SecurityGroupAgentRpcCallbackMixin,
'SecurityGroupAgentRpcCallbackMixin', old_module_name=__name__,
version='Liberty', removal_version='Pike'
) )

View File

@ -30,8 +30,9 @@ from osprofiler import profiler
from neutron._i18n import _LE, _LI from neutron._i18n import _LE, _LI
from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager
from neutron.agent import rpc as agent_rpc from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc from neutron.agent import securitygroups_rpc as agent_sg_rpc
from neutron.api.rpc.callbacks import resources from neutron.api.rpc.callbacks import resources
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
from neutron.callbacks import events from neutron.callbacks import events
from neutron.callbacks import registry from neutron.callbacks import registry
from neutron.callbacks import resources as local_resources from neutron.callbacks import resources as local_resources
@ -150,7 +151,7 @@ class CommonAgentLoop(service.Service):
def setup_rpc(self): def setup_rpc(self):
self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN) self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
self.sg_agent = sg_rpc.SecurityGroupAgentRpc( self.sg_agent = agent_sg_rpc.SecurityGroupAgentRpc(
self.context, self.sg_plugin_rpc, defer_refresh_firewall=True) self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)
self.agent_id = self.mgr.get_agent_id() self.agent_id = self.mgr.get_agent_id()

View File

@ -35,7 +35,7 @@ from neutron._i18n import _LE, _LI, _LW
from neutron.agent.linux import bridge_lib from neutron.agent.linux import bridge_lib
from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils from neutron.agent.linux import utils
from neutron.agent import securitygroups_rpc as sg_rpc from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config from neutron.common import config as common_config
from neutron.common import exceptions from neutron.common import exceptions
from neutron.common import profiler as setup_profiler from neutron.common import profiler as setup_profiler

View File

@ -26,7 +26,7 @@ from oslo_service import service
from neutron._i18n import _LE, _LI from neutron._i18n import _LE, _LI
from neutron.agent.linux import ip_lib from neutron.agent.linux import ip_lib
from neutron.agent import securitygroups_rpc as sg_rpc from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config from neutron.common import config as common_config
from neutron.common import topics from neutron.common import topics
from neutron.plugins.common import constants as p_constants from neutron.plugins.common import constants as p_constants

View File

@ -32,8 +32,9 @@ import six
from neutron._i18n import _, _LE, _LI, _LW from neutron._i18n import _, _LE, _LI, _LW
from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager
from neutron.agent import rpc as agent_rpc from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc from neutron.agent import securitygroups_rpc as agent_sg_rpc
from neutron.api.rpc.callbacks import resources from neutron.api.rpc.callbacks import resources
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config from neutron.common import config as common_config
from neutron.common import profiler as setup_profiler from neutron.common import profiler as setup_profiler
from neutron.common import topics from neutron.common import topics
@ -122,7 +123,7 @@ class SriovNicSwitchAgent(object):
self.context = context.get_admin_context_without_session() self.context = context.get_admin_context_without_session()
self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN) self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN) self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context, self.sg_agent = agent_sg_rpc.SecurityGroupAgentRpc(self.context,
self.sg_plugin_rpc) self.sg_plugin_rpc)
self._setup_rpc() self._setup_rpc()
self.ext_manager = self._create_agent_extension_manager( self.ext_manager = self._create_agent_extension_manager(

View File

@ -42,9 +42,10 @@ from neutron.agent.common import polling
from neutron.agent.common import utils from neutron.agent.common import utils
from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager
from neutron.agent import rpc as agent_rpc from neutron.agent import rpc as agent_rpc
from neutron.agent import securitygroups_rpc as sg_rpc from neutron.agent import securitygroups_rpc as agent_sg_rpc
from neutron.api.rpc.callbacks import resources from neutron.api.rpc.callbacks import resources
from neutron.api.rpc.handlers import dvr_rpc from neutron.api.rpc.handlers import dvr_rpc
from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
from neutron.callbacks import events as callback_events from neutron.callbacks import events as callback_events
from neutron.callbacks import registry from neutron.callbacks import registry
from neutron.common import config from neutron.common import config
@ -237,7 +238,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
self._restore_local_vlan_map() self._restore_local_vlan_map()
# Security group agent support # Security group agent support
self.sg_agent = sg_rpc.SecurityGroupAgentRpc( self.sg_agent = agent_sg_rpc.SecurityGroupAgentRpc(
self.context, self.sg_plugin_rpc, defer_refresh_firewall=True, self.context, self.sg_plugin_rpc, defer_refresh_firewall=True,
integration_bridge=self.int_br) integration_bridge=self.int_br)

View File

@ -1638,7 +1638,7 @@ class SecurityGroupAgentRpcWithDeferredRefreshTestCase(
self.assertFalse(self.firewall.security_group_updated.called) self.assertFalse(self.firewall.security_group_updated.called)
class FakeSGNotifierAPI(sg_rpc.SecurityGroupAgentRpcApiMixin): class FakeSGNotifierAPI(securitygroups_rpc.SecurityGroupAgentRpcApiMixin):
def __init__(self): def __init__(self):
self.topic = 'fake' self.topic = 'fake'
target = oslo_messaging.Target(topic=self.topic, version='1.0') target = oslo_messaging.Target(topic=self.topic, version='1.0')