From 1b4d1b5e154f25491585b24bda04773a9a03b3ce Mon Sep 17 00:00:00 2001 From: Giridhar Jayavelu Date: Wed, 3 Feb 2016 18:32:29 -0800 Subject: [PATCH] Add option to expose dvs features on nsxv plugin This patch adds a new config option 'use_dvs_features' that will allow to expose some dvs features like network resource pool, promiscuous mode, traffic marking etc. The value of 'use_dvs_features' is boolean i.e true/false. The dvs features can be configured by managing the dvs backing NSX-v directly. Co-Authored-by: Giridhar Jayavelu Change-Id: Ic333790c0a12db7a20995e722809257a884da664 --- vmware_nsx/common/config.py | 11 +++++++++++ vmware_nsx/plugins/nsx_v/plugin.py | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/vmware_nsx/common/config.py b/vmware_nsx/common/config.py index 771b33b404..1a52cf1a6a 100644 --- a/vmware_nsx/common/config.py +++ b/vmware_nsx/common/config.py @@ -18,6 +18,7 @@ from oslo_config import cfg from vmware_nsx._i18n import _, _LW from vmware_nsx.common import exceptions as nsx_exc +from vmware_nsx.dvs import dvs_utils from vmware_nsx.extensions import routersize LOG = logging.getLogger(__name__) @@ -396,6 +397,12 @@ nsxv_opts = [ help=_('List of nameservers to configure for the DHCP binding ' 'entries. These will be used if there are no ' 'nameservers defined on the subnet.')), + cfg.BoolOpt('use_dvs_features', + default=False, + help=_('If True, dvs features will be supported which ' + 'involves configuring the dvs backing nsx_v directly. ' + 'If False, only features exposed via nsx_v will be ' + 'supported')), ] # Register the configuration options @@ -418,3 +425,7 @@ def validate_nsxv_config_options(): LOG.warning(_LW("dvs_id must be configured to support VLANs!")) if cfg.CONF.nsxv.vdn_scope_id is None: LOG.warning(_LW("vdn_scope_id must be configured to support VXLANs!")) + if cfg.CONF.nsxv.use_dvs_features and not dvs_utils.dvs_is_enabled(): + error = _("dvs host/vcenter credentials must be defined to use " + "dvs features") + raise nsx_exc.NsxPluginException(err_msg=error) diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index 9f3ce49394..1c831cb363 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -55,6 +55,7 @@ from neutron.extensions import securitygroup as ext_sg from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import utils from neutron.quota import resource_registry +from vmware_nsx.dvs import dvs import vmware_nsx from vmware_nsx._i18n import _, _LE, _LI, _LW @@ -171,6 +172,11 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, self.default_section = self._create_cluster_default_fw_section() self._router_managers = managers.RouterTypeManager(self) + if cfg.CONF.nsxv.use_dvs_features: + self._dvs = dvs.DvsManager() + else: + self._dvs = None + has_metadata_cfg = ( cfg.CONF.nsxv.nova_metadata_ips and cfg.CONF.nsxv.mgt_net_moid