From 8969cc8a720f601a4722c5e3bee58f31923e06a6 Mon Sep 17 00:00:00 2001 From: asarfaty Date: Wed, 26 Aug 2020 06:37:00 +0200 Subject: [PATCH] NSX|V3+P: Fix validation of number of address pairs Change-Id: Id31c31fdb55dc4242370fdeae5cf0f7ca3d96fa3 --- vmware_nsx/plugins/common_v3/plugin.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/vmware_nsx/plugins/common_v3/plugin.py b/vmware_nsx/plugins/common_v3/plugin.py index b1bb1f1936..58e67e6318 100644 --- a/vmware_nsx/plugins/common_v3/plugin.py +++ b/vmware_nsx/plugins/common_v3/plugin.py @@ -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')