Fix the wrong section used to configure standalone network plugin
This change fixes the wrong section used by manila::network::standalone to define the network_plugin_ipvN_enabled parameters. Previously this usage resulted in duplicate resource declaration, and made this resource type unusable. This change also replaces usage of undef by $::os_service_default. These two are effectively same but $::os_service_default is now globally used. Closes-Bug: #1965548 Change-Id: Iedd0805ed815f0507d8fe7b7c91afdb5dfc320be
This commit is contained in:
parent
29940500db
commit
b903e954ed
@ -16,6 +16,7 @@
|
||||
# It will be assigned to share-network and share drivers will be
|
||||
# able to use this for network interfaces within provisioned
|
||||
# share servers. Optional. Example: 1001
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*standalone_network_plugin_allowed_ip_ranges*]
|
||||
# (optional) Can be IP address, range of IP addresses or list of addresses
|
||||
@ -24,32 +25,34 @@
|
||||
# addresses from network can be used. Optional.
|
||||
# Examples: 10.0.0.10 or 10.0.0.10-10.0.0.20 or
|
||||
# 10.0.0.10-10.0.0.20,10.0.0.30-10.0.0.40,10.0.0.50
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*network_plugin_ipv4_enabled*]
|
||||
# (optional) Whether to support Ipv4 network resource
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*network_plugin_ipv6_enabled*]
|
||||
# (optional) whether to support IPv6 network resource
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
define manila::network::standalone (
|
||||
$standalone_network_plugin_gateway,
|
||||
$standalone_network_plugin_mask,
|
||||
$standalone_network_plugin_segmentation_id = undef,
|
||||
$standalone_network_plugin_allowed_ip_ranges = undef,
|
||||
$network_plugin_ipv4_enabled = $::os_service_default,
|
||||
$network_plugin_ipv6_enabled = $::os_service_default,
|
||||
$standalone_network_plugin_segmentation_id = $::os_service_default,
|
||||
$standalone_network_plugin_allowed_ip_ranges = $::os_service_default,
|
||||
$network_plugin_ipv4_enabled = $::os_service_default,
|
||||
$network_plugin_ipv6_enabled = $::os_service_default,
|
||||
) {
|
||||
|
||||
$standalone_plugin_name = 'manila.network.standalone_network_plugin.StandaloneNetworkPlugin'
|
||||
|
||||
manila_config {
|
||||
"${name}/network_api_class": value => $standalone_plugin_name;
|
||||
"${name}/standalone_network_plugin_gateway": value => $standalone_network_plugin_gateway;
|
||||
"${name}/standalone_network_plugin_mask": value => $standalone_network_plugin_mask;
|
||||
"${name}/standalone_network_plugin_segmentation_id": value => $standalone_network_plugin_segmentation_id;
|
||||
"${name}/standalone_network_plugin_allowed_ip_ranges": value => $standalone_network_plugin_allowed_ip_ranges;
|
||||
'DEFAULT/network_plugin_ipv4_enabled': value => $network_plugin_ipv4_enabled;
|
||||
'DEFAULT/network_plugin_ipv6_enabled': value => $network_plugin_ipv6_enabled;
|
||||
|
||||
"${name}/network_api_class": value => $standalone_plugin_name;
|
||||
"${name}/standalone_network_plugin_gateway": value => $standalone_network_plugin_gateway;
|
||||
"${name}/standalone_network_plugin_mask": value => $standalone_network_plugin_mask;
|
||||
"${name}/standalone_network_plugin_segmentation_id": value => $standalone_network_plugin_segmentation_id;
|
||||
"${name}/standalone_network_plugin_allowed_ip_ranges": value => $standalone_network_plugin_allowed_ip_ranges;
|
||||
"${name}/network_plugin_ipv4_enabled": value => $network_plugin_ipv4_enabled;
|
||||
"${name}/network_plugin_ipv6_enabled": value => $network_plugin_ipv6_enabled;
|
||||
}
|
||||
}
|
||||
|
@ -5,38 +5,52 @@ describe 'manila::network::standalone' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:standalone_network_plugin_gateway => '192.168.1.1',
|
||||
:standalone_network_plugin_mask => '255.255.255.0',
|
||||
:standalone_network_plugin_segmentation_id => '1001',
|
||||
:standalone_network_plugin_allowed_ip_ranges => '10.0.0.10-10.0.0.20',
|
||||
:standalone_network_plugin_gateway => '192.168.1.1',
|
||||
:standalone_network_plugin_mask => '255.255.255.0',
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
shared_examples_for 'standalone network plugin' do
|
||||
|
||||
it 'configures standalone network plugin' do
|
||||
|
||||
is_expected.to contain_manila_config("standalone/network_api_class").with_value(
|
||||
'manila.network.standalone_network_plugin.StandaloneNetworkPlugin')
|
||||
|
||||
params.each_pair do |config,value|
|
||||
is_expected.to contain_manila_config("standalone/#{config}").with_value( value )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'manila::network::standalone' do
|
||||
context 'with default parameters' do
|
||||
before do
|
||||
params = {}
|
||||
end
|
||||
context 'with required parameters' do
|
||||
it 'configures standalone network plugin' do
|
||||
is_expected.to contain_manila_config("standalone/network_api_class").with_value(
|
||||
'manila.network.standalone_network_plugin.StandaloneNetworkPlugin')
|
||||
|
||||
it_configures 'standalone network plugin'
|
||||
is_expected.to contain_manila_config('standalone/standalone_network_plugin_gateway')\
|
||||
.with_value('192.168.1.1')
|
||||
is_expected.to contain_manila_config('standalone/standalone_network_plugin_mask')\
|
||||
.with_value('255.255.255.0')
|
||||
is_expected.to contain_manila_config('standalone/standalone_network_plugin_segmentation_id')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('standalone/standalone_network_plugin_allowed_ip_ranges')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('standalone/network_plugin_ipv4_enabled')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('standalone/network_plugin_ipv6_enabled')\
|
||||
.with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with provided parameters' do
|
||||
it_configures 'standalone network plugin'
|
||||
context 'with custom parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:standalone_network_plugin_segmentation_id => '1001',
|
||||
:standalone_network_plugin_allowed_ip_ranges => '10.0.0.10-10.0.0.20',
|
||||
:network_plugin_ipv4_enabled => true,
|
||||
:network_plugin_ipv6_enabled => false,
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures standalone network plugin' do
|
||||
is_expected.to contain_manila_config('standalone/standalone_network_plugin_segmentation_id')\
|
||||
.with_value('1001')
|
||||
is_expected.to contain_manila_config('standalone/standalone_network_plugin_allowed_ip_ranges')\
|
||||
.with_value('10.0.0.10-10.0.0.20')
|
||||
is_expected.to contain_manila_config('standalone/network_plugin_ipv4_enabled')\
|
||||
.with_value(true)
|
||||
is_expected.to contain_manila_config('standalone/network_plugin_ipv6_enabled')\
|
||||
.with_value(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user