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 <gjayavelu@vmware.com>

Change-Id: Ic333790c0a12db7a20995e722809257a884da664
This commit is contained in:
Giridhar Jayavelu 2016-02-03 18:32:29 -08:00 committed by garyk
parent e0dd32af0c
commit 1b4d1b5e15
2 changed files with 17 additions and 0 deletions

View File

@ -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)

View File

@ -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