Migrate cross_az_attach from nova to nova::cinder

... to manage all [cinder] parameters by nova::cinder.

Change-Id: I7ba317045e9811873c00ff9cc052932ec444d3bd
This commit is contained in:
Takashi Kajinami 2022-01-12 20:35:46 +09:00
parent e2889d1bf6
commit 3c376bd733
5 changed files with 33 additions and 16 deletions

View File

@ -62,6 +62,10 @@
# call.
# Defaults to $::os_service_default
#
# [*cross_az_attach*]
# (optional) Allow attach between instance and volume in different availability zones.
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*region_name*]
@ -81,6 +85,7 @@ class nova::cinder (
$os_region_name = $::os_service_default,
$catalog_info = $::os_service_default,
$http_retries = $::os_service_default,
$cross_az_attach = $::os_service_default,
# DEPRECATED PARAMETERS
$region_name = undef,
) {
@ -89,6 +94,7 @@ class nova::cinder (
$os_region_name_real = pick($::nova::os_region_name, $os_region_name)
$catalog_info_real = pick($::nova::cinder_catalog_info, $catalog_info)
$cross_az_attach_real = pick($::nova::cross_az_attach, $cross_az_attach)
if $region_name != undef {
warning('The nova::cinder::region_name parameter is deprecated and has no effect. \
@ -126,5 +132,6 @@ Use the nova::cinder::os_region_name parameter')
'cinder/os_region_name': value => $os_region_name_real;
'cinder/catalog_info': value => $catalog_info_real;
'cinder/http_retries': value => $http_retries;
'cinder/cross_az_attach': value => $cross_az_attach_real;
}
}

View File

@ -356,10 +356,6 @@
# If unable to do so, will use "127.0.0.1".
# Defaults to $::os_service_default.
#
# [*cross_az_attach*]
# (optional) Allow attach between instance and volume in different availability zones.
# Defaults to $::os_service_default
#
# [*dhcp_domain*]
# (optional) domain to use for building the hostnames
# Defaults to $::os_service_default
@ -449,6 +445,10 @@
# retries on failures
# Defaults to undef.
#
# [*cross_az_attach*]
# (optional) Allow attach between instance and volume in different availability zones.
# Defaults to undef
#
class nova(
$ensure_package = 'present',
$default_transport_url = $::os_service_default,
@ -524,7 +524,6 @@ class nova(
$initial_disk_allocation_ratio = $::os_service_default,
$purge_config = false,
$my_ip = $::os_service_default,
$cross_az_attach = $::os_service_default,
$dhcp_domain = $::os_service_default,
# DEPRECATED PARAMETERS
$auth_strategy = undef,
@ -546,6 +545,7 @@ class nova(
$glance_num_retries = undef,
$block_device_allocate_retries = undef,
$block_device_allocate_retries_interval = undef,
$cross_az_attach = undef,
) inherits nova::params {
include nova::deps
@ -642,6 +642,11 @@ Use nova::compute::block_device_allocate_retries instead')
Use nova::compute::block_device_allocate_retries_interval instead')
}
if $cross_az_attach != unef {
warning('The cross_az_attach parameter is deprecated. \
Use nova::cinder::cross_az_attach instead.')
}
if $use_ssl {
if !$cert_file {
fail('The cert_file parameter is required when use_ssl is set to true')
@ -851,7 +856,6 @@ but should be one of: ssh-rsa, ssh-dsa, ssh-ecdsa.")
}
nova_config {
'cinder/cross_az_attach': value => $cross_az_attach;
'upgrade_levels/cells': value => $upgrade_level_cells;
'upgrade_levels/cert': value => $upgrade_level_cert;
'upgrade_levels/compute': value => $upgrade_level_compute;

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The ``nova::cross_az_attach`` parameter has been deprecated. Use
the ``nova::cinder::cross_az_attach`` parmaeter instead.

View File

@ -16,6 +16,7 @@ describe 'nova::cinder' do
should contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/http_retries').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
end
end
@ -38,19 +39,21 @@ describe 'nova::cinder' do
should contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/http_retries').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
end
end
context 'when specified parameters' do
let :params do
{
:password => 's3cr3t',
:auth_type => 'v3password',
:auth_url => 'http://10.0.0.10:5000/v3',
:timeout => 60,
:os_region_name => 'RegionOne',
:catalog_info => 'volumev3:cinderv3:publicURL',
:http_retries => 3,
:password => 's3cr3t',
:auth_type => 'v3password',
:auth_url => 'http://10.0.0.10:5000/v3',
:timeout => 60,
:os_region_name => 'RegionOne',
:catalog_info => 'volumev3:cinderv3:publicURL',
:http_retries => 3,
:cross_az_attach => true,
}
end
@ -66,6 +69,7 @@ describe 'nova::cinder' do
should contain_nova_config('cinder/os_region_name').with_value('RegionOne')
should contain_nova_config('cinder/catalog_info').with_value('volumev3:cinderv3:publicURL')
should contain_nova_config('cinder/http_retries').with_value(3)
should contain_nova_config('cinder/cross_az_attach').with_value(true)
end
end

View File

@ -91,7 +91,6 @@ describe 'nova' do
is_expected.to contain_nova_config('DEFAULT/report_interval').with_value('10')
is_expected.to contain_nova_config('vif_plug_ovs/ovsdb_connection').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/long_rpc_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/cpu_allocation_ratio').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/ram_allocation_ratio').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/disk_allocation_ratio').with_value('<SERVICE DEFAULT>')
@ -149,7 +148,6 @@ describe 'nova' do
:notification_topics => 'openstack',
:notification_format => 'unversioned',
:report_interval => '60',
:cross_az_attach => true,
:ovsdb_connection => 'tcp:127.0.0.1:6640',
:upgrade_level_cells => '1.0.0',
:upgrade_level_cert => '1.0.0',
@ -258,7 +256,6 @@ describe 'nova' do
is_expected.to contain_nova_config('DEFAULT/report_interval').with_value('60')
is_expected.to contain_nova_config('vif_plug_ovs/ovsdb_connection').with_value('tcp:127.0.0.1:6640')
is_expected.to contain_nova_config('DEFAULT/long_rpc_timeout').with_value('1800')
is_expected.to contain_nova_config('cinder/cross_az_attach').with_value(true)
is_expected.to contain_nova_config('DEFAULT/ssl_only').with_value(true)
is_expected.to contain_nova_config('DEFAULT/cert').with_value('/etc/ssl/private/snakeoil.pem')
is_expected.to contain_nova_config('DEFAULT/key').with_value('/etc/ssl/certs/snakeoil.pem')