Fix wrong package name of networking-mlnx

This change ensures python3- package is used instead of python-
package, because python- package is no longer available since default
python in distros switched to Python 3.

Closes-Bug: #1968476
Change-Id: Iec165853471ce0e0bdc07df14983846f489d64d6
This commit is contained in:
Takashi Kajinami 2022-04-10 23:24:48 +09:00
parent 38f1a2e250
commit db295da3d6
5 changed files with 39 additions and 36 deletions

View File

@ -77,9 +77,9 @@ class neutron::agents::ml2::mlnx (
include neutron::deps
include neutron::params
$mlnx_agent_package = $::neutron::params::mlnx_agent_package
$mlnx_agent_service = $::neutron::params::mlnx_agent_service
$eswitchd_service = $::neutron::params::eswitchd_service
$mlnx_agent_package = $::neutron::params::mlnx_agent_package
$mlnx_agent_service = $::neutron::params::mlnx_agent_service
$eswitchd_service = $::neutron::params::eswitchd_service
neutron_mlnx_agent_config {
'eswitch/physical_interface_mappings': value => pick(join(any2array($physical_interface_mappings), ','), $::os_service_default);
@ -108,10 +108,15 @@ class neutron::agents::ml2::mlnx (
}
if $manage_package {
package { $mlnx_agent_package:
ensure_packages($mlnx_agent_package, {
ensure => $package_ensure,
tag => ['openstack', 'neutron-package'],
}
tag => ['openstack'],
})
# NOTE(tkajinam): CentOS/RHEL uses the same package for both agent and
# plugin. This is required to avoid conflict with
# neutron::plugins::ml2::mellanox
Package<| title == $mlnx_agent_package |> { tag +> 'neutron-package' }
}
if $manage_service {

View File

@ -31,6 +31,7 @@ class neutron::params {
$user = 'neutron'
$group = 'neutron'
$mlnx_agent_package = 'python3-networking-mlnx'
$mlnx_plugin_package = 'python3-networking-mlnx'
$eswitchd_service = 'eswitchd'
if($::osfamily == 'Redhat') {

View File

@ -24,10 +24,15 @@ class neutron::plugins::ml2::mellanox (
fail("Unsupported osfamily ${::osfamily}")
}
ensure_resource('package', 'python-networking-mlnx',
{
ensure => $package_ensure,
tag => ['openstack', 'neutron-plugin-ml2-package']
}
)
$mlnx_plugin_package = $::neutron::params::mlnx_plugin_package
ensure_packages($mlnx_plugin_package, {
ensure => $package_ensure,
tag => ['openstack'],
})
# NOTE(tkajinam): CentOS/RHEL uses the same package for both agent and
# plugin. This is required to avoid conflict with
# neutron::agens::ml2::mlnx
Package<| title == $mlnx_plugin_package |> { tag +> 'neutron-plugin-ml2-package' }
}

View File

@ -5,22 +5,11 @@ describe 'neutron::agents::ml2::mlnx' do
"class { 'neutron': }"
end
let :default_params do
{
:package_ensure => 'present',
:enabled => true,
}
end
let :params do
{}
end
shared_examples 'neutron mlnx agent with ml2 plugin' do
let :p do
default_params.merge(params)
end
it { should contain_class('neutron::params') }
@ -32,7 +21,7 @@ describe 'neutron::agents::ml2::mlnx' do
it 'installs neutron mlnx agent package' do
should contain_package(platform_params[:mlnx_agent_package]).with(
:name => platform_params[:mlnx_agent_package],
:ensure => p[:package_ensure],
:ensure => 'installed',
:tag => ['openstack', 'neutron-package'],
)
should contain_package(platform_params[:mlnx_agent_package]).that_requires('Anchor[neutron::install::begin]')

View File

@ -11,26 +11,16 @@ describe 'neutron::plugins::ml2::mellanox' do
}"
end
let :default_params do
{
:package_ensure => 'present'
}
end
let :params do
{}
end
shared_examples 'neutron plugin mellanox ml2' do
before do
params.merge!(default_params)
end
it { should contain_class('neutron::params') }
it 'should have' do
should contain_package('python-networking-mlnx').with(
:ensure => params[:package_ensure],
should contain_package(platform_params[:mlnx_plugin_package]).with(
:ensure => 'installed',
:tag => ['openstack', 'neutron-plugin-ml2-package']
)
end
@ -44,6 +34,19 @@ describe 'neutron::plugins::ml2::mellanox' do
facts.merge!(OSDefaults.get_facts())
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:mlnx_plugin_package => 'python3-networking-mlnx',
}
when 'RedHat'
{
:mlnx_plugin_package => 'python3-networking-mlnx',
}
end
end
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron plugin mellanox ml2'
end