diff --git a/etc/neutron/rootwrap.d/dhcp.filters b/etc/neutron/rootwrap.d/dhcp.filters index d48d2eac2be..b465fd6375c 100644 --- a/etc/neutron/rootwrap.d/dhcp.filters +++ b/etc/neutron/rootwrap.d/dhcp.filters @@ -17,7 +17,6 @@ kill_dnsmasq: KillFilter, root, /sbin/dnsmasq, -9, -HUP, -15 kill_dnsmasq_usr: KillFilter, root, /usr/sbin/dnsmasq, -9, -HUP, -15 ovs-vsctl: CommandFilter, ovs-vsctl, root -ivs-ctl: CommandFilter, ivs-ctl, root mm-ctl: CommandFilter, mm-ctl, root dhcp_release: CommandFilter, dhcp_release, root dhcp_release6: CommandFilter, dhcp_release6, root diff --git a/neutron/agent/linux/interface.py b/neutron/agent/linux/interface.py index 0f38082a3e1..a6b0a0b7854 100644 --- a/neutron/agent/linux/interface.py +++ b/neutron/agent/linux/interface.py @@ -19,12 +19,10 @@ import time import netaddr from neutron_lib import constants from oslo_log import log as logging -from oslo_log import versionutils import six from neutron.agent.common import ovs_lib from neutron.agent.linux import ip_lib -from neutron.agent.linux import utils from neutron.common import constants as n_const from neutron.common import exceptions @@ -410,68 +408,6 @@ class OVSInterfaceDriver(LinuxInterfaceDriver): ns_dev.link.set_mtu(mtu) -class IVSInterfaceDriver(LinuxInterfaceDriver): - """Driver for creating an internal interface on an IVS bridge.""" - - DEV_NAME_PREFIX = constants.TAP_DEVICE_PREFIX - - def __init__(self, conf): - super(IVSInterfaceDriver, self).__init__(conf) - versionutils.report_deprecated_feature( - LOG, "IVS interface driver is deprecated in Queens and will be " - "removed in Rocky.") - self.DEV_NAME_PREFIX = 'ns-' - - def _get_tap_name(self, dev_name, prefix=None): - dev_name = dev_name.replace(prefix or self.DEV_NAME_PREFIX, - constants.TAP_DEVICE_PREFIX) - return dev_name - - def _ivs_add_port(self, device_name, port_id, mac_address): - cmd = ['ivs-ctl', 'add-port', device_name] - utils.execute(cmd, run_as_root=True) - - def plug_new(self, network_id, port_id, device_name, mac_address, - bridge=None, namespace=None, prefix=None, mtu=None): - """Plug in the interface.""" - ip = ip_lib.IPWrapper() - tap_name = self._get_tap_name(device_name, prefix) - - root_dev, ns_dev = ip.add_veth(tap_name, device_name) - root_dev.disable_ipv6() - - self._ivs_add_port(tap_name, port_id, mac_address) - - ns_dev = ip.device(device_name) - ns_dev.link.set_address(mac_address) - - if mtu: - ns_dev.link.set_mtu(mtu) - root_dev.link.set_mtu(mtu) - else: - LOG.warning("No MTU configured for port %s", port_id) - - if namespace: - namespace_obj = ip.ensure_namespace(namespace) - namespace_obj.add_device_to_namespace(ns_dev) - - ns_dev.link.set_up() - root_dev.link.set_up() - - def unplug(self, device_name, bridge=None, namespace=None, prefix=None): - """Unplug the interface.""" - tap_name = self._get_tap_name(device_name, prefix) - try: - cmd = ['ivs-ctl', 'del-port', tap_name] - utils.execute(cmd, run_as_root=True) - device = ip_lib.IPDevice(device_name, namespace=namespace) - device.link.delete() - LOG.debug("Unplugged interface '%s'", device_name) - except RuntimeError: - LOG.error("Failed unplugging interface '%s'", - device_name) - - class BridgeInterfaceDriver(LinuxInterfaceDriver): """Driver for creating bridge interfaces.""" diff --git a/neutron/tests/unit/agent/common/test_utils.py b/neutron/tests/unit/agent/common/test_utils.py index f372e7a68a7..889bc4b7c79 100644 --- a/neutron/tests/unit/agent/common/test_utils.py +++ b/neutron/tests/unit/agent/common/test_utils.py @@ -59,12 +59,6 @@ class TestLoadInterfaceDriver(base.BaseTestCase): self.assertIsInstance(utils.load_interface_driver(self.conf), interface.NullDriver) - def test_load_ivs_interface_driver_success(self): - self.conf.set_override('interface_driver', - 'ivs') - self.assertIsInstance(utils.load_interface_driver(self.conf), - interface.IVSInterfaceDriver) - def test_load_linuxbridge_interface_driver_success(self): self.conf.set_override('interface_driver', 'linuxbridge') diff --git a/neutron/tests/unit/agent/linux/test_interface.py b/neutron/tests/unit/agent/linux/test_interface.py index bc19db9174d..95bff8da863 100644 --- a/neutron/tests/unit/agent/linux/test_interface.py +++ b/neutron/tests/unit/agent/linux/test_interface.py @@ -19,7 +19,6 @@ from neutron_lib import constants from neutron.agent.common import ovs_lib from neutron.agent.linux import interface from neutron.agent.linux import ip_lib -from neutron.agent.linux import utils from neutron.conf.agent import common as config from neutron.tests import base @@ -620,71 +619,3 @@ class TestBridgeInterfaceDriver(TestBase): self.ip_dev.assert_has_calls([mock.call('tap0', namespace=None), mock.call().link.delete()]) - - -class TestIVSInterfaceDriver(TestBase): - - def test_get_device_name(self): - br = interface.IVSInterfaceDriver(self.conf) - device_name = br.get_device_name(FakePort()) - self.assertEqual('ns-abcdef01-12', device_name) - - def test_plug_with_prefix(self): - self._test_plug(devname='qr-0', prefix='qr-') - - def _test_plug(self, devname=None, namespace=None, prefix=None): - - if not devname: - devname = 'ns-0' - - def device_exists(dev, namespace=None): - return dev == 'indigo' - - ivs = interface.IVSInterfaceDriver(self.conf) - self.device_exists.side_effect = device_exists - - root_dev = mock.Mock() - _ns_dev = mock.Mock() - ns_dev = mock.Mock() - self.ip().add_veth = mock.Mock(return_value=(root_dev, _ns_dev)) - self.ip().device = mock.Mock(return_value=(ns_dev)) - expected = [mock.call(), mock.call().add_veth('tap0', devname), - mock.call().device(devname)] - - ivsctl_cmd = ['ivs-ctl', 'add-port', 'tap0'] - - with mock.patch.object(utils, 'execute') as execute: - ivs.plug('01234567-1234-1234-99', - 'port-1234', - devname, - 'aa:bb:cc:dd:ee:ff', - namespace=namespace, - prefix=prefix, - mtu=9000) - execute.assert_called_once_with(ivsctl_cmd, run_as_root=True) - - ns_dev.assert_has_calls( - [mock.call.link.set_address('aa:bb:cc:dd:ee:ff')]) - ns_dev.assert_has_calls([mock.call.link.set_mtu(9000)]) - root_dev.assert_has_calls([mock.call.link.set_mtu(9000)]) - if namespace: - expected.extend( - [mock.call().ensure_namespace(namespace), - mock.call().ensure_namespace().add_device_to_namespace( - mock.ANY)]) - - self.ip.assert_has_calls(expected) - root_dev.assert_has_calls([mock.call.link.set_up()]) - ns_dev.assert_has_calls([mock.call.link.set_up()]) - - def test_plug_namespace(self): - self._test_plug(namespace='mynamespace') - - def test_unplug(self): - ivs = interface.IVSInterfaceDriver(self.conf) - ivsctl_cmd = ['ivs-ctl', 'del-port', 'tap0'] - with mock.patch.object(utils, 'execute') as execute: - ivs.unplug('ns-0') - execute.assert_called_once_with(ivsctl_cmd, run_as_root=True) - self.ip_dev.assert_has_calls([mock.call('ns-0', namespace=None), - mock.call().link.delete()]) diff --git a/releasenotes/notes/ivs-interfacedriver-removal-a9cce87310028b99.yaml b/releasenotes/notes/ivs-interfacedriver-removal-a9cce87310028b99.yaml new file mode 100644 index 00000000000..8e6f1772ce6 --- /dev/null +++ b/releasenotes/notes/ivs-interfacedriver-removal-a9cce87310028b99.yaml @@ -0,0 +1,7 @@ +--- +other: + - The deprecated ``IVSInterfaceDriver`` class has been removed from + the code base. This means neither the ``ivs`` nor the + ``neutron.agent.linux.interface.IVSInterfaceDriver`` can any longer + be used as a value for the ``interface_driver`` config option in + ``neutron.conf``. diff --git a/setup.cfg b/setup.cfg index 9b45661deed..f80d0aea982 100644 --- a/setup.cfg +++ b/setup.cfg @@ -140,7 +140,6 @@ oslo.config.opts.defaults = neutron.db.alembic_migrations = neutron = neutron.db.migration:alembic_migrations neutron.interface_drivers = - ivs = neutron.agent.linux.interface:IVSInterfaceDriver linuxbridge = neutron.agent.linux.interface:BridgeInterfaceDriver null = neutron.agent.linux.interface:NullDriver openvswitch = neutron.agent.linux.interface:OVSInterfaceDriver