From 696b712ad44f376b33aca47773d90c5670893acc Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Thu, 10 Dec 2015 00:51:55 -0800 Subject: [PATCH] NSX|V3: improve configuration names The configuration names nsx_* have been changed to nsx_api_*. This better refelect the configuration and management of the NSX API service. Change-Id: I999f56efad1b413bc677a9de8b535f3f4785e4f5 Closes-bug: #1524659 --- devstack/lib/vmware_nsx_v3 | 8 ++++---- etc/nsx.ini | 6 +++--- vmware_nsx/common/config.py | 8 +++++--- vmware_nsx/nsxlib/v3/client.py | 2 +- vmware_nsx/nsxlib/v3/cluster.py | 6 +++--- vmware_nsx/tests/unit/nsxlib/v3/nsxlib_testcase.py | 6 +++--- vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py | 10 +++++----- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/devstack/lib/vmware_nsx_v3 b/devstack/lib/vmware_nsx_v3 index 7a85584460..f3dc021a40 100644 --- a/devstack/lib/vmware_nsx_v3 +++ b/devstack/lib/vmware_nsx_v3 @@ -100,9 +100,9 @@ function neutron_plugin_configure_service { fi # NSX_MANAGER must be a comma separated string if [[ "$NSX_MANAGERS" != "" ]]; then - _nsxv3_ini_set nsx_managers $NSX_MANAGERS + _nsxv3_ini_set nsx_api_managers $NSX_MANAGERS elif [[ "$NSX_MANAGER" != "" ]]; then - _nsxv3_ini_set nsx_managers $NSX_MANAGER + _nsxv3_ini_set nsx_api_managers $NSX_MANAGER else die $LINENO "The VMware NSX plugin needs at least one NSX manager." fi @@ -110,8 +110,8 @@ function neutron_plugin_configure_service { iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_l2gw_driver $NSX_L2GW_DRIVER fi _nsxv3_ini_set default_tier0_router_uuid $DEFAULT_TIER0_ROUTER_UUID - _nsxv3_ini_set nsx_user $NSX_USER - _nsxv3_ini_set nsx_password $NSX_PASSWORD + _nsxv3_ini_set nsx_api_user $NSX_USER + _nsxv3_ini_set nsx_api_password $NSX_PASSWORD _nsxv3_ini_set retries $NSX_RETRIES _nsxv3_ini_set insecure $NSX_INSECURE _nsxv3_ini_set ca_file $NSX_CA_FILE diff --git a/etc/nsx.ini b/etc/nsx.ini index 092cd90716..9243f9c213 100644 --- a/etc/nsx.ini +++ b/etc/nsx.ini @@ -320,13 +320,13 @@ # [://][:] # If scheme is not provided https is used. If port is not provided # port 80 is used for http and port 443 for https. -# nsx_managers = 1.2.3.4 +# nsx_api_managers = 1.2.3.4 # User name of NSX Manager -# nsx_user = admin +# nsx_api_user = admin # Password of NSX Manager -# nsx_password = default +# nsx_api_password = default # UUID of the default NSX overlay transport zone that will be used for creating # tunneled isolated Neutron networks diff --git a/vmware_nsx/common/config.py b/vmware_nsx/common/config.py index 76e3e802b3..d5733e12ef 100644 --- a/vmware_nsx/common/config.py +++ b/vmware_nsx/common/config.py @@ -169,14 +169,16 @@ nsx_common_opts = [ ] nsx_v3_opts = [ - cfg.StrOpt('nsx_user', + cfg.StrOpt('nsx_api_user', + deprecated_name='nsx_user', default='admin', help=_('User name for the NSX manager')), - cfg.StrOpt('nsx_password', + cfg.StrOpt('nsx_api_password', + deprecated_name='nsx_password', default='default', secret=True, help=_('Password for the NSX manager')), - cfg.ListOpt('nsx_managers', + cfg.ListOpt('nsx_api_managers', deprecated_name='nsx_manager', help=_('IP address of one or more NSX managers separated ' 'by commas. The IP address can optionally specify a ' diff --git a/vmware_nsx/nsxlib/v3/client.py b/vmware_nsx/nsxlib/v3/client.py index bfb4b1b917..0677e979f2 100644 --- a/vmware_nsx/nsxlib/v3/client.py +++ b/vmware_nsx/nsxlib/v3/client.py @@ -208,7 +208,7 @@ def _get_client(client): # NOTE(shihli): tmp until all refs use client class def _get_nsx_managers_from_conf(): - return cfg.CONF.nsx_v3.nsx_managers + return cfg.CONF.nsx_v3.nsx_api_managers def get_resource(resource, client=None): diff --git a/vmware_nsx/nsxlib/v3/cluster.py b/vmware_nsx/nsxlib/v3/cluster.py index a4e89987d4..02089ffc36 100644 --- a/vmware_nsx/nsxlib/v3/cluster.py +++ b/vmware_nsx/nsxlib/v3/cluster.py @@ -433,8 +433,8 @@ class NSXClusteredAPI(ClusteredAPI): http_timeout=None, conn_idle_timeout=None, http_provider=None): - self.username = username or cfg.CONF.nsx_v3.nsx_user - self.password = password or cfg.CONF.nsx_v3.nsx_password + self.username = username or cfg.CONF.nsx_v3.nsx_api_user + self.password = password or cfg.CONF.nsx_v3.nsx_api_password self.retries = retries or cfg.CONF.nsx_v3.retries self.insecure = insecure or cfg.CONF.nsx_v3.insecure self.ca_file = ca_file or cfg.CONF.nsx_v3.ca_file @@ -463,7 +463,7 @@ class NSXClusteredAPI(ClusteredAPI): uri if uri.startswith('http') else "%s://%s" % (self._http_provider.default_scheme, uri)) - conf_urls = cfg.CONF.nsx_v3.nsx_managers[:] + conf_urls = cfg.CONF.nsx_v3.nsx_api_managers[:] urls = [] providers = [] diff --git a/vmware_nsx/tests/unit/nsxlib/v3/nsxlib_testcase.py b/vmware_nsx/tests/unit/nsxlib/v3/nsxlib_testcase.py index a0b27e0745..830f7c669d 100644 --- a/vmware_nsx/tests/unit/nsxlib/v3/nsxlib_testcase.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/nsxlib_testcase.py @@ -39,9 +39,9 @@ class NsxLibTestCase(unittest.TestCase): def setup_conf_overrides(cls): cfg.CONF.set_override('default_overlay_tz_uuid', uuidutils.generate_uuid(), 'nsx_v3') - cfg.CONF.set_override('nsx_user', NSX_USER, 'nsx_v3') - cfg.CONF.set_override('nsx_password', NSX_PASSWORD, 'nsx_v3') - cfg.CONF.set_override('nsx_managers', [NSX_MANAGER], 'nsx_v3') + cfg.CONF.set_override('nsx_api_user', NSX_USER, 'nsx_v3') + cfg.CONF.set_override('nsx_api_password', NSX_PASSWORD, 'nsx_v3') + cfg.CONF.set_override('nsx_api_managers', [NSX_MANAGER], 'nsx_v3') cfg.CONF.set_override('insecure', NSX_INSECURE, 'nsx_v3') cfg.CONF.set_override('ca_file', NSX_CERT, 'nsx_v3') diff --git a/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py b/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py index 2bd4ce85a4..63ecb4a68d 100644 --- a/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py +++ b/vmware_nsx/tests/unit/nsxlib/v3/test_cluster.py @@ -86,7 +86,7 @@ class NsxV3ClusteredAPITestCase(nsxlib_testcase.NsxClientTestCase): def test_conf_providers_no_scheme(self): conf_managers = ['8.9.10.11', '9.10.11.12:4433'] cfg.CONF.set_override( - 'nsx_managers', conf_managers, 'nsx_v3') + 'nsx_api_managers', conf_managers, 'nsx_v3') mock_provider = mock.Mock() mock_provider.default_scheme = 'https' @@ -100,7 +100,7 @@ class NsxV3ClusteredAPITestCase(nsxlib_testcase.NsxClientTestCase): def test_conf_providers_with_scheme(self): conf_managers = ['http://8.9.10.11:8080', 'https://9.10.11.12:4433'] cfg.CONF.set_override( - 'nsx_managers', conf_managers, 'nsx_v3') + 'nsx_api_managers', conf_managers, 'nsx_v3') mock_provider = mock.Mock() mock_provider.default_scheme = 'https' @@ -116,7 +116,7 @@ class NsxV3ClusteredAPITestCase(nsxlib_testcase.NsxClientTestCase): 'concurrent_connections', 11, 'nsx_v3') conf_managers = ['8.9.10.11', '9.10.11.12:4433'] cfg.CONF.set_override( - 'nsx_managers', conf_managers, 'nsx_v3') + 'nsx_api_managers', conf_managers, 'nsx_v3') mock_provider = mock.Mock() mock_provider.default_scheme = 'https' @@ -133,7 +133,7 @@ class ClusteredAPITestCase(nsxlib_testcase.NsxClientTestCase): def _test_health(self, validate_fn, expected_health): conf_managers = ['8.9.10.11', '9.10.11.12'] cfg.CONF.set_override( - 'nsx_managers', conf_managers, 'nsx_v3') + 'nsx_api_managers', conf_managers, 'nsx_v3') mock_provider = mock.Mock() mock_provider.default_scheme = 'https' @@ -159,7 +159,7 @@ class ClusteredAPITestCase(nsxlib_testcase.NsxClientTestCase): def test_cluster_unavailable(self): conf_managers = ['8.9.10.11', '9.10.11.12', '10.11.12.13'] cfg.CONF.set_override( - 'nsx_managers', conf_managers, 'nsx_v3') + 'nsx_api_managers', conf_managers, 'nsx_v3') mock_provider = mock.Mock() mock_provider.default_scheme = 'https'