Browse Source

Merge "Deprecate config option "ovs_integration_bridge""

changes/87/705587/5
Zuul 3 years ago committed by Gerrit Code Review
parent
commit
e9acdb06fa
  1. 2
      neutron/agent/dhcp_agent.py
  2. 2
      neutron/agent/l3_agent.py
  3. 4
      neutron/agent/linux/interface.py
  4. 4
      neutron/cmd/ovs_cleanup.py
  5. 3
      neutron/conf/agent/common.py
  6. 5
      neutron/conf/plugins/ml2/drivers/ovs_conf.py
  7. 8
      neutron/tests/fullstack/resources/config.py
  8. 1
      neutron/tests/functional/agent/l2/base.py
  9. 16
      neutron/tests/functional/agent/l3/framework.py
  10. 6
      neutron/tests/functional/agent/l3/test_dvr_router.py
  11. 4
      neutron/tests/functional/agent/l3/test_ha_router.py
  12. 8
      neutron/tests/functional/agent/l3/test_legacy_router.py
  13. 2
      neutron/tests/functional/agent/l3/test_metadata_proxy.py
  14. 4
      neutron/tests/functional/agent/linux/test_dhcp.py
  15. 4
      neutron/tests/functional/agent/test_dhcp_agent.py
  16. 2
      neutron/tests/functional/cmd/test_ovs_cleanup.py
  17. 6
      neutron/tests/unit/agent/linux/test_interface.py
  18. 6
      releasenotes/notes/deprecate-ovs_integration_bridge-d4d1521c35f999bd.yaml

2
neutron/agent/dhcp_agent.py

@ -24,6 +24,7 @@ from neutron.common import config as common_config
from neutron.conf.agent import common as config
from neutron.conf.agent import dhcp as dhcp_config
from neutron.conf.agent.metadata import config as meta_conf
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron import service as neutron_service
@ -35,6 +36,7 @@ def register_options(conf):
meta_conf.register_meta_conf_opts(meta_conf.SHARED_OPTS, conf)
config.register_interface_opts(conf)
config.register_root_helper(conf)
ovs_conf.register_ovs_opts(conf)
def main():

2
neutron/agent/l3_agent.py

@ -25,6 +25,7 @@ from neutron.conf.agent import common as config
from neutron.conf.agent.l3 import config as l3_config
from neutron.conf.agent.l3 import ha as ha_conf
from neutron.conf.agent.metadata import config as meta_conf
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron import service as neutron_service
@ -39,6 +40,7 @@ def register_opts(conf):
config.register_pddriver_opts(conf)
config.register_ra_opts(conf)
config.register_availability_zone_opts_helper(conf)
ovs_conf.register_ovs_opts(conf)
def main(manager='neutron.agent.l3.agent.L3NATAgentWithStateReport'):

4
neutron/agent/linux/interface.py

@ -341,7 +341,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
bridge=None, namespace=None, prefix=None, mtu=None):
"""Plug in the interface."""
if not bridge:
bridge = self.conf.ovs_integration_bridge
bridge = self.conf.OVS.integration_bridge
self.check_bridge_exists(bridge)
@ -407,7 +407,7 @@ class OVSInterfaceDriver(LinuxInterfaceDriver):
def unplug(self, device_name, bridge=None, namespace=None, prefix=None):
"""Unplug the interface."""
if not bridge:
bridge = self.conf.ovs_integration_bridge
bridge = self.conf.OVS.integration_bridge
tap_name = self._get_tap_name(device_name, prefix)
self.check_bridge_exists(bridge)

4
neutron/cmd/ovs_cleanup.py

@ -21,6 +21,7 @@ from neutron.common import config
from neutron.conf.agent import cmd
from neutron.conf.agent import common as agent_config
from neutron.conf.agent.l3 import config as l3_config
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron.conf import service as service_config
LOG = logging.getLogger(__name__)
@ -43,6 +44,7 @@ def setup_conf():
agent_config.register_interface_driver_opts_helper(conf)
agent_config.register_interface_opts()
service_config.register_service_opts(service_config.RPC_EXTRA_OPTS, conf)
ovs_conf.register_ovs_agent_opts(conf)
conf.set_default("ovsdb_timeout", CLEANUP_OVSDB_TIMEOUT, "OVS")
return conf
@ -60,7 +62,7 @@ def main():
def do_main(conf):
configuration_bridges = set([conf.ovs_integration_bridge])
configuration_bridges = set([conf.OVS.integration_bridge])
ovs = ovs_lib.BaseOVS()
ovs_bridges = set(ovs.get_bridges())
available_configuration_bridges = configuration_bridges & ovs_bridges

