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.config
|
||||||
import neutron.conf.plugins.ml2.drivers.agent
|
import neutron.conf.plugins.ml2.drivers.agent
|
||||||
import neutron.conf.plugins.ml2.drivers.driver_type
|
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.linuxbridge
|
||||||
import neutron.conf.plugins.ml2.drivers.macvtap
|
import neutron.conf.plugins.ml2.drivers.macvtap
|
||||||
import neutron.conf.plugins.ml2.drivers.mech_sriov.agent_common
|
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),
|
neutron.conf.plugins.ml2.drivers.driver_type.geneve_opts),
|
||||||
('securitygroup',
|
('securitygroup',
|
||||||
neutron.conf.agent.securitygroups_rpc.security_group_opts),
|
neutron.conf.agent.securitygroups_rpc.security_group_opts),
|
||||||
('l2pop',
|
|
||||||
neutron.conf.plugins.ml2.drivers.l2pop.l2_population_options),
|
|
||||||
('ovs_driver',
|
('ovs_driver',
|
||||||
neutron.conf.plugins.ml2.drivers.openvswitch.mech_ovs_conf.
|
neutron.conf.plugins.ml2.drivers.openvswitch.mech_ovs_conf.
|
||||||
ovs_driver_opts),
|
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 constants as plugin_constants
|
||||||
from neutron_lib.plugins import directory
|
from neutron_lib.plugins import directory
|
||||||
from neutron_lib.plugins.ml2 import api
|
from neutron_lib.plugins.ml2 import api
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from neutron._i18n import _
|
from neutron._i18n import _
|
||||||
from neutron.conf.plugins.ml2.drivers import l2pop as config
|
|
||||||
from neutron.db import l3_hamode_db
|
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 db as l2pop_db
|
||||||
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
config.register_l2_population_opts()
|
|
||||||
|
|
||||||
|
|
||||||
class L2populationMechanismDriver(api.MechanismDriver):
|
class L2populationMechanismDriver(api.MechanismDriver):
|
||||||
|
|
||||||
@ -253,19 +249,6 @@ class L2populationMechanismDriver(api.MechanismDriver):
|
|||||||
|
|
||||||
return agents
|
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):
|
def update_port_down(self, context):
|
||||||
port = context.current
|
port = context.current
|
||||||
agent_host = context.host
|
agent_host = context.host
|
||||||
@ -287,7 +270,7 @@ class L2populationMechanismDriver(api.MechanismDriver):
|
|||||||
self.L2populationAgentNotify.remove_fdb_entries(
|
self.L2populationAgentNotify.remove_fdb_entries(
|
||||||
self.rpc_ctx, 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
|
port = context.current
|
||||||
agent_host = context.host
|
agent_host = context.host
|
||||||
port_context = context._plugin_context
|
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
|
# 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
|
# 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)
|
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:
|
if is_first_port or agent_restarted:
|
||||||
# First port(s) activated on current agent in this network,
|
# First port(s) activated on current agent in this network,
|
||||||
# we have to provide it with the whole list of fdb entries
|
# 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):
|
def update_device_up(self, rpc_context, **kwargs):
|
||||||
"""Device is up on agent."""
|
"""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)
|
agent_id, host, device = self._get_request_details(kwargs)
|
||||||
LOG.debug("Device %(device)s up at agent %(agent_id)s",
|
LOG.debug("Device %(device)s up at agent %(agent_id)s",
|
||||||
{'device': device, 'agent_id': agent_id})
|
{'device': device, 'agent_id': agent_id})
|
||||||
@ -316,7 +316,7 @@ class RpcCallbacks(type_tunnel.TunnelRpcCallbackMixin):
|
|||||||
provisioning_blocks.L2_AGENT_ENTITY)
|
provisioning_blocks.L2_AGENT_ENTITY)
|
||||||
|
|
||||||
def notify_l2pop_port_wiring(self, port_id, rpc_context,
|
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.
|
"""Notify the L2pop driver that a port has been wired/unwired.
|
||||||
|
|
||||||
The L2pop driver uses this notification to broadcast forwarding
|
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
|
# 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
|
# handle DVR ports while restart neutron-*-agent, we need to handle
|
||||||
# it here.
|
# 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
|
if (port['device_owner'] == n_const.DEVICE_OWNER_DVR_INTERFACE and
|
||||||
not agent_restarted):
|
not agent_restarted):
|
||||||
return
|
return
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import datetime
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron_lib.agent import topics
|
from neutron_lib.agent import topics
|
||||||
@ -353,49 +351,36 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
|
|||||||
self.mock_fanout.assert_called_with(
|
self.mock_fanout.assert_called_with(
|
||||||
mock.ANY, 'remove_fdb_entries', expected)
|
mock.ANY, 'remove_fdb_entries', expected)
|
||||||
|
|
||||||
def _test_ovs_agent_restarted_with_dvr_port(
|
def test_ovs_agent_restarted_with_dvr_port(self):
|
||||||
self, agent_boot_timeout=True, agent_restarted=False):
|
|
||||||
plugin = directory.get_plugin()
|
plugin = directory.get_plugin()
|
||||||
router = self._create_dvr_router()
|
router = self._create_dvr_router()
|
||||||
with mock.patch.object(l2pop_mech_driver.L2populationMechanismDriver,
|
with self.subnet(network=self._network,
|
||||||
'agent_restarted',
|
enable_dhcp=False) as snet:
|
||||||
return_value=agent_boot_timeout):
|
with self.port(
|
||||||
with self.subnet(network=self._network,
|
subnet=snet,
|
||||||
enable_dhcp=False) as snet:
|
project_id=self.tenant,
|
||||||
with self.port(
|
device_owner=constants.DEVICE_OWNER_DVR_INTERFACE)\
|
||||||
subnet=snet,
|
as port:
|
||||||
project_id=self.tenant,
|
port_id = port['port']['id']
|
||||||
device_owner=constants.DEVICE_OWNER_DVR_INTERFACE)\
|
plugin.update_distributed_port_binding(self.adminContext,
|
||||||
as port:
|
port_id, {'port': {portbindings.HOST_ID: HOST_4,
|
||||||
port_id = port['port']['id']
|
'device_id': router['id']}})
|
||||||
plugin.update_distributed_port_binding(self.adminContext,
|
port = self._show('ports', port_id,
|
||||||
port_id, {'port': {portbindings.HOST_ID: HOST_4,
|
neutron_context=self.adminContext)
|
||||||
'device_id': router['id']}})
|
self.assertEqual(portbindings.VIF_TYPE_DISTRIBUTED,
|
||||||
port = self._show('ports', port_id,
|
port['port'][portbindings.VIF_TYPE])
|
||||||
neutron_context=self.adminContext)
|
self.callbacks.update_device_up(self.adminContext,
|
||||||
self.assertEqual(portbindings.VIF_TYPE_DISTRIBUTED,
|
agent_id=HOST_4,
|
||||||
port['port'][portbindings.VIF_TYPE])
|
device=port_id,
|
||||||
self.callbacks.update_device_up(
|
host=HOST_4,
|
||||||
self.adminContext,
|
agent_restarted=True)
|
||||||
agent_id=HOST_4,
|
fanout_expected = {port['port']['network_id']: {
|
||||||
device=port_id,
|
'network_type': u'vxlan',
|
||||||
host=HOST_4,
|
'ports': {u'20.0.0.4': [('00:00:00:00:00:00', '0.0.0.0')]},
|
||||||
agent_restarted=agent_restarted)
|
'segment_id': 1}}
|
||||||
fanout_expected = {port['port']['network_id']: {
|
self.mock_fanout.assert_called_with(mock.ANY,
|
||||||
'network_type': u'vxlan',
|
'add_fdb_entries',
|
||||||
'ports': {
|
fanout_expected)
|
||||||
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)
|
|
||||||
|
|
||||||
def test_ha_agents_with_dvr_rtr_does_not_get_other_fdb(self):
|
def test_ha_agents_with_dvr_rtr_does_not_get_other_fdb(self):
|
||||||
router = self._create_dvr_router()
|
router = self._create_dvr_router()
|
||||||
@ -1526,25 +1511,3 @@ class TestL2PopulationMechDriver(base.BaseTestCase):
|
|||||||
mech_driver = l2pop_mech_driver.L2populationMechanismDriver()
|
mech_driver = l2pop_mech_driver.L2populationMechanismDriver()
|
||||||
with testtools.ExpectedException(exceptions.InvalidInput):
|
with testtools.ExpectedException(exceptions.InvalidInput):
|
||||||
mech_driver.update_port_precommit(ctx)
|
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…
x
Reference in New Issue
Block a user