Stop handling interface drivers that don't support MTU

We were issuing a deprecation warning for interface drivers that have
not accepted mtu= argument for a cycle. It's time to clean that code
path up.

NeutronLibImpact

Change-Id: I47eca98c25d4f5a30a5a726d5edc1a919954a280
This commit is contained in:
Ihar Hrachyshka 2017-02-11 12:42:59 +00:00
parent 715e9c81fc
commit 37a1b4a46f
2 changed files with 2 additions and 42 deletions

View File

@ -20,7 +20,6 @@ import netaddr
from neutron_lib import constants
from oslo_config import cfg
from oslo_log import log as logging
from oslo_log import versionutils
import six
from neutron._i18n import _, _LE, _LI, _LW
@ -256,16 +255,8 @@ class LinuxInterfaceDriver(object):
bridge=None, namespace=None, prefix=None, mtu=None):
if not ip_lib.device_exists(device_name,
namespace=namespace):
try:
self.plug_new(network_id, port_id, device_name, mac_address,
bridge, namespace, prefix, mtu)
except TypeError:
versionutils.report_deprecated_feature(
LOG,
_LW('Interface driver does not support MTU parameter. '
'This may not work in future releases.'))
self.plug_new(network_id, port_id, device_name, mac_address,
bridge, namespace, prefix)
self.plug_new(network_id, port_id, device_name, mac_address,
bridge, namespace, prefix, mtu)
else:
LOG.info(_LI("Device %s already exists"), device_name)
if mtu:

View File

@ -15,7 +15,6 @@
import mock
from neutron_lib import constants
from oslo_log import versionutils
from neutron.agent.common import config
from neutron.agent.common import ovs_lib
@ -55,23 +54,6 @@ class FakePort(object):
network_id = network.id
class FakeInterfaceDriverNoMtu(interface.LinuxInterfaceDriver):
# NOTE(ihrachys) this method intentially omit mtu= parameter, since that
# was the method signature before Mitaka. We should make sure the old
# signature still works.
def __init__(self, *args, **kwargs):
super(FakeInterfaceDriverNoMtu, self).__init__(*args, **kwargs)
self.plug_called = False
def plug_new(self, network_id, port_id, device_name, mac_address,
bridge=None, namespace=None, prefix=None):
self.plug_called = True
def unplug(self, device_name, bridge=None, namespace=None, prefix=None):
pass
class TestBase(base.BaseTestCase):
def setUp(self):
super(TestBase, self).setUp()
@ -85,19 +67,6 @@ class TestBase(base.BaseTestCase):
self.device_exists = self.device_exists_p.start()
class TestABCDriverNoMtu(TestBase):
def test_plug_with_no_mtu_works(self):
driver = FakeInterfaceDriverNoMtu(self.conf)
self.device_exists.return_value = False
with mock.patch.object(
versionutils, 'report_deprecated_feature') as report:
driver.plug(
mock.Mock(), mock.Mock(), mock.Mock(), mock.Mock(), mtu=9000)
self.assertTrue(driver.plug_called)
self.assertTrue(report.called)
class TestABCDriver(TestBase):
def setUp(self):
super(TestABCDriver, self).setUp()