Fix VIP plugging on CentOS-based amphorae

ifup does not provide option -v in CentOS-based amphorae.
This option was added in I0dbb145ab9a0bb8f831c1db28cabd262f9394e7e.

Story: 2005341
Task: 30288

Change-Id: I56947e0d2bb207b59b0b3928efc96546d6410f43
This commit is contained in:
Carlos Goncalves 2019-04-02 13:27:06 +02:00
parent 9e5e5cd22f
commit 95a872fcd9
3 changed files with 14 additions and 11 deletions

View File

@ -209,7 +209,7 @@ class BaseOS(object):
addr_flush = "ip netns exec {ns} ip addr flush {int}".format(
ns=consts.AMPHORA_NAMESPACE, int=interface)
cmd = ("ip netns exec {ns} ifup -v {params}".format(
cmd = ("ip netns exec {ns} ifup {params}".format(
ns=consts.AMPHORA_NAMESPACE, params=interface))
try:
out = subprocess.check_output(int_up.split(),

View File

@ -1185,7 +1185,7 @@ class TestServerTestCase(base.TestCase):
'PERSISTENT_DHCLIENT="1"\n'.format(int=test_int_num))
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', 'eth' + test_int_num], stderr=-2)
'ifup', 'eth' + test_int_num], stderr=-2)
# fixed IPs happy path
port_info = {'mac_address': '123', 'mtu': 1450, 'fixed_ips': [
@ -1263,7 +1263,7 @@ class TestServerTestCase(base.TestCase):
'NETMASK="255.255.255.0"\n'.format(int=test_int_num))
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', 'eth' + test_int_num], stderr=-2)
'ifup', 'eth' + test_int_num], stderr=-2)
# fixed IPs happy path IPv6
port_info = {'mac_address': '123', 'mtu': 1450, 'fixed_ips': [
@ -1337,7 +1337,7 @@ class TestServerTestCase(base.TestCase):
'0000:0002"\n'.format(int=test_int_num))
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', 'eth' + test_int_num], stderr=-2)
'ifup', 'eth' + test_int_num], stderr=-2)
# fixed IPs, bogus IP
port_info = {'mac_address': '123', 'fixed_ips': [
@ -1539,7 +1539,7 @@ class TestServerTestCase(base.TestCase):
mock_os_chmod.assert_has_calls(calls)
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', consts.NETNS_PRIMARY_INTERFACE], stderr=-2)
'ifup', consts.NETNS_PRIMARY_INTERFACE], stderr=-2)
def test_ubuntu_plug_VIP4(self):
self._test_plug_VIP4(consts.UBUNTU)
@ -1800,7 +1800,7 @@ class TestServerTestCase(base.TestCase):
mock_os_chmod.assert_has_calls(calls)
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', '{netns_int}:0'.format(
'ifup', '{netns_int}:0'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE)], stderr=-2)
# Verify sysctl was loaded
@ -1903,7 +1903,7 @@ class TestServerTestCase(base.TestCase):
netns_int=consts.NETNS_PRIMARY_INTERFACE))
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', '{netns_int}:0'.format(
'ifup', '{netns_int}:0'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE)], stderr=-2)
mock_interfaces.side_effect = [['blah']]
@ -2167,12 +2167,12 @@ class TestServerTestCase(base.TestCase):
if distro == consts.UBUNTU:
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', '{netns_int}:0'.format(
'ifup', '{netns_int}:0'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE)], stderr=-2)
elif distro == consts.CENTOS:
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', '{netns_int}'.format(
'ifup', '{netns_int}'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE)], stderr=-2)
# Verify sysctl was loaded
@ -2277,12 +2277,12 @@ class TestServerTestCase(base.TestCase):
if distro == consts.UBUNTU:
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', '{netns_int}:0'.format(
'ifup', '{netns_int}:0'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE)], stderr=-2)
elif distro == consts.CENTOS:
mock_check_output.assert_called_with(
['ip', 'netns', 'exec', consts.AMPHORA_NAMESPACE,
'ifup', '-v', '{netns_int}'.format(
'ifup', '{netns_int}'.format(
netns_int=consts.NETNS_PRIMARY_INTERFACE)], stderr=-2)
mock_interfaces.side_effect = [['blah']]

View File

@ -0,0 +1,3 @@
---
fixes:
- Fixed an error when plugging the VIP on CentOS-based amphorae.