From 0edff07c7ee47f45f973f1035dcf18f19a892f50 Mon Sep 17 00:00:00 2001 From: Tao Zou Date: Tue, 26 Nov 2024 11:17:20 +0800 Subject: [PATCH] Add force parameter for VpcIpAddressAllocationApi When NSX creates the NsxVpcIpAddressAllocationApi for pre-created VPC, it will create an internal pool. If not using 'X-Allow-Overwrite: True' NCP will fail to allocate vpcipaddressallocation Issue: #3455572 Change-Id: Ie9d0c9c478dd8f96b6f091be359d99459013c477 --- vmware_nsxlib/v3/policy/core_resources.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vmware_nsxlib/v3/policy/core_resources.py b/vmware_nsxlib/v3/policy/core_resources.py index c954c2b7..3020fe21 100644 --- a/vmware_nsxlib/v3/policy/core_resources.py +++ b/vmware_nsxlib/v3/policy/core_resources.py @@ -5437,7 +5437,8 @@ class NsxVpcIpAddressAllocationApi(NsxPolicyResourceBase): ip_address_block_visibility="EXTERNAL", ip_address_type="IPV4", ip_block=IGNORE, - tags=IGNORE): + tags=IGNORE, + force=False): ip_address_allocation_id = self._init_obj_uuid( ip_address_allocation_id) ip_address_allocation_def = self._init_def( @@ -5453,14 +5454,14 @@ class NsxVpcIpAddressAllocationApi(NsxPolicyResourceBase): ip_block=ip_block, tags=tags, patch=True) - self._create_or_store(ip_address_allocation_def) + self._create_or_store(ip_address_allocation_def, force=force) return ip_address_allocation_id - def delete(self, tenant, ip_address_allocation_id): + def delete(self, tenant, ip_address_allocation_id, force=False): ip_address_allocation_def = self.entry_def( tenant=tenant, ip_address_allocation_id=ip_address_allocation_id) - self._delete_with_retry(ip_address_allocation_def) + self._delete_with_retry(ip_address_allocation_def, force=force) def get(self, tenant, ip_address_allocation_id, silent=False): ip_address_allocation_def = self.entry_def(