3
neutron/conf/agent/common.py

@ -51,6 +51,9 @@ PD_DRIVER_OPTS = [
INTERFACE_OPTS = [
cfg.StrOpt('ovs_integration_bridge',
default='br-int',
deprecated_for_removal=True,
deprecated_reason='This variable is a duplicate of '
'OVS.integration_bridge. To be removed in W.',
help=_('Name of Open vSwitch bridge to use')),
cfg.BoolOpt('ovs_use_veth',
default=False,

5
neutron/conf/plugins/ml2/drivers/ovs_conf.py

@ -25,6 +25,7 @@ DEFAULT_TUNNEL_TYPES = []
ovs_opts = [
cfg.StrOpt('integration_bridge', default='br-int',
deprecated_name='ovs_integration_bridge',
help=_("Integration bridge to use. "
"Do not change this parameter unless you have a good "
"reason to. This is the name of the OVS integration "
@ -182,3 +183,7 @@ agent_opts = [
def register_ovs_agent_opts(cfg=cfg.CONF):
cfg.register_opts(ovs_opts, "OVS")
cfg.register_opts(agent_opts, "AGENT")
def register_ovs_opts(cfg=cfg.CONF):
cfg.register_opts(ovs_opts, "OVS")

8
neutron/tests/fullstack/resources/config.py

@ -406,7 +406,9 @@ class L3ConfigFixture(ConfigFixture):
'DEFAULT': {
'interface_driver': ('neutron.agent.linux.interface.'
'OVSInterfaceDriver'),
'ovs_integration_bridge': integration_bridge,
},
'OVS': {
'integration_bridge': integration_bridge,
}
})
@ -450,7 +452,9 @@ class DhcpConfigFixture(ConfigFixture):
self.config.update({
'DEFAULT': {
'interface_driver': 'openvswitch',
'ovs_integration_bridge': integration_bridge,
},
'OVS': {
'integration_bridge': integration_bridge,
}
})

1
neutron/tests/functional/agent/l2/base.py

@ -148,7 +148,6 @@ class OVSAgentTestFramework(base.BaseOVSLinuxTestCase, OVSOFControllerHelper):
'interface_driver',
'neutron.agent.linux.interface.OVSInterfaceDriver')
config.set_override('integration_bridge', self.br_int, "OVS")
config.set_override('ovs_integration_bridge', self.br_int)
config.set_override('tunnel_bridge', self.br_tun, "OVS")
config.set_override('int_peer_patch_port', self.patch_tun, "OVS")
config.set_override('tun_peer_patch_port', self.patch_int, "OVS")

16
neutron/tests/functional/agent/l3/framework.py

@ -80,7 +80,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
conf.set_override('interface_driver', self.INTERFACE_DRIVER)
br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
conf.set_override('ovs_integration_bridge', br_int.br_name)
conf.set_override('integration_bridge', br_int.br_name, 'OVS')
temp_dir = self.get_new_temp_dir()
get_temp_file_path = functools.partial(self.get_temp_file_path,
@ -100,7 +100,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
return conf
def _get_agent_ovs_integration_bridge(self, agent):
return get_ovs_bridge(agent.conf.ovs_integration_bridge)
return get_ovs_bridge(agent.conf.OVS.integration_bridge)
def generate_router_info(self, enable_ha,
ip_version=constants.IP_VERSION_4,
@ -364,7 +364,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
def new_ovs_plug(self, *args, **kwargs):
original_plug_new(self, *args, **kwargs)
bridge = (kwargs.get('bridge') or args[4] or
self.conf.ovs_integration_bridge)
self.conf.OVS.integration_bridge)
device_name = kwargs.get('device_name') or args[2]
ovsbr = ovs_lib.OVSBridge(bridge)
ovsbr.clear_db_attribute('Port', device_name, 'tag')
@ -565,7 +565,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
self.assertIn(extra_subnet, routes)
def _assert_interfaces_deleted_from_ovs(self):
bridge = ovs_lib.OVSBridge(self.agent.conf.ovs_integration_bridge)
bridge = ovs_lib.OVSBridge(self.agent.conf.OVS.integration_bridge)
self.assertFalse(bridge.get_port_name_list())
def floating_ips_configured(self, router):
@ -612,7 +612,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
router1 = self._create_router(router_info, self.agent)
self._add_fip(router1, '192.168.111.12')
r1_br = ip_lib.IPDevice(router1.driver.conf.ovs_integration_bridge)
r1_br = ip_lib.IPDevice(router1.driver.conf.OVS.integration_bridge)
r1_br.addr.add('19.4.4.1/24')
r1_br.link.set_up()
@ -622,7 +622,7 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
mac='22:22:22:22:22:22'))
router2 = self._create_router(router_info_2, self.failover_agent)
r2_br = ip_lib.IPDevice(router2.driver.conf.ovs_integration_bridge)
r2_br = ip_lib.IPDevice(router2.driver.conf.OVS.integration_bridge)
r2_br.addr.add('19.4.4.1/24')
r2_br.link.set_up()
@ -664,12 +664,12 @@ class L3AgentTestFramework(base.BaseSudoTestCase):
@staticmethod
def fail_gw_router_port(router):
r_br = ip_lib.IPDevice(router.driver.conf.ovs_integration_bridge)
r_br = ip_lib.IPDevice(router.driver.conf.OVS.integration_bridge)
r_br.link.set_down()
@staticmethod
def restore_gw_router_port(router):
r_br = ip_lib.IPDevice(router.driver.conf.ovs_integration_bridge)
r_br = ip_lib.IPDevice(router.driver.conf.OVS.integration_bridge)
r_br.link.set_up()
@classmethod

6
neutron/tests/functional/agent/l3/test_dvr_router.py

@ -2013,7 +2013,7 @@ class TestDvrRouter(DvrRouterTestFramework, framework.L3AgentTestFramework):
router_ip2 = router_ip_cidr2.partition('/')[0]
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
test_machine1 = self.useFixture(
machine_fixtures.FakeMachine(
br_int,
@ -2065,7 +2065,7 @@ class TestDvrRouter(DvrRouterTestFramework, framework.L3AgentTestFramework):
router.process()
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24'))
# Floating ip should work no matter of address scope
@ -2080,7 +2080,7 @@ class TestDvrRouter(DvrRouterTestFramework, framework.L3AgentTestFramework):
gw_port = router.get_ex_gw_port()
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24', gw_ip))

4
neutron/tests/functional/agent/l3/test_ha_router.py

@ -410,7 +410,7 @@ class L3HATestFailover(framework.L3AgentTestFramework):
# enough because same IP address is also configured on
# ovs_integration_bridge device from second router and it will still
# respond to ping
r_br = ovs_lib.OVSBridge(router.driver.conf.ovs_integration_bridge)
r_br = ovs_lib.OVSBridge(router.driver.conf.OVS.integration_bridge)
external_port = router.get_ex_gw_port()
for subnet in external_port['subnets']:
r_br.add_flow(
@ -418,7 +418,7 @@ class L3HATestFailover(framework.L3AgentTestFramework):
@staticmethod
def restore_gw_router_port(router):
r_br = ovs_lib.OVSBridge(router.driver.conf.ovs_integration_bridge)
r_br = ovs_lib.OVSBridge(router.driver.conf.OVS.integration_bridge)
external_port = router.get_ex_gw_port()
for subnet in external_port['subnets']:
r_br.delete_flows(proto='ip', nw_dst=subnet['gateway_ip'])

8
neutron/tests/functional/agent/l3/test_legacy_router.py

@ -280,7 +280,7 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
router_ip = router_ip_cidr.partition('/')[0]
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
src_machine, dst_machine = self.useFixture(
machine_fixtures.PeerMachines(
@ -346,7 +346,7 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
router_ip2 = router_ip_cidr2.partition('/')[0]
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
test_machine1 = self.useFixture(
machine_fixtures.FakeMachine(
br_int,
@ -392,7 +392,7 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
router.process()
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24'))
# Floating ip should work no matter of address scope
@ -406,7 +406,7 @@ class L3AgentTestCase(framework.L3AgentTestFramework):
gw_port = router.get_ex_gw_port()
gw_ip = self._port_first_ip_cidr(gw_port).partition('/')[0]
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
src_machine = self.useFixture(
machine_fixtures.FakeMachine(br_int, '19.4.4.12/24', gw_ip))

2
neutron/tests/functional/agent/l3/test_metadata_proxy.py

@ -103,7 +103,7 @@ class MetadataL3AgentTestCase(framework.L3AgentTestFramework):
# Create and configure client namespace
router_ip_cidr = self._port_first_ip_cidr(router.internal_ports[0])
br_int = framework.get_ovs_bridge(
self.agent.conf.ovs_integration_bridge)
self.agent.conf.OVS.integration_bridge)
machine = self.useFixture(
machine_fixtures.FakeMachine(

4
neutron/tests/functional/agent/linux/test_dhcp.py

@ -22,6 +22,7 @@ from neutron.common import utils as common_utils
from neutron.conf.agent import common as config
from neutron.conf.agent import dhcp as dhcp_conf
from neutron.conf import common as common_conf
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron.tests import base as tests_base
from neutron.tests.common import net_helpers
from neutron.tests.functional import base as functional_base
@ -35,11 +36,12 @@ class TestDhcp(functional_base.BaseSudoTestCase):
config.register_interface_opts(conf)
conf.register_opts(common_conf.core_opts)
conf.register_opts(dhcp_conf.DHCP_AGENT_OPTS)
ovs_conf.register_ovs_opts(conf)
conf.set_override('interface_driver', 'openvswitch')
conf.set_override('host', 'foo-host')
self.conf = conf
br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
self.conf.set_override('ovs_integration_bridge', br_int.br_name)
self.conf.set_override('integration_bridge', br_int.br_name, 'OVS')
def test_cleanup_stale_devices(self):
plugin = mock.MagicMock()

4
neutron/tests/functional/agent/test_dhcp_agent.py

@ -74,7 +74,7 @@ class DHCPAgentOVSTestFramework(base.BaseSudoTestCase):
'neutron.agent.linux.interface.OVSInterfaceDriver')
self.conf.set_override('report_interval', 0, 'AGENT')
br_int = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
self.conf.set_override('ovs_integration_bridge', br_int.br_name)
self.conf.set_override('integration_bridge', br_int.br_name, 'OVS')
self.mock_plugin_api = mock.patch(
'neutron.agent.dhcp.agent.DhcpPluginApi').start().return_value
@ -193,7 +193,7 @@ class DHCPAgentOVSTestFramework(base.BaseSudoTestCase):
vif_name = self.get_interface_name(network.id, port)
self.ovs_driver.plug(network.id, port.id, vif_name, port.mac_address,
self.conf['ovs_integration_bridge'],
self.conf.OVS.integration_bridge,
namespace=namespace)
def _ip_list_for_vif(self, vif_name, namespace):

2
neutron/tests/functional/cmd/test_ovs_cleanup.py

@ -34,7 +34,7 @@ class TestOVSCLIConfig(base.BaseOVSLinuxTestCase):
def test_do_main_default_options(self):
int_br = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
self.conf.set_override("ovs_integration_bridge", int_br.br_name)
self.conf.set_override("integration_bridge", int_br.br_name, 'OVS')
self.conf.set_override("ovs_all_ports", False)
noskip = collections.defaultdict(list)

6
neutron/tests/unit/agent/linux/test_interface.py

@ -23,6 +23,7 @@ from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.common import utils
from neutron.conf.agent import common as config
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron.tests import base
@ -60,6 +61,7 @@ class TestBase(base.BaseTestCase):
def setUp(self):
super(TestBase, self).setUp()
self.conf = config.setup_conf()
ovs_conf.register_ovs_opts(self.conf)
config.register_interface_opts(self.conf)
self.ip_dev_p = mock.patch.object(ip_lib, 'IPDevice')
self.ip_dev = self.ip_dev_p.start()
@ -395,8 +397,8 @@ class TestOVSInterfaceDriver(TestBase):
def test_plug_configured_bridge(self):
br = 'br-v'
self.conf.set_override('ovs_use_veth', False)
self.conf.set_override('ovs_integration_bridge', br)
self.assertEqual(self.conf.ovs_integration_bridge, br)
self.conf.set_override('integration_bridge', br, 'OVS')
self.assertEqual(self.conf.OVS.integration_bridge, br)
def device_exists(dev, namespace=None):
return dev == br

6
releasenotes/notes/deprecate-ovs_integration_bridge-d4d1521c35f999bd.yaml

@ -0,0 +1,6 @@
---
deprecations:
- Deprecate ``ovs_integration_bridge``. This configuration option is a
duplicate of ``OVS:integration_bridge``. Currently both options must be the
same to avoid configuration clashes. Previously used in the DHCP agent.
It will be removed in next releases.
Loading…
Cancel
Save