NSX-v3: fix overlay network check

Change-Id: I8e6db4d89b9741f50a19f2499703a9c755063c31
This commit is contained in:
Adit Sarfaty 2018-04-02 13:26:46 +03:00
parent 7c3f1e63df
commit 2535cac55f
1 changed files with 10 additions and 6 deletions

View File

@ -1037,16 +1037,20 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
bindings = nsx_db.get_network_bindings(context.session, network_id)
# With NSX plugin, "normal" overlay networks will have no binding
if not bindings:
# check the backend network
# TODO(asarfaty): Keep TZ type in DB to avoid going to the backend
# check the backend transport zone
az = self.get_network_az_by_net_id(context, network_id)
ls = self.nsxlib.logical_switch.get(az._default_overlay_tz_uuid)
tz = ls.get('transport_zone_id')
tz = az._default_overlay_tz_uuid
if tz:
backend_type = self.nsxlib.transport_zone.get_transport_type(
tz)
return (backend_type ==
self.nsxlib.transport_zone.TRANSPORT_TYPE_OVERLAY)
if (backend_type !=
self.nsxlib.transport_zone.TRANSPORT_TYPE_OVERLAY):
# This is a misconfiguration
LOG.warning("Availability zone %(az)s default overlay TZ "
"%(tz)s is of type %(type)s",
{'az': az.name, 'tz': tz,
'type': backend_type})
return False
return True
binding = bindings[0]
if binding.binding_type == utils.NsxV3NetworkTypes.GENEVE: