From 3c376bd733bff778002a01fb7b5f0dbc645d0e05 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 12 Jan 2022 20:35:46 +0900 Subject: [PATCH] Migrate cross_az_attach from nova to nova::cinder ... to manage all [cinder] parameters by nova::cinder. Change-Id: I7ba317045e9811873c00ff9cc052932ec444d3bd --- manifests/cinder.pp | 7 +++++++ manifests/init.pp | 16 ++++++++++------ ...s_az_attach-in-cinder-2f13b4fce6a11f4d.yaml | 5 +++++ spec/classes/nova_cinder_spec.rb | 18 +++++++++++------- spec/classes/nova_init_spec.rb | 3 --- 5 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/cross_az_attach-in-cinder-2f13b4fce6a11f4d.yaml diff --git a/manifests/cinder.pp b/manifests/cinder.pp index 2a415b318..ff548192b 100644 --- a/manifests/cinder.pp +++ b/manifests/cinder.pp @@ -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; } } diff --git a/manifests/init.pp b/manifests/init.pp index 4e291113d..7b86730ec 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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; diff --git a/releasenotes/notes/cross_az_attach-in-cinder-2f13b4fce6a11f4d.yaml b/releasenotes/notes/cross_az_attach-in-cinder-2f13b4fce6a11f4d.yaml new file mode 100644 index 000000000..9ef1bed13 --- /dev/null +++ b/releasenotes/notes/cross_az_attach-in-cinder-2f13b4fce6a11f4d.yaml @@ -0,0 +1,5 @@ +--- +deprecations: + - | + The ``nova::cross_az_attach`` parameter has been deprecated. Use + the ``nova::cinder::cross_az_attach`` parmaeter instead. diff --git a/spec/classes/nova_cinder_spec.rb b/spec/classes/nova_cinder_spec.rb index 53d28ee6f..1337dc30a 100644 --- a/spec/classes/nova_cinder_spec.rb +++ b/spec/classes/nova_cinder_spec.rb @@ -16,6 +16,7 @@ describe 'nova::cinder' do should contain_nova_config('cinder/os_region_name').with_value('') should contain_nova_config('cinder/catalog_info').with_value('') should contain_nova_config('cinder/http_retries').with_value('') + should contain_nova_config('cinder/cross_az_attach').with_value('') end end @@ -38,19 +39,21 @@ describe 'nova::cinder' do should contain_nova_config('cinder/os_region_name').with_value('') should contain_nova_config('cinder/catalog_info').with_value('') should contain_nova_config('cinder/http_retries').with_value('') + should contain_nova_config('cinder/cross_az_attach').with_value('') 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 diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index a1d8d9f06..abd99935e 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -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('') is_expected.to contain_nova_config('DEFAULT/long_rpc_timeout').with_value('') - is_expected.to contain_nova_config('cinder/cross_az_attach').with_value('') is_expected.to contain_nova_config('DEFAULT/cpu_allocation_ratio').with_value('') is_expected.to contain_nova_config('DEFAULT/ram_allocation_ratio').with_value('') is_expected.to contain_nova_config('DEFAULT/disk_allocation_ratio').with_value('') @@ -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')