Merge "create_veth_pair is unused, remove it."

This commit is contained in:
Zuul 2019-02-18 17:28:48 +00:00 committed by Gerrit Code Review
commit d2a87a4446
2 changed files with 0 additions and 38 deletions

View File

@ -115,23 +115,3 @@ def bind_ip(device, ip, scope_is_link=False):
processutils.execute('ip', 'addr', 'add', str(ip) + '/32',
'scope', 'link', 'dev', device,
check_exit_code=[0, 2, 254])
@nova.privsep.sys_admin_pctxt.entrypoint
def create_veth_pair(dev1_name, dev2_name, mtu=None):
"""Create a pair of veth devices with the specified names,
deleting any previous devices with those names.
"""
_create_veth_pair_inner(dev1_name, dev2_name, mtu=mtu)
def _create_veth_pair_inner(dev1_name, dev2_name, mtu=None):
for dev in [dev1_name, dev2_name]:
delete_net_dev(dev)
processutils.execute('ip', 'link', 'add', dev1_name, 'type', 'veth',
'peer', 'name', dev2_name)
for dev in [dev1_name, dev2_name]:
processutils.execute('ip', 'link', 'set', dev, 'up')
processutils.execute('ip', 'link', 'set', dev, 'promisc', 'on')
_set_device_mtu_inner(dev, mtu)

View File

@ -22,24 +22,6 @@ from nova import test
class LinuxNetTestCase(test.NoDBTestCase):
"""Test networking helpers."""
def _create_veth_pair(self, calls):
with mock.patch('oslo_concurrency.processutils.execute',
return_value=('', '')) as ex:
nova.privsep.linux_net._create_veth_pair_inner(
'fake-dev1', 'fake-dev2')
ex.assert_has_calls(calls)
def test_create_veth_pair(self):
calls = [
mock.call('ip', 'link', 'add', 'fake-dev1', 'type', 'veth',
'peer', 'name', 'fake-dev2'),
mock.call('ip', 'link', 'set', 'fake-dev1', 'up'),
mock.call('ip', 'link', 'set', 'fake-dev1', 'promisc', 'on'),
mock.call('ip', 'link', 'set', 'fake-dev2', 'up'),
mock.call('ip', 'link', 'set', 'fake-dev2', 'promisc', 'on')
]
self._create_veth_pair(calls)
@mock.patch('oslo_concurrency.processutils.execute',
return_value=('', ''))
def test_set_device_mtu_default(self, mock_exec):