Cleanup of SecurityGroup classes

Commit Ifb70a118cef48c3c4cd313e22e907aa47bc51ad0 intended to remove some
classes, but without DeprecationWarnings. To prevent from possible
problems, if it would be now removed, added Warnings and included info,
about future removal.

Change-Id: Iacb93abc363bf638efc3acb5b29c02a7508bc43a
Related-Bug: #1444112
This commit is contained in:
Dariusz Smigiel 2016-08-30 20:43:42 +00:00
parent d718895974
commit 9733825896
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 - 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 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
from debtcollector import moves
from oslo_config import cfg
from oslo_log import log as logging
import oslo_messaging
@ -283,16 +284,24 @@ class SecurityGroupAgentRpc(object):
self.refresh_firewall(updated_devices)
# TODO(armax): For bw compat with external dependencies; to be dropped in M.
SG_RPC_VERSION = (
securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION
# TODO(armax): For bw compat with external dependencies; to be dropped in P.
# NOTE(dasm): Should be already removed, but didn't have DeprecationWarning.
SG_RPC_VERSION = moves.moved_function(
securitygroups_rpc.SecurityGroupAgentRpcApiMixin.SG_RPC_VERSION,
'SG_RPC_VERSION', __name__, version='Liberty', removal_version='Pike'
)
SecurityGroupServerRpcApi = (
securitygroups_rpc.SecurityGroupServerRpcApi
SecurityGroupServerRpcApi = moves.moved_class(
securitygroups_rpc.SecurityGroupServerRpcApi,
'SecurityGroupServerRpcApi', old_module_name=__name__, version='Liberty',
removal_version='Pike'
)
SecurityGroupAgentRpcApiMixin = (
securitygroups_rpc.SecurityGroupAgentRpcApiMixin
SecurityGroupAgentRpcApiMixin = moves.moved_class(
securitygroups_rpc.SecurityGroupAgentRpcApiMixin,
'SecurityGroupAgentRpcApiMixin', old_module_name=__name__,
version='Liberty', removal_version='Pike'
)
SecurityGroupAgentRpcCallbackMixin = (
securitygroups_rpc.SecurityGroupAgentRpcCallbackMixin
SecurityGroupAgentRpcCallbackMixin = moves.moved_class(
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.agent.l2 import l2_agent_extensions_manager as ext_manager
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.handlers import securitygroups_rpc as sg_rpc
from neutron.callbacks import events
from neutron.callbacks import registry
from neutron.callbacks import resources as local_resources
@ -150,7 +151,7 @@ class CommonAgentLoop(service.Service):
def setup_rpc(self):
self.plugin_rpc = agent_rpc.PluginApi(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.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 ip_lib
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 exceptions
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.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 topics
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.agent.l2 import l2_agent_extensions_manager as ext_manager
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.handlers import securitygroups_rpc as sg_rpc
from neutron.common import config as common_config
from neutron.common import profiler as setup_profiler
from neutron.common import topics
@ -122,7 +123,7 @@ class SriovNicSwitchAgent(object):
self.context = context.get_admin_context_without_session()
self.plugin_rpc = agent_rpc.PluginApi(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._setup_rpc()
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.l2 import l2_agent_extensions_manager as ext_manager
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.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 registry
from neutron.common import config
@ -237,7 +238,7 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
self._restore_local_vlan_map()
# 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,
integration_bridge=self.int_br)

View File

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