From 95a872fcd905c0f7c4f2b4cf63e93fa9770d13c1 Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Tue, 2 Apr 2019 13:27:06 +0200 Subject: [PATCH] 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 --- .../backends/agent/api_server/osutils.py | 2 +- .../backend/agent/api_server/test_server.py | 20 +++++++++---------- .../fix-vip-plug-centos-74c2fe7099964b08.yaml | 3 +++ 3 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 releasenotes/notes/fix-vip-plug-centos-74c2fe7099964b08.yaml diff --git a/octavia/amphorae/backends/agent/api_server/osutils.py b/octavia/amphorae/backends/agent/api_server/osutils.py index 102297d3a7..40cf07b50f 100644 --- a/octavia/amphorae/backends/agent/api_server/osutils.py +++ b/octavia/amphorae/backends/agent/api_server/osutils.py @@ -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(), diff --git a/octavia/tests/functional/amphorae/backend/agent/api_server/test_server.py b/octavia/tests/functional/amphorae/backend/agent/api_server/test_server.py index 8d4f0e7587..837b28ea99 100644 --- a/octavia/tests/functional/amphorae/backend/agent/api_server/test_server.py +++ b/octavia/tests/functional/amphorae/backend/agent/api_server/test_server.py @@ -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']] diff --git a/releasenotes/notes/fix-vip-plug-centos-74c2fe7099964b08.yaml b/releasenotes/notes/fix-vip-plug-centos-74c2fe7099964b08.yaml new file mode 100644 index 0000000000..6995a546c3 --- /dev/null +++ b/releasenotes/notes/fix-vip-plug-centos-74c2fe7099964b08.yaml @@ -0,0 +1,3 @@ +--- +fixes: + - Fixed an error when plugging the VIP on CentOS-based amphorae.