NSX|V: add support for VLAN trunk with VLAN network

Completes the VLAN trunk support

Change-Id: Ied8a299428486938d2006badf572c1308ccf1269
This commit is contained in:
Gary Kotton 2017-02-24 06:55:41 -08:00
parent cc2dfe2aa4
commit a856341b73
2 changed files with 19 additions and 3 deletions

View File

@ -428,6 +428,10 @@ class DvsManager(VCManagerBase):
standby = list(set(uplinks.uplinkPortName) - set(ports))
policy.uplinkPortOrder.standbyUplinkPort = standby
def update_port_group_spec_trunk(self, pg_spec, trunk_data):
port_conf = pg_spec.defaultPortConfig
port_conf.vlan = self._get_trunk_vlan_spec()
class VMManager(VCManagerBase):
"""Management class for VMs related VC tasks."""

View File

@ -1087,9 +1087,6 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
net_morefs = [segment.get(pnet.PHYSICAL_NETWORK)]
dvs_net_ids = [net_data['name']]
else:
if vlt:
raise NotImplementedError(_("Transparent support only "
"for VXLANs"))
segment = net_data[mpnet.SEGMENTS][0]
physical_network = segment.get(pnet.PHYSICAL_NETWORK)
# Retrieve the list of dvs-ids from physical network.
@ -1119,6 +1116,21 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
net_morefs.append(net_moref)
dvs_net_ids.append(self._get_vlan_network_name(
net_data, dvs_id))
if vlt:
try:
self._vcm.update_port_groups_config(
dvs_id, net_data['id'], net_moref,
self._vcm.update_port_group_spec_trunk,
{})
except Exception:
with excutils.save_and_reraise_exception():
# Delete VLAN networks on other DVSes if it
# fails to be created on one DVS and reraise
# the original exception.
for dvsmoref, netmoref in six.iteritems(
dvs_pg_mappings):
self._delete_backend_network(
netmoref, dvsmoref)
try:
net_data[psec.PORTSECURITY] = net_data.get(psec.PORTSECURITY, True)
# Create SpoofGuard policy for network anti-spoofing