Remove the l2pop agent_boot_time config
It was marked as deprecated, so let's do a quick removal. Related-Bug: #1813714 Change-Id: Ibc039b34b826641811a7e08b0d1bff0fd21b9193
This commit is contained in:
parent
a89244459a
commit
76c0280635
@ -1,34 +0,0 @@
|
||||
# Copyright (c) 2013 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron._i18n import _
|
||||
|
||||
|
||||
l2_population_options = [
|
||||
cfg.IntOpt('agent_boot_time', default=180,
|
||||
deprecated_for_removal=True,
|
||||
deprecated_since='Stein',
|
||||
help=_('Delay within which agent is expected to update '
|
||||
'existing ports when it restarts. This option '
|
||||
'is deprecated in favor of direct RPC restart '
|
||||
'state transfer and will be removed in a future '
|
||||
'release.')),
|
||||
]
|
||||
|
||||
|
||||
def register_l2_population_opts(cfg=cfg.CONF):
|
||||
cfg.register_opts(l2_population_options, "l2pop")
|
@ -43,7 +43,6 @@ import neutron.conf.extensions.allowedaddresspairs
|
||||
import neutron.conf.plugins.ml2.config
|
||||
import neutron.conf.plugins.ml2.drivers.agent
|
||||
import neutron.conf.plugins.ml2.drivers.driver_type
|
||||
import neutron.conf.plugins.ml2.drivers.l2pop
|
||||
import neutron.conf.plugins.ml2.drivers.linuxbridge
|
||||
import neutron.conf.plugins.ml2.drivers.macvtap
|
||||
import neutron.conf.plugins.ml2.drivers.mech_sriov.agent_common
|
||||
@ -268,8 +267,6 @@ def list_ml2_conf_opts():
|
||||
neutron.conf.plugins.ml2.drivers.driver_type.geneve_opts),
|
||||
('securitygroup',
|
||||
neutron.conf.agent.securitygroups_rpc.security_group_opts),
|
||||
('l2pop',
|
||||
neutron.conf.plugins.ml2.drivers.l2pop.l2_population_options),
|
||||
('ovs_driver',
|
||||
neutron.conf.plugins.ml2.drivers.openvswitch.mech_ovs_conf.
|
||||
ovs_driver_opts),
|
||||
|
@ -19,19 +19,15 @@ from neutron_lib import exceptions
|
||||
from neutron_lib.plugins import constants as plugin_constants
|
||||
from neutron_lib.plugins import directory
|
||||
from neutron_lib.plugins.ml2 import api
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.conf.plugins.ml2.drivers import l2pop as config
|
||||
from neutron.db import l3_hamode_db
|
||||
from neutron.plugins.ml2.drivers.l2pop import db as l2pop_db
|
||||
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
config.register_l2_population_opts()
|
||||
|
||||
|
||||
class L2populationMechanismDriver(api.MechanismDriver):
|
||||
|
||||
@ -253,19 +249,6 @@ class L2populationMechanismDriver(api.MechanismDriver):
|
||||
|
||||
return agents
|
||||
|
||||
# This will be removed in next T release
|
||||
def agent_restarted(self, context):
|
||||
agent_host = context.host
|
||||
port_context = context._plugin_context
|
||||
agent = l2pop_db.get_agent_by_host(port_context, agent_host)
|
||||
if l2pop_db.get_agent_uptime(agent) < cfg.CONF.l2pop.agent_boot_time:
|
||||
LOG.warning("Agent on host '%s' did not supply 'agent_restarted' "
|
||||
"information in RPC message, determined it restarted "
|
||||
"based on deprecated 'agent_boot_time' config option.",
|
||||
agent_host)
|
||||
return True
|
||||
return False
|
||||
|
||||
def update_port_down(self, context):
|
||||
port = context.current
|
||||
agent_host = context.host
|
||||
@ -287,7 +270,7 @@ class L2populationMechanismDriver(api.MechanismDriver):
|
||||
self.L2populationAgentNotify.remove_fdb_entries(
|
||||
self.rpc_ctx, fdb_entries)
|
||||
|
||||
def update_port_up(self, context, agent_restarted=None):
|
||||
def update_port_up(self, context, agent_restarted=False):
|
||||
port = context.current
|
||||
agent_host = context.host
|
||||
port_context = context._plugin_context
|
||||
@ -313,9 +296,6 @@ class L2populationMechanismDriver(api.MechanismDriver):
|
||||
# with high concurrency more than 1 port may be activated on an agent
|
||||
# at the same time (like VM port + a DVR port) so checking for 1 or 2
|
||||
is_first_port = agent_active_ports in (1, 2)
|
||||
if agent_restarted is None:
|
||||
# Only for backport compatibility, will be removed.
|
||||
agent_restarted = self.agent_restarted(context)
|
||||
if is_first_port or agent_restarted:
|
||||
# First port(s) activated on current agent in this network,
|
||||
# we have to provide it with the whole list of fdb entries
|
||||
|
@ -263,7 +263,7 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
|
||||
|
||||
def update_device_up(self, rpc_context, **kwargs):
|
||||
"""Device is up on agent."""
|
||||
agent_restarted = kwargs.pop('agent_restarted', None)
|
||||
agent_restarted = kwargs.pop('agent_restarted', False)
|
||||
agent_id, host, device = self._get_request_details(kwargs)
|
||||
LOG.debug("Device %(device)s up at agent %(agent_id)s",
|
||||
{'device': device, 'agent_id': agent_id})
|
||||
@ -316,7 +316,7 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
|
||||
provisioning_blocks.L2_AGENT_ENTITY)
|
||||
|
||||
def notify_l2pop_port_wiring(self, port_id, rpc_context,
|
||||
status, host, agent_restarted=None):
|
||||
status, host, agent_restarted=False):
|
||||
"""Notify the L2pop driver that a port has been wired/unwired.
|
||||
|
||||
The L2pop driver uses this notification to broadcast forwarding
|
||||
@ -339,8 +339,6 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
|
||||
# and so we don't need to update it again here. But, l2pop did not
|
||||
# handle DVR ports while restart neutron-*-agent, we need to handle
|
||||
# it here.
|
||||
if agent_restarted is None:
|
||||
agent_restarted = l2pop_driver.obj.agent_restarted(port_context)
|
||||
if (port['device_owner'] == n_const.DEVICE_OWNER_DVR_INTERFACE and
|
||||
not agent_restarted):
|
||||
return
|
||||
|
@ -13,8 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
|
||||
import mock
|
||||
|
||||
from neutron_lib.agent import topics
|
||||
@ -353,49 +351,36 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||
self.mock_fanout.assert_called_with(
|
||||
mock.ANY, 'remove_fdb_entries', expected)
|
||||
|
||||
def _test_ovs_agent_restarted_with_dvr_port(
|
||||
self, agent_boot_timeout=True, agent_restarted=False):
|
||||
def test_ovs_agent_restarted_with_dvr_port(self):
|
||||
plugin = directory.get_plugin()
|
||||
router = self._create_dvr_router()
|
||||
with mock.patch.object(l2pop_mech_driver.L2populationMechanismDriver,
|
||||
'agent_restarted',
|
||||
return_value=agent_boot_timeout):
|
||||
with self.subnet(network=self._network,
|
||||
enable_dhcp=False) as snet:
|
||||
with self.port(
|
||||
subnet=snet,
|
||||
project_id=self.tenant,
|
||||
device_owner=constants.DEVICE_OWNER_DVR_INTERFACE)\
|
||||
as port:
|
||||
port_id = port['port']['id']
|
||||
plugin.update_distributed_port_binding(self.adminContext,
|
||||
port_id, {'port': {portbindings.HOST_ID: HOST_4,
|
||||
'device_id': router['id']}})
|
||||
port = self._show('ports', port_id,
|
||||
neutron_context=self.adminContext)
|
||||
self.assertEqual(portbindings.VIF_TYPE_DISTRIBUTED,
|
||||
port['port'][portbindings.VIF_TYPE])
|
||||
self.callbacks.update_device_up(
|
||||
self.adminContext,
|
||||
agent_id=HOST_4,
|
||||
device=port_id,
|
||||
host=HOST_4,
|
||||
agent_restarted=agent_restarted)
|
||||
fanout_expected = {port['port']['network_id']: {
|
||||
'network_type': u'vxlan',
|
||||
'ports': {
|
||||
u'20.0.0.4': [('00:00:00:00:00:00', '0.0.0.0')]},
|
||||
'segment_id': 1}}
|
||||
self.mock_fanout.assert_called_with(mock.ANY,
|
||||
'add_fdb_entries',
|
||||
fanout_expected)
|
||||
|
||||
def test_ovs_agent_restarted_with_dvr_port_boot_config_timeout(self):
|
||||
self._test_ovs_agent_restarted_with_dvr_port()
|
||||
|
||||
def test_ovs_agent_restarted_with_dvr_port_rpc_send_timeout(self):
|
||||
self._test_ovs_agent_restarted_with_dvr_port(
|
||||
agent_boot_timeout=False, agent_restarted=True)
|
||||
with self.subnet(network=self._network,
|
||||
enable_dhcp=False) as snet:
|
||||
with self.port(
|
||||
subnet=snet,
|
||||
project_id=self.tenant,
|
||||
device_owner=constants.DEVICE_OWNER_DVR_INTERFACE)\
|
||||
as port:
|
||||
port_id = port['port']['id']
|
||||
plugin.update_distributed_port_binding(self.adminContext,
|
||||
port_id, {'port': {portbindings.HOST_ID: HOST_4,
|
||||
'device_id': router['id']}})
|
||||
port = self._show('ports', port_id,
|
||||
neutron_context=self.adminContext)
|
||||
self.assertEqual(portbindings.VIF_TYPE_DISTRIBUTED,
|
||||
port['port'][portbindings.VIF_TYPE])
|
||||
self.callbacks.update_device_up(self.adminContext,
|
||||
agent_id=HOST_4,
|
||||
device=port_id,
|
||||
host=HOST_4,
|
||||
agent_restarted=True)
|
||||
fanout_expected = {port['port']['network_id']: {
|
||||
'network_type': u'vxlan',
|
||||
'ports': {u'20.0.0.4': [('00:00:00:00:00:00', '0.0.0.0')]},
|
||||
'segment_id': 1}}
|
||||
self.mock_fanout.assert_called_with(mock.ANY,
|
||||
'add_fdb_entries',
|
||||
fanout_expected)
|
||||
|
||||
def test_ha_agents_with_dvr_rtr_does_not_get_other_fdb(self):
|
||||
router = self._create_dvr_router()
|
||||
@ -1526,25 +1511,3 @@ class TestL2PopulationMechDriver(base.BaseTestCase):
|
||||
mech_driver = l2pop_mech_driver.L2populationMechanismDriver()
|
||||
with testtools.ExpectedException(exceptions.InvalidInput):
|
||||
mech_driver.update_port_precommit(ctx)
|
||||
|
||||
def test_agent_restarted(self):
|
||||
mech_driver = l2pop_mech_driver.L2populationMechanismDriver()
|
||||
ctx = mock.Mock()
|
||||
ctx.host = "__host1__"
|
||||
ctx._plugin_context = {}
|
||||
agent = mock.Mock()
|
||||
agent.started_at = datetime.datetime(2018, 5, 25, 15, 51, 20)
|
||||
agent.heartbeat_timestamp = datetime.datetime(2018, 5, 25, 15,
|
||||
51, 50)
|
||||
|
||||
with mock.patch.object(l2pop_db, 'get_agent_by_host',
|
||||
return_value=agent):
|
||||
res = mech_driver.agent_restarted(ctx)
|
||||
self.assertTrue(res)
|
||||
|
||||
agent.heartbeat_timestamp = datetime.datetime(2018, 5, 25, 15,
|
||||
58, 30)
|
||||
with mock.patch.object(l2pop_db, 'get_agent_by_host',
|
||||
return_value=agent):
|
||||
res = mech_driver.agent_restarted(ctx)
|
||||
self.assertFalse(res)
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The deprecated L2 population ``agent_boot_time`` config option was removed and
|
||||
is no longer needed as of the Stein release.
|
Loading…
Reference in New Issue
Block a user