NSX|V: ensure that segmentation ID's are unique

When a physichal network that spans multiple DVS'es was used
the validations for the uniqueness of the VLAN would not work.
This would later to lead to failures, for example attaching a
distributed router to one of these networks.

Change-Id: I3d637521e733b402e4895eab833888464b63b2c1
This commit is contained in:
Gary Kotton 2017-08-11 05:49:47 +03:00
parent 9647840f46
commit b9a62a8429
1 changed files with 8 additions and 11 deletions

View File

@ -638,17 +638,14 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
bindings = nsxv_db.get_network_bindings_by_vlanid(
context.session, segmentation_id)
if bindings:
if physical_network_set:
phy_uuid = physical_network
else:
# use the dvs_id of the availability zone
phy_uuid = az_dvs
for binding in bindings:
if binding['phy_uuid'] == phy_uuid:
raise n_exc.VlanIdInUse(
vlan_id=segmentation_id,
physical_network=phy_uuid)
dvs_ids = self._get_dvs_ids(physical_network,
az_dvs)
for phy_uuid in dvs_ids:
for binding in bindings:
if binding['phy_uuid'] == phy_uuid:
raise n_exc.VlanIdInUse(
vlan_id=segmentation_id,
physical_network=phy_uuid)
elif network_type == c_utils.NsxVNetworkTypes.VXLAN:
# Currently unable to set the segmentation id
if segmentation_id_set: