Browse Source

NSX|V3+P: Fix validation of number of address pairs

Change-Id: Id31c31fdb55dc4242370fdeae5cf0f7ca3d96fa3
changes/37/748137/1
asarfaty 1 month ago
committed by Adit Sarfaty
parent
commit
8969cc8a72
1 changed files with 4 additions and 10 deletions
  1. +4
    -10
      vmware_nsx/plugins/common_v3/plugin.py

+ 4
- 10
vmware_nsx/plugins/common_v3/plugin.py View File

@@ -368,16 +368,10 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
return
num_allowed_on_backend_v4 = nsxlib_consts.NUM_ALLOWED_IP_ADDRESSES_v4
num_allowed_on_backend_v6 = nsxlib_consts.NUM_ALLOWED_IP_ADDRESSES_v6
# Counting existing ports to take into account. If no fixed ips
# are defined - we set it to 3 in order to reserve 2 fixed and another
# for DHCP.
existing_fixed_ips = len(port.get('fixed_ips', []))
if existing_fixed_ips == 0:
existing_fixed_ips = 3
else:
existing_fixed_ips += 1
max_addr_pairs_v4 = num_allowed_on_backend_v4 - existing_fixed_ips
max_addr_pairs_v6 = num_allowed_on_backend_v6 - existing_fixed_ips
# Reserving 1 additional ipv4 fixed ip, and 2 for ipv6
# (including link local)
max_addr_pairs_v4 = num_allowed_on_backend_v4 - 1
max_addr_pairs_v6 = num_allowed_on_backend_v6 - 2
count_v4 = count_v6 = 0
for pair in address_pairs:
ip = pair.get('ip_address')


Loading…
Cancel
Save