Add in support for direct-physical vnic types

This is only for DVS and NSX|V plugins

This vnic has no port security and no security groups

Change-Id: I9dedc0a984fa2c5cc3006038bf3a7ad8a79eb762
This commit is contained in:
Gary Kotton 2017-08-07 23:35:05 -07:00
parent 9a558a29a8
commit 18e1669096
2 changed files with 9 additions and 5 deletions

View File

@ -324,8 +324,11 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
def _process_vnic_type(self, context, port_data, port_id):
vnic_type = port_data.get(pbin.VNIC_TYPE)
if validators.is_attr_set(vnic_type):
if vnic_type != pbin.VNIC_NORMAL and vnic_type != pbin.VNIC_DIRECT:
err_msg = _("Only direct or normal VNIC types supported")
if (vnic_type != pbin.VNIC_NORMAL and
vnic_type != pbin.VNIC_DIRECT and
vnic_type != pbin.VNIC_DIRECT_PHYSICAL):
err_msg = _("Only direct, direct-physical and normal VNIC "
"types supported")
raise n_exc.InvalidInput(error_message=err_msg)
nsxv_db.update_nsxv_port_ext_attributes(
session=context.session,

View File

@ -1667,10 +1667,11 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin,
if attrs and validators.is_attr_set(vnic_type):
if vnic_type == pbin.VNIC_NORMAL:
pass
elif vnic_type == pbin.VNIC_DIRECT:
elif vnic_type in [pbin.VNIC_DIRECT,
pbin.VNIC_DIRECT_PHYSICAL]:
if has_security_groups or port_security:
err_msg = _("Direct VNIC type requires no port "
"security and no security groups!")
err_msg = _("Direct/direct-physical VNIC type requires "
"no port security and no security groups!")
raise n_exc.InvalidInput(error_message=err_msg)
if not self._validate_network_type(
context, port_data['network_id'],