Merge "Replace vnic_type_blacklist by vnic_type_prohibit_list"

This commit is contained in:
Zuul 2021-02-23 22:53:23 +00:00 committed by Gerrit Code Review
commit 04a50582f3
5 changed files with 67 additions and 22 deletions

View File

@ -14,23 +14,43 @@
#
# === Parameters:
#
# [*vnic_type_blacklist*]
# [*vnic_type_prohibit_list*]
# (optional) list of VNIC types for which support in Neutron is
# administratively prohibited by the OVS mechanism driver
# Defaults to []
#
# DEPRECATED PARAMETERS
#
# [*vnic_type_blacklist*]
# (optional) list of VNIC types for which support in Neutron is
# administratively prohibited by the OVS mechanism driver
# Defaults to undef
#
class neutron::plugins::ml2::ovs_driver (
$vnic_type_blacklist = [],
$vnic_type_prohibit_list = [],
# DEPRECATED PARAMETERS
$vnic_type_blacklist = undef,
){
validate_legacy(Array, 'validate_array', $vnic_type_blacklist)
if !empty($vnic_type_blacklist) {
if $vnic_type_blacklist != undef {
warning('The vnic_type_blacklist parameter is deprecated. Use vnic_type_prohibit_list instead')
$vnic_type_prohibit_list_real = $vnic_type_blacklist
} else {
$vnic_type_prohibit_list_real = $vnic_type_prohibit_list
}
validate_legacy(Array, 'validate_array', $vnic_type_prohibit_list_real)
if !empty($vnic_type_prohibit_list_real) {
neutron_plugin_ml2 {
'ovs_driver/vnic_type_blacklist': value => join(any2array($vnic_type_blacklist), ',');
'ovs_driver/vnic_type_prohibit_list': value => join(any2array($vnic_type_prohibit_list_real), ',');
}
} else {
neutron_plugin_ml2 {
'ovs_driver/vnic_type_blacklist': value => $::os_service_default;
'ovs_driver/vnic_type_prohibit_list': value => $::os_service_default;
}
}
neutron_plugin_ml2 {
'ovs_driver/vnic_type_blacklist': ensure => absent;
}
}

View File

@ -14,23 +14,43 @@
#
# === Parameters:
#
# [*vnic_type_blacklist*]
# [*vnic_type_prohibit_list*]
# (optional) list of VNIC types for which support in Neutron is
# administratively prohibited by the SRIOV mechanism driver
# Defaults to []
#
# DEPRECATED PARAMETERS
#
# [*vnic_type_blacklist*]
# (optional) list of VNIC types for which support in Neutron is
# administratively prohibited by the OVS mechanism driver
# Defaults to undef
#
class neutron::plugins::ml2::sriov_driver (
$vnic_type_blacklist= [],
$vnic_type_prohibit_list = [],
# DEPRECATED PARAMETERS
$vnic_type_blacklist = undef,
){
validate_legacy(Array, 'validate_array', $vnic_type_blacklist)
if !empty($vnic_type_blacklist) {
if $vnic_type_blacklist != undef {
warning('The vnic_type_blacklist parameter is deprecated. Use vnic_type_prohibit_list instead')
$vnic_type_prohibit_list_real = $vnic_type_blacklist
} else {
$vnic_type_prohibit_list_real = $vnic_type_prohibit_list
}
validate_legacy(Array, 'validate_array', $vnic_type_prohibit_list_real)
if !empty($vnic_type_prohibit_list_real) {
neutron_plugin_ml2 {
'sriov_driver/vnic_type_blacklist': value => join(any2array($vnic_type_blacklist), ',');
'sriov_driver/vnic_type_prohibit_list': value => join(any2array($vnic_type_prohibit_list_real), ',');
}
} else {
neutron_plugin_ml2 {
'sriov_driver/vnic_type_blacklist': value => $::os_service_default;
'sriov_driver/vnic_type_prohibit_list': value => $::os_service_default;
}
}
neutron_plugin_ml2 {
'sriov_driver/vnic_type_blacklist': ensure => absent;
}
}

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The ``vnic_type_blacklist`` parameter has been deprecated. Use the
``vnic_type_prohibit_list`` parameter instead.

View File

@ -23,17 +23,17 @@ describe 'neutron::plugins::ml2::ovs_driver' do
end
it 'should set the default values' do
should contain_neutron_plugin_ml2('ovs_driver/vnic_type_blacklist').with_value("<SERVICE DEFAULT>")
should contain_neutron_plugin_ml2('ovs_driver/vnic_type_prohibit_list').with_value("<SERVICE DEFAULT>")
end
end
context 'when vnic_type_blacklist is not empty list' do
context 'when vnic_type_prohibit_list is not empty list' do
let :params do
{ :vnic_type_blacklist => ['direct'] }
{ :vnic_type_prohibit_list => ['direct'] }
end
it 'should configure direct in vnic_type_blacklist' do
should contain_neutron_plugin_ml2('ovs_driver/vnic_type_blacklist').with_value("direct")
it 'should configure direct in vnic_type_prohibit_list' do
should contain_neutron_plugin_ml2('ovs_driver/vnic_type_prohibit_list').with_value("direct")
end
end
end

View File

@ -23,17 +23,17 @@ describe 'neutron::plugins::ml2::sriov_driver' do
end
it 'should set the default values' do
should contain_neutron_plugin_ml2('sriov_driver/vnic_type_blacklist').with_value("<SERVICE DEFAULT>")
should contain_neutron_plugin_ml2('sriov_driver/vnic_type_prohibit_list').with_value("<SERVICE DEFAULT>")
end
end
context 'when vnic_type_blacklist is not empty list' do
context 'when vnic_type_prohibit_list is not empty list' do
let :params do
{ :vnic_type_blacklist => ['direct'] }
{ :vnic_type_prohibit_list => ['direct'] }
end
it 'should configure direct in vnic_type_blacklist' do
should contain_neutron_plugin_ml2('sriov_driver/vnic_type_blacklist').with_value("direct")
it 'should configure direct in vnic_type_prohibit_list' do
should contain_neutron_plugin_ml2('sriov_driver/vnic_type_prohibit_list').with_value("direct")
end
end
end