Merge "Add option to expose dvs features on nsxv plugin"

This commit is contained in:
Jenkins 2016-03-21 10:04:00 +00:00 committed by Gerrit Code Review
commit d96f8df6e0
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