Fix nits in brctl removal (vif_plug_linux_bridge)

This commit fixes the nits caught in:
Id03be72e22302a0954f3e47c116f389cb4304c03

Change-Id: Ib7fcb3c6f809222c33d163fe7a2d854016c7d392
Signed-off-by: Jan Gutter <jan.gutter@netronome.com>
This commit is contained in:
Jan Gutter 2019-02-25 15:57:34 +02:00
parent 871590f626
commit 646839649f
3 changed files with 12 additions and 9 deletions

View File

@ -2,7 +2,7 @@
other:
- |
With this release, packagers of ``os-vif`` no longer need to create a
depency on ``brctl``. ``brctl`` is largely considered obsolete and has
dependency on ``brctl``. ``brctl`` is largely considered obsolete and has
been replaced with iproute2 by default in many linux distributions.
RHEL 8 will not ship ``brctl`` in its default repos. As part of a larger
effort to remove usage of ``brctl`` from OpenStack ``os-vif`` has

View File

@ -102,8 +102,11 @@ def _disable_ipv6(bridge):
privsep context.
:param bridge: string bridge name
"""
disv6 = ('/proc/sys/net/ipv6/conf/%s/disable_ipv6' %
bridge)
# NOTE(sean-k-mooney): os-vif disables ipv6 to ensure the Bridge
# does not aquire an ipv6 auto config or link local adress.
# This is required to prevent bug 1302080.
# https://bugs.launchpad.net/neutron/+bug/1302080
disv6 = ('/proc/sys/net/ipv6/conf/%s/disable_ipv6' % bridge)
if os.path.exists(disv6):
with open(disv6, 'w') as f:
f.write('1')
@ -123,15 +126,16 @@ def _update_bridge_routes(interface, bridge):
# NOTE(danms): We also need to copy routes to the bridge so as
# not to break existing connectivity on the interface
old_routes = []
out, err = processutils.execute('ip', 'route', 'show', 'dev',
interface)
out, _ = processutils.execute('ip', 'route', 'show', 'dev',
interface)
for line in out.split('\n'):
fields = line.split()
if fields and 'via' in fields:
old_routes.append(fields)
processutils.execute('ip', 'route', 'del', *fields)
out, err = processutils.execute('ip', 'addr', 'show', 'dev',
interface, 'scope', 'global')
out, _ = processutils.execute('ip', 'addr', 'show', 'dev',
interface, 'scope', 'global')
for line in out.split('\n'):
fields = line.split()
if fields and fields[0] == 'inet':

View File

@ -120,8 +120,7 @@ class LinuxNetTest(testtools.TestCase):
followed by the bridge. This is required to work around
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1399064
"""
mock_dev_exists.return_value = next(lambda: (yield False),
(yield True))
mock_dev_exists.side_effect = [False, True]
linux_net._ensure_bridge_privileged("fake-bridge", "fake-interface",
None, False, mtu=1500)
calls = [mock.call('fake-interface', 1500),