From e667adc9e185ac6f1af1d0ddb1f0087145371b91 Mon Sep 17 00:00:00 2001 From: armando-migliaccio Date: Fri, 27 Sep 2013 09:27:50 -0700 Subject: [PATCH] Remove deprecated NVP options In Havana, NVP configuration was simplified; in the process a few options that existed in Grizzly or older were deprecated. This change removes those options from the Icehouse tree. Fixes bug #1221840 Change-Id: Id83a339c88ec2477718a350b6ac1678ccba01509 --- etc/neutron/plugins/nicira/nvp.ini | 18 ---------- neutron/plugins/nicira/NeutronPlugin.py | 7 +--- neutron/plugins/nicira/common/config.py | 29 ---------------- neutron/plugins/nicira/nvp_cluster.py | 10 ------ .../unit/nicira/etc/nvp.ini.grizzly.test | 11 ------ neutron/tests/unit/nicira/test_nvpopts.py | 34 ------------------- 6 files changed, 1 insertion(+), 108 deletions(-) delete mode 100644 neutron/tests/unit/nicira/etc/nvp.ini.grizzly.test diff --git a/etc/neutron/plugins/nicira/nvp.ini b/etc/neutron/plugins/nicira/nvp.ini index 418d873cbf..631062b7a3 100644 --- a/etc/neutron/plugins/nicira/nvp.ini +++ b/etc/neutron/plugins/nicira/nvp.ini @@ -1,21 +1,3 @@ -# ############################################################# -# WARNINGS: The following deprecations have been made in the -# Havana release. Support for the options below will be removed -# in Ixxx. -# -# Section: [DEFAULT], Option: 'metadata_dhcp_host_route' -# Remarks: Use 'enable_isolated_metadata' in dhcp_agent.ini. -# -# -# Section: [cluster:name], Option: 'nvp_controller_connection' -# Remarks: The configuration will allow the specification of -# a single cluster, therefore [cluster:name] is no -# longer used. Use 'nvp_*', options, 'req_timeout', -# 'retries', etc. as indicated in the DEFAULT section. -# Support for multiple clusters will be added through -# an API extension. -# ############################################################## - [DEFAULT] # User name for NVP controller # nvp_user = admin diff --git a/neutron/plugins/nicira/NeutronPlugin.py b/neutron/plugins/nicira/NeutronPlugin.py index ae052a66db..b77c59cdec 100644 --- a/neutron/plugins/nicira/NeutronPlugin.py +++ b/neutron/plugins/nicira/NeutronPlugin.py @@ -57,7 +57,7 @@ from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg from neutron.openstack.common import excutils from neutron.plugins.common import constants as plugin_const -from neutron.plugins.nicira.common import config +from neutron.plugins.nicira.common import config # noqa from neutron.plugins.nicira.common import exceptions as nvp_exc from neutron.plugins.nicira.common import securitygroups as nvp_sec from neutron.plugins.nicira.common import sync @@ -97,11 +97,6 @@ class NetworkTypes: def create_nvp_cluster(cluster_opts, concurrent_connections, nvp_gen_timeout): - # NOTE(armando-migliaccio): remove this block once we no longer - # want to support deprecated options in the nvp config file - # ### BEGIN - config.register_deprecated(cfg.CONF) - # ### END cluster = nvp_cluster.NVPCluster(**cluster_opts) api_providers = [ctrl.split(':') + [True] for ctrl in cluster.nvp_controllers] diff --git a/neutron/plugins/nicira/common/config.py b/neutron/plugins/nicira/common/config.py index 7fc0dae8f8..be4ffb32e4 100644 --- a/neutron/plugins/nicira/common/config.py +++ b/neutron/plugins/nicira/common/config.py @@ -157,32 +157,3 @@ cfg.CONF.register_opts(cluster_opts) cfg.CONF.register_opts(nvp_opts, "NVP") cfg.CONF.register_opts(sync_opts, "NVP_SYNC") cfg.CONF.register_opts(vcns_opts, group="vcns") -# NOTE(armando-migliaccio): keep the following code until we support -# NVP configuration files in older format (Grizzly or older). -# ### BEGIN -controller_depr = cfg.MultiStrOpt('nvp_controller_connection', - help=_("Describes a connection to a single " - "controller. A different connection " - "for each controller in the cluster " - "can be specified; there must be at " - "least one connection per cluster.")) - -host_route_depr = cfg.BoolOpt('metadata_dhcp_host_route', default=None) - - -def register_deprecated(conf): - conf.register_opts([host_route_depr]) - multi_parser = cfg.MultiConfigParser() - read_ok = multi_parser.read(conf.config_file) - if len(read_ok) != len(conf.config_file): - raise cfg.Error(_("Some config files were not parsed properly")) - - for parsed_file in multi_parser.parsed: - for section in parsed_file.keys(): - if not section.lower().startswith("cluster:"): - continue - - section = 'CLUSTER:' + section.split(':', 1)[1] - if section not in conf: - conf.register_opts(cluster_opts + [controller_depr], section) -# ### END diff --git a/neutron/plugins/nicira/nvp_cluster.py b/neutron/plugins/nicira/nvp_cluster.py index 9166c88319..7d570d9747 100644 --- a/neutron/plugins/nicira/nvp_cluster.py +++ b/neutron/plugins/nicira/nvp_cluster.py @@ -79,16 +79,6 @@ class NVPCluster(object): elif options.get(arg) is not None: # Process deprecated attributes only if specified self._deprecated_attributes[arg] = options.get(arg) - if arg.startswith("CLUSTER:"): - cluster_section = cfg.CONF.get(arg) - for option in cluster_section: - v = cluster_section.get(option) - if option not in DEPRECATED_ATTRIBUTES: - # option may be in dict, but with None value - setattr(self, option, options.get(option) or v) - self._process_attribute(option) - else: - self._deprecated_attributes[option] = v def _process_attribute(self, attribute): # Process the attribute only if it's not empty! diff --git a/neutron/tests/unit/nicira/etc/nvp.ini.grizzly.test b/neutron/tests/unit/nicira/etc/nvp.ini.grizzly.test deleted file mode 100644 index 9f48761160..0000000000 --- a/neutron/tests/unit/nicira/etc/nvp.ini.grizzly.test +++ /dev/null @@ -1,11 +0,0 @@ -[DEFAULT] -metadata_dhcp_host_route = False - -[cluster:fake] -default_tz_uuid = fake_tz_uuid -nova_zone_id = whatever -nvp_cluster_uuid = fake_cluster_uuid -nvp_controller_connection=fake_1:443:foo:bar:4:3:2:1 -nvp_controller_connection=fake_2:443:foo:bar:4:3:2:1 -default_l3_gw_service_uuid = whatever -default_l2_gw_service_uuid = whatever diff --git a/neutron/tests/unit/nicira/test_nvpopts.py b/neutron/tests/unit/nicira/test_nvpopts.py index 15de6f6745..a09c513049 100644 --- a/neutron/tests/unit/nicira/test_nvpopts.py +++ b/neutron/tests/unit/nicira/test_nvpopts.py @@ -35,7 +35,6 @@ BASE_CONF_PATH = get_fake_conf('neutron.conf.test') NVP_BASE_CONF_PATH = get_fake_conf('neutron.conf.test') NVP_INI_PATH = get_fake_conf('nvp.ini.basic.test') NVP_INI_FULL_PATH = get_fake_conf('nvp.ini.full.test') -NVP_INI_DEPR_PATH = get_fake_conf('nvp.ini.grizzly.test') NVP_INI_AGENTLESS_PATH = get_fake_conf('nvp.ini.agentless.test') @@ -173,36 +172,3 @@ class ConfigurationTest(testtools.TestCase): plugin.supported_extension_aliases) self.assertIn('dhcp_agent_scheduler', plugin.supported_extension_aliases) - - -class OldConfigurationTest(testtools.TestCase): - - def setUp(self): - super(OldConfigurationTest, self).setUp() - self.addCleanup(cfg.CONF.reset) - self.useFixture(fixtures.MonkeyPatch( - 'neutron.manager.NeutronManager._instance', - None)) - # Avoid runs of the synchronizer looping call - patch_sync = mock.patch.object(sync, '_start_loopingcall') - patch_sync.start() - self.addCleanup(patch_sync.stop) - - def _assert_required_options(self, cluster): - self.assertEqual(cluster.nvp_controllers, ['fake_1:443', 'fake_2:443']) - self.assertEqual(cluster.default_tz_uuid, 'fake_tz_uuid') - self.assertEqual(cluster.nvp_user, 'foo') - self.assertEqual(cluster.nvp_password, 'bar') - - def test_load_plugin_with_deprecated_options(self): - q_config.parse(['--config-file', BASE_CONF_PATH, - '--config-file', NVP_INI_DEPR_PATH]) - cfg.CONF.set_override('core_plugin', PLUGIN_NAME) - plugin = NeutronManager().get_plugin() - cluster = plugin.cluster - self._assert_required_options(cluster) - # Verify nvp_controller_connection has been fully parsed - self.assertEqual(4, cluster.req_timeout) - self.assertEqual(3, cluster.http_timeout) - self.assertEqual(2, cluster.retries) - self.assertEqual(1, cluster.redirects)