Fix fip address display for loadbalancer

Currently add_floating_ip_info find floating ip based on match of
floating ip fixed address and VIP ip address which is not correct
for all cases. We may have several private subnets with same ip
range accross the tenant and occasionally loadbalancers may have
the  same VIP ip address, though ports are different.

Fix this case by comparison of ids instead of addresses.

Change-Id: Ie6ac381bb63149248fcb2f710348f97b6f68bec1
This commit is contained in:
Ann Taraday 2019-10-29 15:50:49 +04:00
parent 1a4e530913
commit fe4df4319b
1 changed files with 1 additions and 1 deletions

View File

@ -662,7 +662,7 @@ def add_floating_ip_info(request, loadbalancers):
for lb in loadbalancers:
floating_ip = {}
associated_ip = next((fip for fip in floating_ips
if fip['fixed_ip'] == lb['vip_address']), None)
if fip['port_id'] == lb['vip_port_id']), None)
if associated_ip is not None:
floating_ip['id'] = associated_ip['id']
floating_ip['ip'] = associated_ip['ip']