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
This commit is contained in:
Tao Zou 2024-11-26 11:17:20 +08:00
parent 14a9b16225
commit 0edff07c7e

View File

@ -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(