Ensure that haproxy spawned by the metadata agents is active
In both neutron-metadata and neutron-ovn-metadata agents we should ensure that haproxy service spawned for network/router is actually active before moving on. This patch adds that check and this is similar to what was already implemented some time ago for the dnsmasq process spawned by the dhcp agent. Conflicts: neutron/tests/unit/agent/dhcp/test_agent.py Related-Bug: #2052787 Change-Id: Ic58640d89952fa03bd1059608ee6c9072fbaabf5 (cherry picked from commit2f7f7c2fc2
) (cherry picked from commit0dfe8dedd6
)
This commit is contained in:
parent
85debddc1c
commit
aedb872e4f
|
@ -295,7 +295,7 @@ class MetadataDriver(object):
|
|||
ns_name=ns_name,
|
||||
callback=callback)
|
||||
try:
|
||||
pm.enable()
|
||||
pm.enable(ensure_active=True)
|
||||
except exceptions.ProcessExecutionError as exec_err:
|
||||
LOG.error("Encountered process execution error %(err)s while "
|
||||
"starting process in namespace %(ns)s",
|
||||
|
|
|
@ -206,7 +206,7 @@ class MetadataDriver(object):
|
|||
ns_name=ns_name,
|
||||
callback=callback)
|
||||
try:
|
||||
pm.enable()
|
||||
pm.enable(ensure_active=True)
|
||||
except exceptions.ProcessExecutionError as exec_err:
|
||||
LOG.error("Encountered process execution error %(err)s while "
|
||||
"starting process in namespace %(ns)s",
|
||||
|
|
|
@ -637,6 +637,7 @@ class TestDhcpAgent(base.BaseTestCase):
|
|||
'IpAddrCommand.wait_until_address_ready') as mock_wait:
|
||||
mock_wait.return_value = True
|
||||
dhcp = dhcp_agent.DhcpAgent(HOSTNAME)
|
||||
dhcp.update_isolated_metadata_proxy = mock.Mock()
|
||||
self.assertEqual(set(), dhcp.dhcp_ready_ports)
|
||||
dhcp.configure_dhcp_for_network(fake_network)
|
||||
self.assertEqual({fake_port1.id}, dhcp.dhcp_ready_ports)
|
||||
|
@ -834,7 +835,7 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
|
|||
process_instance.assert_has_calls([
|
||||
mock.call.disable(sig=str(int(signal.SIGTERM))),
|
||||
mock.call.get_pid_file_name(),
|
||||
mock.call.enable()])
|
||||
mock.call.enable(ensure_active=True)])
|
||||
else:
|
||||
process_instance.assert_has_calls([
|
||||
mock.call.disable(sig=str(int(signal.SIGTERM)))])
|
||||
|
|
|
@ -168,7 +168,12 @@ class TestMetadataDriverProcess(base.BaseTestCase):
|
|||
'IpAddrCommand.wait_until_address_ready') as mock_wait,\
|
||||
mock.patch(
|
||||
'neutron.agent.linux.ip_lib.'
|
||||
'delete_ip_address') as mock_del:
|
||||
'delete_ip_address') as mock_del,\
|
||||
mock.patch(
|
||||
'neutron.agent.linux.external_process.'
|
||||
'ProcessManager.active',
|
||||
new_callable=mock.PropertyMock,
|
||||
side_effect=[False, True]):
|
||||
agent = l3_agent.L3NATAgent('localhost')
|
||||
agent.process_monitor = mock.Mock()
|
||||
cfg_file = os.path.join(
|
||||
|
|
|
@ -68,7 +68,12 @@ class TestMetadataDriverProcess(base.BaseTestCase):
|
|||
return_value=test_utils.FakeUser(self.EUNAME)),\
|
||||
mock.patch('grp.getgrnam',
|
||||
return_value=test_utils.FakeGroup(self.EGNAME)),\
|
||||
mock.patch('os.makedirs'):
|
||||
mock.patch('os.makedirs'),\
|
||||
mock.patch(
|
||||
'neutron.agent.linux.external_process.'
|
||||
'ProcessManager.active',
|
||||
new_callable=mock.PropertyMock,
|
||||
side_effect=[False, True]):
|
||||
cfg_file = os.path.join(
|
||||
metadata_driver.HaproxyConfigurator.get_config_path(
|
||||
cfg.CONF.state_path),
|
||||
|
|
Loading…
Reference in New Issue