NSXv: Fix tempest test failures due to KeyError 'primaryAddress'
Commit Ie29acfbe323b60205ade9d660f7497f5bf4a35ca may clean up the fixed_ips of ports earlier during delete_subnet. This patch skips those address groups without matching ip_addr when updating dhcp edge service. Change-Id: Idb64b5ed02e46718238821626fa09e8b30506934
This commit is contained in:
parent
2ddc72f3d3
commit
0a62f86ffa
@ -2689,8 +2689,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
address_groups = []
|
||||
for subnet in subnets:
|
||||
address_group = {}
|
||||
net = netaddr.IPNetwork(subnet['cidr'])
|
||||
address_group['subnetPrefixLength'] = str(net.prefixlen)
|
||||
ip_found = False
|
||||
for port in ports:
|
||||
fixed_ips = port['fixed_ips']
|
||||
for fip in fixed_ips:
|
||||
@ -2698,8 +2697,12 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
ip_addr = fip['ip_address']
|
||||
if s_id == subnet['id'] and self._is_valid_ip(ip_addr):
|
||||
address_group['primaryAddress'] = ip_addr
|
||||
ip_found = True
|
||||
break
|
||||
address_groups.append(address_group)
|
||||
if ip_found:
|
||||
net = netaddr.IPNetwork(subnet['cidr'])
|
||||
address_group['subnetPrefixLength'] = str(net.prefixlen)
|
||||
address_groups.append(address_group)
|
||||
LOG.debug("Update the DHCP address group to %s", address_groups)
|
||||
return address_groups
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user