From 18e16690960a6a1e50939b14a306e2861cb95fb3 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Mon, 7 Aug 2017 23:35:05 -0700 Subject: [PATCH] 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 --- vmware_nsx/plugins/dvs/plugin.py | 7 +++++-- vmware_nsx/plugins/nsx_v/plugin.py | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/vmware_nsx/plugins/dvs/plugin.py b/vmware_nsx/plugins/dvs/plugin.py index 0e0c9fffb2..4971c0ea3a 100644 --- a/vmware_nsx/plugins/dvs/plugin.py +++ b/vmware_nsx/plugins/dvs/plugin.py @@ -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, diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index cde221a16a..57bb2bff0a 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -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'],