Merge "NSX|V: treat edge case when spoofguard entry already exists"
This commit is contained in:
commit
e9048e1712
@ -4509,9 +4509,13 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
|||||||
lla = str(netutils.get_ipv6_addr_by_EUI64(
|
lla = str(netutils.get_ipv6_addr_by_EUI64(
|
||||||
constants.IPv6_LLA_PREFIX, mac_addr))
|
constants.IPv6_LLA_PREFIX, mac_addr))
|
||||||
approved_addrs.append(lla)
|
approved_addrs.append(lla)
|
||||||
self.nsx_v.vcns.approve_assigned_addresses(
|
try:
|
||||||
sg_policy_id, vnic_id, mac_addr, approved_addrs)
|
self.nsx_v.vcns.approve_assigned_addresses(
|
||||||
self.nsx_v.vcns.publish_assigned_addresses(sg_policy_id, vnic_id)
|
sg_policy_id, vnic_id, mac_addr, approved_addrs)
|
||||||
|
self.nsx_v.vcns.publish_assigned_addresses(sg_policy_id, vnic_id)
|
||||||
|
except vsh_exc.AlreadyExists:
|
||||||
|
# Entry already configured on the NSX
|
||||||
|
pass
|
||||||
|
|
||||||
def _is_compute_port(self, port):
|
def _is_compute_port(self, port):
|
||||||
try:
|
try:
|
||||||
|
@ -43,6 +43,7 @@ PREPEND = 0
|
|||||||
APPEND = -1
|
APPEND = -1
|
||||||
|
|
||||||
# error code
|
# error code
|
||||||
|
NSX_ERROR_ALREADY_EXISTS = 210
|
||||||
VCNS_ERROR_CODE_EDGE_NOT_RUNNING = 10013
|
VCNS_ERROR_CODE_EDGE_NOT_RUNNING = 10013
|
||||||
NSX_ERROR_DHCP_OVERLAPPING_IP = 12501
|
NSX_ERROR_DHCP_OVERLAPPING_IP = 12501
|
||||||
NSX_ERROR_DHCP_DUPLICATE_HOSTNAME = 12504
|
NSX_ERROR_DHCP_DUPLICATE_HOSTNAME = 12504
|
||||||
|
@ -76,3 +76,7 @@ class ServiceUnavailable(VcnsApiException):
|
|||||||
|
|
||||||
class ServiceConflict(VcnsApiException):
|
class ServiceConflict(VcnsApiException):
|
||||||
message = _("Concurrent object access error: %(uri)s")
|
message = _("Concurrent object access error: %(uri)s")
|
||||||
|
|
||||||
|
|
||||||
|
class AlreadyExists(VcnsApiException):
|
||||||
|
message = _("Resource %(resource)s already exists")
|
||||||
|
@ -826,9 +826,17 @@ class Vcns(object):
|
|||||||
'approvedMacAddress': mac_addr,
|
'approvedMacAddress': mac_addr,
|
||||||
'publishedIpAddress': addresses,
|
'publishedIpAddress': addresses,
|
||||||
'publishedMacAddress': mac_addr}}}
|
'publishedMacAddress': mac_addr}}}
|
||||||
|
try:
|
||||||
return self.do_request(HTTP_POST, '%s?action=approve' % uri,
|
return self.do_request(HTTP_POST, '%s?action=approve' % uri,
|
||||||
body, format='xml', decode=False)
|
body, format='xml', decode=False)
|
||||||
|
except exceptions.VcnsApiException as e:
|
||||||
|
nsx_errcode = self.xmlapi_client._get_nsx_errorcode(e.response)
|
||||||
|
if nsx_errcode == constants.NSX_ERROR_ALREADY_EXISTS:
|
||||||
|
LOG.warning("Spoofguard entry for %s already exists",
|
||||||
|
vnic_id)
|
||||||
|
raise exceptions.AlreadyExists(resource=vnic_id)
|
||||||
|
# raise original exception for retries
|
||||||
|
raise
|
||||||
|
|
||||||
@retry_upon_exception(exceptions.RequestBad)
|
@retry_upon_exception(exceptions.RequestBad)
|
||||||
def approve_assigned_addresses(self, policy_id,
|
def approve_assigned_addresses(self, policy_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user