NSX|P: Issue proper error in external network creation

Change-Id: If9633b4e74d8a354ff93d2a75968d41cee0f8ad3
This commit is contained in:
asarfaty 2020-07-05 10:42:28 +02:00 committed by Adit Sarfaty
parent 13f7c3b795
commit 7e2b4f4996
1 changed files with 6 additions and 1 deletions

View File

@ -657,7 +657,12 @@ class NsxPolicyPlugin(nsx_plugin_common.NsxPluginV3Base):
def _tier0_validator(self, tier0_uuid):
# Fail if the tier0 uuid was not found on the NSX
self.nsxpolicy.tier0.get(tier0_uuid)
try:
self.nsxpolicy.tier0.get(tier0_uuid)
except Exception:
msg = (_("Cannot create external network as Tier0 %s was not "
"found") % tier0_uuid)
raise n_exc.InvalidInput(error_message=msg)
def _get_nsx_net_tz_id(self, nsx_net):
return nsx_net['transport_zone_path'].split('/')[-1]