Deprecate scenario.img_dir option

The option is deprecated for more than 4 years already and it will
be removed soon, see the change in Tempest [1]

Starting Tempest 25.0.0 release, CONF.scenario.img_file need
a full path for the image. CONF.scenario.img_dir was deprecated
and will be removed in the next release. Till Tempest 25.0.0,
old behavior is maintained and keep working but starting
Tempest 26.0.0, you need to specify the full path in
CONF.scenario.img_file config option.

This patch does analogically the same change as was done in Tempest,
in order to give users of the plugin some time for removing img_dir.

[1] https://review.opendev.org/#/c/710996

Related-Bug: #1393881
Change-Id: I3055273cd5e6eafa4af8acfb3f7b18fce5de5368
This commit is contained in:
Martin Kopec 2020-07-14 08:33:06 +00:00 committed by Takashi Kajinami
parent 572c7a1ef2
commit dacf254b8e
3 changed files with 66 additions and 9 deletions

View File

@ -177,10 +177,8 @@
# Defaults to true
# [*auth_version*]
# Defaults to 'v3'
# [*img_dir*]
# Defaults to '/var/lib/tempest'
# [*img_file*]
# Defaults to 'cirros-0.4.0-x86_64-disk.img'
# Defaults to '/var/lib/tempest/cirros-0.4.0-x86_64-disk.img'
# [*login_url*]
# Defaults to undef
# [*dashboard_url*]
@ -226,6 +224,8 @@
# is integrated in neutron tempest plugin.
# [*congress_available*]
# Defaults to undef
# [*img_dir*]
# Defaults to undef
#
class tempest(
$package_ensure = 'present',
@ -351,8 +351,8 @@ class tempest(
$disable_ssl_validation = undef,
$manage_tests_packages = false,
# scenario options
$img_dir = '/var/lib/tempest',
$img_file = 'cirros-0.4.0-x86_64-disk.img',
# TODO(tkajinam) Update the default value when we remove img_dir parameter
$img_file = undef,
# designate options
$designate_nameservers = undef,
# ironic options
@ -367,6 +367,7 @@ class tempest(
$allow_tenant_isolation = undef,
$neutron_fwaas_available = undef,
$congress_available = undef,
$img_dir = undef,
) {
if !is_service_default($tempest_roles) and !empty($tempest_roles){
@ -412,6 +413,21 @@ class tempest(
warning('The tempest::neutron_fwaas_available parameter is deprecated. FWaaS plugin is now part of neutron plugin.')
}
if $img_dir != undef {
warning('The tempest::img_dir parameter is deperecated. Set full path in img_file parameter instead')
if $img_file == undef {
$img_file_real = "${img_dir}/cirros-0.4.0-x86_64-disk.img"
} else {
$img_file_real = "${img_dir}/${img_file}"
}
} else {
if $img_file == undef {
$img_file_real = '/var/lib/tempest/cirros-0.4.0-x86_64-disk.img'
} else {
$img_file_real = $img_file
}
}
include tempest::params
include openstacklib::openstackclient
@ -579,8 +595,7 @@ class tempest(
'service_available/octavia': value => $octavia_available;
'whitebox/db_uri': value => $whitebox_db_uri;
'cli/cli_dir': value => $cli_dir;
'scenario/img_dir': value => $img_dir;
'scenario/img_file': value => $img_file;
'scenario/img_file': value => $img_file_real;
'service_broker/run_service_broker_tests': value => $run_service_broker_tests;
'dns/nameservers': value => $designate_nameservers;
'compute-feature-enabled/attach_encrypted_volume': value => $attach_encrypted_volume;

View File

@ -0,0 +1,6 @@
---
deprecations:
- |
The img_dir parameter is deprecated and will be removed in a future release.
The img_file parameter must be set with a full path to the image that should
be used.

View File

@ -269,8 +269,7 @@ describe 'tempest' do
is_expected.to contain_tempest_config('whitebox/db_uri').with(:value => nil)
is_expected.to contain_tempest_config('cli/cli_dir').with(:value => nil)
is_expected.to contain_tempest_config('oslo_concurrency/lock_path').with(:value => '/var/lib/tempest')
is_expected.to contain_tempest_config('scenario/img_dir').with(:value => '/var/lib/tempest')
is_expected.to contain_tempest_config('scenario/img_file').with(:value => 'cirros-0.4.0-x86_64-disk.img')
is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/var/lib/tempest/cirros-0.4.0-x86_64-disk.img')
is_expected.to contain_tempest_config('service_broker/run_service_broker_tests').with(:value => false)
is_expected.to contain_oslo__log('tempest_config').with(
:debug => false,
@ -315,6 +314,43 @@ describe 'tempest' do
end
end
context 'with deprecated img_dir parameter and img_file set' do
let :params do
{ :image_name => 'cirros',
:image_name_alt => 'cirros' ,
:img_file => '/home/stack/myimage.img' }
end
it 'sets image_file based on img_dir and img_file' do
is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/home/stack/myimage.img')
end
end
context 'with deprecated img_dir parameter set' do
let :params do
{ :image_name => 'cirros',
:image_name_alt => 'cirros',
:img_dir => '/home/stack' }
end
it 'sets image_file based on img_dir' do
is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/home/stack/cirros-0.4.0-x86_64-disk.img')
end
end
context 'with deprecated img_dir parameter and img_file set' do
let :params do
{ :image_name => 'cirros',
:image_name_alt => 'cirros',
:img_dir => '/home/stack',
:img_file => 'myimage.img' }
end
it 'sets image_file based on img_dir and img_file' do
is_expected.to contain_tempest_config('scenario/img_file').with(:value => '/home/stack/myimage.img')
end
end
context 'install Tempest from package' do
let :params do
{:install_from_source => false,