networking-mlnx: Support Debian and Ubuntu

The networking-mlnx plugin is already packaged for Debian and Ubuntu.
This change adds support for these two distros in addition to RedHat
family(RHEL and CentOS) which is already supported.

Change-Id: I3e93e480b1f6a8bbb61c18a1c24256b6d810662e
This commit is contained in:
Takashi Kajinami
2022-04-11 00:51:29 +09:00
parent db295da3d6
commit 6419777096
6 changed files with 47 additions and 22 deletions

View File

@@ -79,6 +79,7 @@ class neutron::agents::ml2::mlnx (
$mlnx_agent_package = $::neutron::params::mlnx_agent_package
$mlnx_agent_service = $::neutron::params::mlnx_agent_service
$eswitchd_package = $::neutron::params::eswitchd_package
$eswitchd_service = $::neutron::params::eswitchd_service
neutron_mlnx_agent_config {
@@ -117,6 +118,15 @@ class neutron::agents::ml2::mlnx (
# plugin. This is required to avoid conflict with
# neutron::plugins::ml2::mellanox
Package<| title == $mlnx_agent_package |> { tag +> 'neutron-package' }
# NOTE(tkajinam): Ubuntu/Debuan requires a separate package for eswitchd
# service.
if $eswitchd_package {
ensure_packages($eswitchd_package, {
ensure => $package_ensure,
tag => ['openstack', 'neutron-package'],
})
}
}
if $manage_service {

View File

@@ -30,9 +30,6 @@ class neutron::params {
$sfc_package = 'python3-networking-sfc'
$user = 'neutron'
$group = 'neutron'
$mlnx_agent_package = 'python3-networking-mlnx'
$mlnx_plugin_package = 'python3-networking-mlnx'
$eswitchd_service = 'eswitchd'
if($::osfamily == 'Redhat') {
$package_name = 'openstack-neutron'
@@ -73,7 +70,11 @@ class neutron::params {
$networking_baremetal_agent_package = 'python3-ironic-neutron-agent'
$networking_baremetal_agent_service = 'ironic-neutron-agent'
$networking_ansible_package = 'python3-networking-ansible'
$mlnx_agent_package = 'python3-networking-mlnx'
$mlnx_plugin_package = 'python3-networking-mlnx'
$eswitchd_package = false
$mlnx_agent_service = 'neutron-mlnx-agent'
$eswitchd_service = 'eswitchd'
} elsif($::osfamily == 'Debian') {
$package_name = 'neutron-common'
if $::operatingsystem == 'Debian' {
@@ -119,7 +120,11 @@ class neutron::params {
$networking_baremetal_package = 'python3-ironic-neutron-agent'
$networking_baremetal_agent_package = 'ironic-neutron-agent'
$networking_baremetal_agent_service = 'ironic-neutron-agent'
$mlnx_agent_service = 'neutron-plugin-mlnx-agent'
$mlnx_agent_package = 'neutron-mlnx-agent'
$mlnx_plugin_package = 'python3-networking-mlnx'
$eswitchd_package = 'networking-mlnx-eswitchd'
$mlnx_agent_service = 'neutron-mlnx-agent'
$eswitchd_service = 'networking-mlnx-eswitchd'
} else {
fail("Unsupported osfamily ${::osfamily}")
}

View File

@@ -19,11 +19,6 @@ class neutron::plugins::ml2::mellanox (
include neutron::params
require neutron::plugins::ml2
if($::osfamily != 'RedHat') {
# Drivers are only packaged for RedHat at this time
fail("Unsupported osfamily ${::osfamily}")
}
$mlnx_plugin_package = $::neutron::params::mlnx_plugin_package
ensure_packages($mlnx_plugin_package, {

View File

@@ -0,0 +1,5 @@
---
features:
- |
Now this module supports configuring the ``networking-mlnx`` plugin in
Debian and Ubuntu.

View File

@@ -24,8 +24,14 @@ describe 'neutron::agents::ml2::mlnx' do
:ensure => 'installed',
:tag => ['openstack', 'neutron-package'],
)
should contain_package(platform_params[:mlnx_agent_package]).that_requires('Anchor[neutron::install::begin]')
should contain_package(platform_params[:mlnx_agent_package]).that_notifies('Anchor[neutron::install::end]')
if platform_params[:eswitchd_package]
should contain_package(platform_params[:eswitchd_package]).with(
:name => platform_params[:eswitchd_package],
:ensure => 'installed',
:tag => ['openstack', 'neutron-package'],
)
end
end
it 'configures neutron mlnx agent service' do
@@ -35,10 +41,12 @@ describe 'neutron::agents::ml2::mlnx' do
:ensure => 'running',
:tag => 'neutron-service',
)
should contain_service(platform_params[:mlnx_agent_service]).that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service(platform_params[:mlnx_agent_service]).that_notifies('Anchor[neutron::service::end]')
should contain_service('eswitchd').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('eswitchd').that_notifies('Anchor[neutron::service::end]')
should contain_service(platform_params[:eswitchd_service]).with(
:name => platform_params[:eswitchd_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
end
context 'with manage_service as false' do
@@ -47,7 +55,7 @@ describe 'neutron::agents::ml2::mlnx' do
end
it 'should not manage the services' do
should_not contain_service(platform_params[:mlnx_agent_service])
should_not contain_service('eswitchd')
should_not contain_service(platform_params[:eswitchd_service])
end
end
@@ -101,13 +109,17 @@ describe 'neutron::agents::ml2::mlnx' do
case facts[:osfamily]
when 'Debian'
{
:mlnx_agent_package => 'python3-networking-mlnx',
:mlnx_agent_service => 'neutron-plugin-mlnx-agent'
:mlnx_agent_package => 'neutron-mlnx-agent',
:mlnx_agent_service => 'neutron-mlnx-agent',
:eswitchd_package => 'networking-mlnx-eswitchd',
:eswitchd_service => 'networking-mlnx-eswitchd',
}
when 'RedHat'
{
:mlnx_agent_package => 'python3-networking-mlnx',
:mlnx_agent_service => 'neutron-mlnx-agent'
:mlnx_agent_service => 'neutron-mlnx-agent',
:eswitchd_package => false,
:eswitchd_service => 'eswitchd',
}
end
end

View File

@@ -47,9 +47,7 @@ describe 'neutron::plugins::ml2::mellanox' do
end
end
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron plugin mellanox ml2'
end
it_behaves_like 'neutron plugin mellanox ml2'
end
end
end