From 4117660c384e703554b80a3a0599fc1911d173f5 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 10 Apr 2022 19:46:22 +0900 Subject: [PATCH] Remove support for the Nicira NVP plugin ... because it was deprecated during the past cycle[1]. [1] b341a88c4ab04dd3f4a4b47a1ab6cb66e1066fd9 Change-Id: I5c6ddc3ab9c0dc693652386989916d6ec3db4518 --- .../neutron_plugin_nvp/ini_setting.rb | 15 --- lib/puppet/type/neutron_plugin_nvp.rb | 52 -------- manifests/config.pp | 17 ++- manifests/deps.pp | 1 - manifests/init.pp | 4 +- manifests/params.pp | 2 - manifests/plugins/nvp.pp | 83 ------------ .../remove-nvp-plugin-3a0ed429ef9172fc.yaml | 9 ++ spec/acceptance/neutron_config_spec.rb | 22 ---- spec/classes/neutron_config_spec.rb | 7 - spec/classes/neutron_plugins_nvp_spec.rb | 121 ------------------ .../neutron_plugin_nvp/ini_setting_spec.rb | 51 -------- spec/unit/type/neutron_plugin_nvp_spec.rb | 20 --- 13 files changed, 22 insertions(+), 382 deletions(-) delete mode 100644 lib/puppet/provider/neutron_plugin_nvp/ini_setting.rb delete mode 100644 lib/puppet/type/neutron_plugin_nvp.rb delete mode 100644 manifests/plugins/nvp.pp create mode 100644 releasenotes/notes/remove-nvp-plugin-3a0ed429ef9172fc.yaml delete mode 100644 spec/classes/neutron_plugins_nvp_spec.rb delete mode 100644 spec/unit/provider/neutron_plugin_nvp/ini_setting_spec.rb delete mode 100644 spec/unit/type/neutron_plugin_nvp_spec.rb diff --git a/lib/puppet/provider/neutron_plugin_nvp/ini_setting.rb b/lib/puppet/provider/neutron_plugin_nvp/ini_setting.rb deleted file mode 100644 index 1b0eae8a4..000000000 --- a/lib/puppet/provider/neutron_plugin_nvp/ini_setting.rb +++ /dev/null @@ -1,15 +0,0 @@ -Puppet::Type.type(:neutron_plugin_nvp).provide( - :ini_setting, - :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) -) do - - def self.file_path - '/etc/neutron/plugins/nicira/nvp.ini' - end - - # added for backwards compatibility with older versions of inifile - def file_path - self.class.file_path - end - -end diff --git a/lib/puppet/type/neutron_plugin_nvp.rb b/lib/puppet/type/neutron_plugin_nvp.rb deleted file mode 100644 index ac5065a03..000000000 --- a/lib/puppet/type/neutron_plugin_nvp.rb +++ /dev/null @@ -1,52 +0,0 @@ -Puppet::Type.newtype(:neutron_plugin_nvp) do - - ensurable - - newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from nvp.ini' - newvalues(/\S+\/\S+/) - end - - newproperty(:value) do - desc 'The value of the setting to be defined.' - munge do |value| - value = value.to_s.strip - value.capitalize! if value =~ /^(true|false)$/i - value - end - - def is_to_s( currentvalue ) - if resource.secret? - return '[old secret redacted]' - else - return currentvalue - end - end - - def should_to_s( newvalue ) - if resource.secret? - return '[new secret redacted]' - else - return newvalue - end - end - end - - newparam(:secret, :boolean => true) do - desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' - - newvalues(:true, :false) - - defaultto false - end - - newparam(:ensure_absent_val) do - desc 'A value that is specified as the value property will behave as if ensure => absent was specified' - defaultto('') - end - - autorequire(:anchor) do - ['neutron::install::end'] - end - -end diff --git a/manifests/config.pp b/manifests/config.pp index 8dcb4a7ff..bf9ea5aaf 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -72,9 +72,6 @@ # [*plugin_linuxbridge_config*] # (optional) Manage configuration of linuxbridge_conf.ini # -# [*plugin_nvp_config*] -# (optional) Manage configuration of /etc/neutron/plugins/nicira/nvp.ini -# # [*plugin_opencontrail_config*] # (optional) Manage configuration of plugins/opencontrail/ContrailPlugin.ini # @@ -87,6 +84,11 @@ # [*plugin_nsx_config*] # (optional) Manage configuration of plugins/vmware/nsx.ini # +# DEPRECATED PRAMETERS +# +# [*plugin_nvp_config*] +# (optional) Manage configuration of /etc/neutron/plugins/nicira/nvp.ini +# # NOTE: The configuration MUST NOT be already handled by this module # or Puppet catalog compilation will fail with duplicate resources. # @@ -112,11 +114,16 @@ class neutron::config ( $plugin_nuage_config = {}, $plugin_ml2_config = {}, $plugin_nsx_config = {}, - $plugin_nvp_config = {}, + # DEPRECATED PARAMETERS + $plugin_nvp_config = undef, ) { include neutron::deps + if $plugin_nvp_config != undef { + warning('The plugin_nvp_config parameter is deprecated and has no effect.') + } + validate_legacy(Hash, 'validate_hash', $server_config) validate_legacy(Hash, 'validate_hash', $api_paste_ini) validate_legacy(Hash, 'validate_hash', $ovs_agent_config) @@ -138,7 +145,6 @@ class neutron::config ( validate_legacy(Hash, 'validate_hash', $plugin_nuage_config) validate_legacy(Hash, 'validate_hash', $plugin_ml2_config) validate_legacy(Hash, 'validate_hash', $plugin_nsx_config) - validate_legacy(Hash, 'validate_hash', $plugin_nvp_config) create_resources('neutron_config', $server_config) create_resources('neutron_api_paste_ini', $api_paste_ini) @@ -160,6 +166,5 @@ class neutron::config ( create_resources('neutron_plugin_ml2', $plugin_ml2_config) create_resources('neutron_l2gw_service_config', $l2gw_service_config) create_resources('neutron_plugin_nsx', $plugin_nsx_config) - create_resources('neutron_plugin_nvp', $plugin_nvp_config) create_resources('ovn_metadata_agent_config', $ovn_metadata_agent_config) } diff --git a/manifests/deps.pp b/manifests/deps.pp index e7f92a1e1..6506da3b0 100644 --- a/manifests/deps.pp +++ b/manifests/deps.pp @@ -51,7 +51,6 @@ class neutron::deps { Anchor['neutron::config::begin'] -> Neutron_l2gw_service_config<||> ~> Anchor['neutron::config::end'] Anchor['neutron::config::begin'] -> Neutron_plugin_ml2<||> ~> Anchor['neutron::config::end'] Anchor['neutron::config::begin'] -> Neutron_plugin_nuage<||> ~> Anchor['neutron::config::end'] - Anchor['neutron::config::begin'] -> Neutron_plugin_nvp<||> ~> Anchor['neutron::config::end'] Anchor['neutron::config::begin'] -> Neutron_plugin_opencontrail<||> ~> Anchor['neutron::config::end'] Anchor['neutron::config::begin'] -> Neutron_plugin_sriov<||> ~> Anchor['neutron::config::end'] Anchor['neutron::config::begin'] -> Neutron_sriov_agent_config<||> ~> Anchor['neutron::config::end'] diff --git a/manifests/init.pp b/manifests/init.pp index 506266485..d8ff9fb9d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,8 +24,8 @@ # [*core_plugin*] # (optional) Neutron plugin provider # Defaults to ml2 -# Could be bigswitch, brocade, embrane, hyperv, ml2, mlnx, nec, nicira, ryu, -# nuage, opencontrail, nsx +# Could be bigswitch, brocade, embrane, hyperv, ml2, mlnx, nec, ryu, nuage, +# opencontrail, nsx # # Example for nuage: # diff --git a/manifests/params.pp b/manifests/params.pp index e0e61a168..19a33800b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -53,7 +53,6 @@ class neutron::params { $bigswitch_agent_package = 'openstack-neutron-bigswitch-agent' $bigswitch_lldp_service = 'neutron-bsn-lldp' $bigswitch_agent_service = 'neutron-bsn-agent' - $nvp_server_package = 'openstack-neutron-nicira' $dhcp_agent_package = false $metering_agent_package = 'openstack-neutron-metering-agent' $vpnaas_agent_package = 'openstack-neutron-vpnaas' @@ -102,7 +101,6 @@ class neutron::params { $linuxbridge_server_package = 'neutron-plugin-linuxbridge' $sriov_nic_agent_service = 'neutron-sriov-agent' $sriov_nic_agent_package = 'neutron-sriov-agent' - $nvp_server_package = 'neutron-plugin-nicira' $dhcp_agent_package = 'neutron-dhcp-agent' $metering_agent_package = 'neutron-metering-agent' $vpnaas_agent_package = 'python3-neutron-vpnaas' diff --git a/manifests/plugins/nvp.pp b/manifests/plugins/nvp.pp deleted file mode 100644 index 5ae554d4b..000000000 --- a/manifests/plugins/nvp.pp +++ /dev/null @@ -1,83 +0,0 @@ -# DEPRECAED !! -# Configure the Nicira NVP plugin for neutron. -# -# === Parameters -# -# [*nvp_controllers*] -# The password for connection to VMware vCenter server. -# -# [*nvp_user*] -# The user name for NVP controller. -# -# [*nvp_password*] -# The password for NVP controller -# -# [*default_tz_uuid*] -# UUID of the pre-existing default NVP Transport zone to be used for creating -# tunneled isolated "Neutron" networks. This option MUST be specified. -# -# [*default_l3_gw_service_uuid*] -# (Optional) UUID for the default l3 gateway service to use with this cluster. -# To be specified if planning to use logical routers with external gateways. -# Defaults to $::os_service_default. -# -# [*package_ensure*] -# (optional) Ensure state for package. -# Defaults to 'present'. -# -# [*purge_config*] -# (optional) Whether to set only the specified config options -# in the nvp config. -# Defaults to false. -# -class neutron::plugins::nvp ( - $default_tz_uuid, - $nvp_controllers, - $nvp_user, - $nvp_password, - $default_l3_gw_service_uuid = $::os_service_default, - $package_ensure = 'present', - $purge_config = false, -) { - - include neutron::deps - include neutron::params - - warning('Support for the Nicira NVP plugin has been deprecated') - - Package['neutron'] -> Package['neutron-plugin-nvp'] - - package { 'neutron-plugin-nvp': - ensure => $package_ensure, - name => $::neutron::params::nvp_server_package, - tag => ['openstack', 'neutron-package'], - } - - validate_legacy(Array, 'validate_array', $nvp_controllers) - - resources { 'neutron_plugin_nvp': - purge => $purge_config, - } - - neutron_plugin_nvp { - 'DEFAULT/default_tz_uuid': value => $default_tz_uuid; - 'DEFAULT/nvp_controllers': value => join($nvp_controllers, ','); - 'DEFAULT/nvp_user': value => $nvp_user; - 'DEFAULT/nvp_password': value => $nvp_password, secret => true; - 'DEFAULT/default_l3_gw_service_uuid': value => $default_l3_gw_service_uuid; - 'nvp/metadata_mode': value => 'access_network'; - } - - if $::neutron::core_plugin != 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2' { - fail('nvp plugin should be the core_plugin in neutron.conf') - } - - # In RH, this link is used to start Neutron process but in Debian, it's used only - # to manage database synchronization. - file {'/etc/neutron/plugin.ini': - ensure => link, - target => '/etc/neutron/plugins/nicira/nvp.ini', - tag => 'neutron-config-file', - } - -} diff --git a/releasenotes/notes/remove-nvp-plugin-3a0ed429ef9172fc.yaml b/releasenotes/notes/remove-nvp-plugin-3a0ed429ef9172fc.yaml new file mode 100644 index 000000000..19b9829ab --- /dev/null +++ b/releasenotes/notes/remove-nvp-plugin-3a0ed429ef9172fc.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - | + Support for the Nicira NVP plugin has been removed. + +deprecations: + - | + The ``neutron::config::plugin_nvp_config`` parameter has been deprecated + and has no effect. diff --git a/spec/acceptance/neutron_config_spec.rb b/spec/acceptance/neutron_config_spec.rb index 433f2cf48..f0ce5bb40 100644 --- a/spec/acceptance/neutron_config_spec.rb +++ b/spec/acceptance/neutron_config_spec.rb @@ -12,7 +12,6 @@ describe 'basic neutron_config resource' do '/etc/neutron/l2gateway_agent.ini', '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini', '/etc/neutron/plugins/ml2/ml2_conf.ini', - '/etc/neutron/plugins/nicira/nvp.ini', '/etc/neutron/vpn_agent.ini', '/etc/neutron/plugins/opencontrail/ContrailPlugin.ini', '/etc/neutron/plugins/vmware/nsx.ini', @@ -31,7 +30,6 @@ describe 'basic neutron_config resource' do File <||> -> Neutron_metering_agent_config <||> File <||> -> Neutron_plugin_linuxbridge <||> File <||> -> Neutron_plugin_ml2 <||> - File <||> -> Neutron_plugin_nvp <||> File <||> -> Neutron_l2gw_service_config <||> File <||> -> Neutron_vpnaas_agent_config <||> File <||> -> Neutron_plugin_opencontrail <||> @@ -62,7 +60,6 @@ describe 'basic neutron_config resource' do '/etc/neutron/l2gateway_agent.ini', '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini', '/etc/neutron/plugins/ml2/ml2_conf.ini', - '/etc/neutron/plugins/nicira/nvp.ini', '/etc/neutron/vpn_agent.ini', '/etc/neutron/plugins/opencontrail/ContrailPlugin.ini', '/etc/neutron/plugins/vmware/nsx.ini', @@ -221,24 +218,6 @@ describe 'basic neutron_config resource' do ensure_absent_val => 'toto', } - neutron_plugin_nvp { 'DEFAULT/thisshouldexist' : - value => 'foo', - } - - neutron_plugin_nvp { 'DEFAULT/thisshouldnotexist' : - value => '', - } - - neutron_plugin_nvp { 'DEFAULT/thisshouldexist2' : - value => '', - ensure_absent_val => 'toto', - } - - neutron_plugin_nvp { 'DEFAULT/thisshouldnotexist2' : - value => 'toto', - ensure_absent_val => 'toto', - } - neutron_vpnaas_agent_config { 'DEFAULT/thisshouldexist' : value => 'foo', } @@ -429,7 +408,6 @@ describe 'basic neutron_config resource' do 'neutron_plugin_linuxbridge', 'neutron_metering_agent_config', 'neutron_plugin_ml2', - 'neutron_plugin_nvp', 'neutron_vpnaas_agent_config', 'neutron_plugin_opencontrail', 'neutron_agent_linuxbridge', diff --git a/spec/classes/neutron_config_spec.rb b/spec/classes/neutron_config_spec.rb index e302758d8..7a7cbf052 100644 --- a/spec/classes/neutron_config_spec.rb +++ b/spec/classes/neutron_config_spec.rb @@ -129,7 +129,6 @@ describe 'neutron::config' do { :plugin_linuxbridge_config => config_hash, :plugin_nsx_config => config_hash, - :plugin_nvp_config => config_hash, :plugin_opencontrail_config => config_hash, :plugin_nuage_config => config_hash, :plugin_ml2_config => config_hash @@ -148,12 +147,6 @@ describe 'neutron::config' do should contain_neutron_plugin_nsx('DEFAULT/baz').with_ensure('absent') end - it 'configures arbitrary neutron_plugin_nvp configurations' do - should contain_neutron_plugin_nvp('DEFAULT/foo').with_value('fooValue') - should contain_neutron_plugin_nvp('DEFAULT/bar').with_value('barValue') - should contain_neutron_plugin_nvp('DEFAULT/baz').with_ensure('absent') - end - it 'configures arbitrary neutron_plugin_opencontrail configurations' do should contain_neutron_plugin_opencontrail('DEFAULT/foo').with_value('fooValue') should contain_neutron_plugin_opencontrail('DEFAULT/bar').with_value('barValue') diff --git a/spec/classes/neutron_plugins_nvp_spec.rb b/spec/classes/neutron_plugins_nvp_spec.rb deleted file mode 100644 index fe250c3cd..000000000 --- a/spec/classes/neutron_plugins_nvp_spec.rb +++ /dev/null @@ -1,121 +0,0 @@ -require 'spec_helper' - -describe 'neutron::plugins::nvp' do - let :pre_condition do - "class { 'neutron': - core_plugin => 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2' - }" - end - - let :default_params do - { - :metadata_mode => 'access_network', - :package_ensure => 'present', - :purge_config => false, - } - end - - let :params do - { - :default_tz_uuid => '0344130f-1add-4e86-b36e-ad1c44fe40dc', - :nvp_controllers => %w(10.0.0.1 10.0.0.2), - :nvp_user => 'admin', - :nvp_password => 'password' - } - end - - let :optional_params do - { - :default_l3_gw_service_uuid => '0344130f-1add-4e86-b36e-ad1c44fe40dc' - } - end - - shared_examples 'neutron plugin nvp' do - let :p do - default_params.merge(params) - end - - it { should contain_class('neutron::params') } - - it 'should have' do - should contain_package('neutron-plugin-nvp').with( - :name => platform_params[:nvp_server_package], - :ensure => p[:package_ensure], - :tag => ['openstack', 'neutron-package'], - ) - end - - it 'should configure neutron.conf' do - should contain_neutron_config('DEFAULT/core_plugin').with_value('neutron.plugins.nicira.NeutronPlugin.NvpPluginV2') - end - - it 'should create plugin symbolic link' do - should contain_file('/etc/neutron/plugin.ini').with( - :ensure => 'link', - :target => '/etc/neutron/plugins/nicira/nvp.ini', - ) - should contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]') - should contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]') - end - - it 'passes purge to resource' do - should contain_resources('neutron_plugin_nvp').with({ - :purge => false - }) - end - - it 'should configure nvp.ini' do - should contain_neutron_plugin_nvp('DEFAULT/default_tz_uuid').with_value(p[:default_tz_uuid]) - should contain_neutron_plugin_nvp('nvp/metadata_mode').with_value(p[:metadata_mode]) - should contain_neutron_plugin_nvp('DEFAULT/nvp_controllers').with_value(p[:nvp_controllers].join(',')) - should contain_neutron_plugin_nvp('DEFAULT/nvp_user').with_value(p[:nvp_user]) - should contain_neutron_plugin_nvp('DEFAULT/nvp_password').with_value(p[:nvp_password]) - should contain_neutron_plugin_nvp('DEFAULT/nvp_password').with_secret( true ) - should_not contain_neutron_plugin_nvp('DEFAULT/default_l3_gw_service_uuid').with_value(p[:default_l3_gw_service_uuid]) - end - - context 'configure nvp with optional params' do - before :each do - params.merge!(optional_params) - end - - it 'should configure nvp.ini' do - should contain_neutron_plugin_nvp('DEFAULT/default_l3_gw_service_uuid').with_value(params[:default_l3_gw_service_uuid]) - end - end - - context 'configure nvp with wrong core_plugin configure' do - let :pre_condition do - "class { 'neutron': - core_plugin => 'foo' }" - end - - it { should raise_error(Puppet::Error, /nvp plugin should be the core_plugin in neutron.conf/) } - end - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - let (:facts) do - facts.merge!(OSDefaults.get_facts()) - end - - let (:platform_params) do - case facts[:osfamily] - when 'Debian' - { - :nvp_server_package => 'neutron-plugin-nicira' - } - when 'RedHat' - { - :nvp_server_package => 'openstack-neutron-nicira' - } - end - end - - it_behaves_like 'neutron plugin nvp' - end - end -end diff --git a/spec/unit/provider/neutron_plugin_nvp/ini_setting_spec.rb b/spec/unit/provider/neutron_plugin_nvp/ini_setting_spec.rb deleted file mode 100644 index c7dfa050f..000000000 --- a/spec/unit/provider/neutron_plugin_nvp/ini_setting_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'spec_helper' - -provider_class = Puppet::Type.type(:neutron_plugin_nvp).provider(:ini_setting) - -describe provider_class do - - it 'should default to the default setting when no other one is specified' do - resource = Puppet::Type::Neutron_plugin_nvp.new( - { - :name => 'DEFAULT/foo', - :value => 'bar' - } - ) - provider = provider_class.new(resource) - expect(provider.section).to eq('DEFAULT') - expect(provider.setting).to eq('foo') - expect(provider.file_path).to eq('/etc/neutron/plugins/nicira/nvp.ini') - end - - it 'should allow setting to be set explicitly' do - resource = Puppet::Type::Neutron_plugin_nvp.new( - { - :name => 'dude/foo', - :value => 'bar' - } - ) - provider = provider_class.new(resource) - expect(provider.section).to eq('dude') - expect(provider.setting).to eq('foo') - expect(provider.file_path).to eq('/etc/neutron/plugins/nicira/nvp.ini') - end - - it 'should ensure absent when is specified as a value' do - resource = Puppet::Type::Neutron_plugin_nvp.new( - {:name => 'dude/foo', :value => ''} - ) - provider = provider_class.new(resource) - provider.exists? - expect(resource[:ensure]).to eq :absent - end - - it 'should ensure absent when value matches ensure_absent_val' do - resource = Puppet::Type::Neutron_plugin_nvp.new( - {:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' } - ) - provider = provider_class.new(resource) - provider.exists? - expect(resource[:ensure]).to eq :absent - end - -end diff --git a/spec/unit/type/neutron_plugin_nvp_spec.rb b/spec/unit/type/neutron_plugin_nvp_spec.rb deleted file mode 100644 index 7300b1845..000000000 --- a/spec/unit/type/neutron_plugin_nvp_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'puppet' -require 'puppet/type/neutron_plugin_nvp' - -describe 'Puppet::Type.type(:neutron_plugin_nvp)' do - - before :each do - @neutron_plugin_nvp = Puppet::Type.type(:neutron_plugin_nvp).new(:name => 'DEFAULT/foo', :value => 'bar') - end - - it 'should autorequire the package that install the file' do - catalog = Puppet::Resource::Catalog.new - anchor = Puppet::Type.type(:anchor).new(:name => 'neutron::install::end') - catalog.add_resource anchor, @neutron_plugin_nvp - dependency = @neutron_plugin_nvp.autorequire - expect(dependency.size).to eq(1) - expect(dependency[0].target).to eq(@neutron_plugin_nvp) - expect(dependency[0].source).to eq(anchor) - end - -end