Fix Octavia validators error about missing member

So far, some validations in Octavia might have run too early in the
validation flow, for example, a request is being sent to a member which
is still not ready.

This patch replaces the simple assertEqual, with an exception which will
be raised (RoundRobinException), in case that one member is not ready
yet.

The validator method caller wraps the call with a try/except clause, to
make sure Octavia has enough time to launch a ready-vm.

Change-Id: Ie3821441ff1659b7f919a34e517c32b552eaf544
This commit is contained in:
Omer 2023-05-19 20:32:03 +02:00
parent 761de81433
commit 743adacdf4
1 changed files with 4 additions and 5 deletions

View File

@ -43,8 +43,6 @@ def check_members_balanced(ip_address: str,
"""Check if traffic is properly balanced between members."""
test_case = tobiko.get_test_case()
# Getting the members count
if members_count is None:
if pool_id is None:
@ -96,8 +94,9 @@ def check_members_balanced(ip_address: str,
missing_members_count = members_count - len(replies)
LOG.debug(f'Members count from pool {pool_id} is {members_count}')
LOG.debug(f'len(replies) is {len(replies)}')
test_case.assertEqual(0, missing_members_count,
f'Missing replies from {missing_members_count} "'
'"members.')
if 0 != missing_members_count:
raise octavia.RoundRobinException(
f'Missing replies from {missing_members_count} members.')
return replies