Merge "Add in support for direct-physical vnic types"

This commit is contained in:
Jenkins 2017-08-11 13:16:14 +00:00 committed by Gerrit Code Review
commit 592a6deaf3
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'],