[Fullstack] HA L3 agent restart only standby agents
In fullstack test which is testing if there is no packet lost
during restart of agents there were restarted always all agents
which hosted router.
In case when as first was restarted 'master' agent it might
lead to the case when after restart 'master' node was switched
to second L3 agent and that caused lost of few packets and
failed test.
This test should only check if restart of standby agents will
not cause any packet lost so this patch do it in this way.
Change-Id: I6293169d7d7f35e3a9726071e63003ac569dd01e
Closes-Bug: #1776459
(cherry picked from commit c57a5d9d8a
)
This commit is contained in:
parent
689d8ca11b
commit
9bc52421eb
|
@ -115,6 +115,9 @@ class NeutronConfigFixture(ConfigFixture):
|
|||
def _generate_policy_json(self):
|
||||
return c_helpers.find_sample_file('policy.json')
|
||||
|
||||
def get_host(self):
|
||||
return self.config['DEFAULT']['host']
|
||||
|
||||
|
||||
class ML2ConfigFixture(ConfigFixture):
|
||||
|
||||
|
|
|
@ -234,6 +234,19 @@ class TestHAL3Agent(TestL3Agent):
|
|||
if self._get_keepalived_state(keepalived_state_file) == "master":
|
||||
return keepalived_state_file
|
||||
|
||||
def _get_l3_agents_with_ha_state(self, l3_agents, router_id, ha_state):
|
||||
found_agents = []
|
||||
agents_hosting_router = self.client.list_l3_agent_hosting_routers(
|
||||
router_id)['agents']
|
||||
for agent in l3_agents:
|
||||
agent_host = agent.neutron_cfg_fixture.get_host()
|
||||
for agent_hosting_router in agents_hosting_router:
|
||||
if (agent_hosting_router['host'] == agent_host and
|
||||
agent_hosting_router['ha_state'] == ha_state):
|
||||
found_agents.append(agent)
|
||||
break
|
||||
return found_agents
|
||||
|
||||
def test_keepalived_multiple_sighups_does_not_forfeit_mastership(self):
|
||||
"""Setup a complete "Neutron stack" - both an internal and an external
|
||||
network+subnet, and a router connected to both.
|
||||
|
@ -283,7 +296,7 @@ class TestHAL3Agent(TestL3Agent):
|
|||
"master",
|
||||
self._get_keepalived_state(keepalived_state_file))
|
||||
|
||||
def test_ha_router_restart_agents_no_packet_lost(self):
|
||||
def test_ha_router_restart_standby_agents_no_packet_lost(self):
|
||||
tenant_id = uuidutils.generate_uuid()
|
||||
ext_net, ext_sub = self._create_external_network_and_subnet(tenant_id)
|
||||
router = self.safe_client.create_router(tenant_id, ha=True,
|
||||
|
@ -308,7 +321,13 @@ class TestHAL3Agent(TestL3Agent):
|
|||
|
||||
router_ip = router['external_gateway_info'][
|
||||
'external_fixed_ips'][0]['ip_address']
|
||||
# Let's check first if connectivity from external_vm to router's
|
||||
# external gateway IP is possible before we restart agents
|
||||
external_vm.block_until_ping(router_ip)
|
||||
|
||||
l3_agents = [host.agents['l3'] for host in self.environment.hosts]
|
||||
l3_standby_agents = self._get_l3_agents_with_ha_state(
|
||||
l3_agents, router['id'], 'standby')
|
||||
|
||||
self._assert_ping_during_agents_restart(
|
||||
l3_agents, external_vm.namespace, [router_ip], count=60)
|
||||
l3_standby_agents, external_vm.namespace, [router_ip], count=60)
|
||||
|
|
Loading…
Reference in New Issue