Add cinder_os_region_name parameters for cinder backend

This patch introduces cinder_os_region_name parameters for cinder
backend, because global os_region_name parameter was replaced by this
cinder specific parameters[1].

[1] 410747822c9433c83fd4aec547d3e4c288502f90

Change-Id: I4a7c9ac97ff2f1c04b651ecbc89b3cb1c583f2f9
This commit is contained in:
Takashi Kajinami 2020-04-12 23:41:45 +09:00
parent 5d2acead72
commit 9e82f598ad
9 changed files with 59 additions and 31 deletions

View File

@ -206,10 +206,6 @@
# Allowed values: 'qcow2', 'raw', 'vmdk', false.
# Defaults to $::os_service_default (disabled)
#
# [*os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
#
# [*enable_proxy_headers_parsing*]
# (Optional) Enable paste middleware to handle SSL requests through
# HTTPProxyToWSGI middleware.
@ -316,6 +312,10 @@
# (optional) Minimum number of SQL connections to keep open in a pool.
# Defaults to undef.
#
# [*os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to undef
#
class glance::api(
$package_ensure = 'present',
$bind_host = $::os_service_default,
@ -363,7 +363,6 @@ class glance::api(
$taskflow_engine_mode = $::os_service_default,
$taskflow_max_workers = $::os_service_default,
$conversion_format = $::os_service_default,
$os_region_name = 'RegionOne',
$enable_proxy_headers_parsing = $::os_service_default,
$max_request_body_size = $::os_service_default,
$enable_v1_api = false,
@ -385,12 +384,18 @@ class glance::api(
$registry_client_protocol = undef,
$show_multiple_locations = undef,
$database_min_pool_size = undef,
$os_region_name = undef,
) inherits glance {
include glance::deps
include glance::policy
include glance::api::db
if $os_region_name != undef {
warning('glance::api::os_region_name is deprecated. Use \
cinder::backend::multistore::cinder::cinder_os_region_name instead.')
}
if $sync_db {
include glance::db::sync
include glance::db::metadefs
@ -432,7 +437,6 @@ class glance::api(
'DEFAULT/enable_v2_api': value => $enable_v2_api;
'DEFAULT/limit_param_default': value => $limit_param_default;
'DEFAULT/api_limit_max': value => $api_limit_max;
'glance_store/os_region_name': value => $os_region_name;
}
if $show_multiple_locations {

View File

@ -63,6 +63,10 @@
# (optional) A valid password for the user specified by `cinder_store_user_name'
# Defaults to $::os_service_default.
#
# [*cinder_os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false
@ -77,6 +81,7 @@ class glance::backend::cinder(
$cinder_store_project_name = $::os_service_default,
$cinder_store_user_name = $::os_service_default,
$cinder_store_password = $::os_service_default,
$cinder_os_region_name = 'RegionOne',
$multi_store = false,
) {
@ -84,6 +89,9 @@ class glance::backend::cinder(
warning('glance::backend::cinder is deprecated. Use glance::backend::multistore::cinder instead.')
# to keep backwards compatibility
$cinder_os_region_name_real = pick($::glance::api::os_region_name, $cinder_os_region_name)
glance::backend::multistore::cinder { 'glance_store':
cinder_api_insecure => $cinder_api_insecure,
cinder_catalog_info => $cinder_catalog_info,
@ -94,6 +102,7 @@ class glance::backend::cinder(
cinder_store_project_name => $cinder_store_project_name,
cinder_store_user_name => $cinder_store_user_name,
cinder_store_password => $cinder_store_password,
cinder_os_region_name => $cinder_os_region_name_real,
store_description => undef,
}

View File

@ -61,6 +61,10 @@
# (optional) A valid password for the user specified by `cinder_store_user_name'
# Defaults to $::os_service_default.
#
# [*cinder_os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
#
# [*cinder_enforce_multipath*]
# (optional) Enforce multipath usage when attaching a cinder volume
# Defaults to $::os_service_default.
@ -84,6 +88,7 @@ define glance::backend::multistore::cinder(
$cinder_store_project_name = $::os_service_default,
$cinder_store_user_name = $::os_service_default,
$cinder_store_password = $::os_service_default,
$cinder_os_region_name = 'RegionOne',
$cinder_enforce_multipath = $::os_service_default,
$cinder_use_multipath = $::os_service_default,
$store_description = $::os_service_default,
@ -91,6 +96,9 @@ define glance::backend::multistore::cinder(
include glance::deps
# to keep backwards compatibility
$cinder_os_region_name_real = pick($::glance::api::os_region_name, $cinder_os_region_name)
glance_api_config {
"${name}/cinder_api_insecure": value => $cinder_api_insecure;
"${name}/cinder_catalog_info": value => $cinder_catalog_info;
@ -101,6 +109,7 @@ define glance::backend::multistore::cinder(
"${name}/cinder_store_project_name": value => $cinder_store_project_name;
"${name}/cinder_store_user_name": value => $cinder_store_user_name;
"${name}/cinder_store_password": value => $cinder_store_password;
"${name}/cinder_os_region_name": value => $cinder_os_region_name_real;
"${name}/cinder_enforce_multipath": value => $cinder_enforce_multipath;
"${name}/cinder_use_multipath": value => $cinder_use_multipath;
"${name}/store_description": value => $store_description;
@ -115,6 +124,7 @@ define glance::backend::multistore::cinder(
"${name}/cinder_store_auth_address": value => $cinder_store_auth_address;
"${name}/cinder_store_project_name": value => $cinder_store_project_name;
"${name}/cinder_store_user_name": value => $cinder_store_user_name;
"${name}/cinder_os_region_name": value => $cinder_os_region_name_real;
"${name}/cinder_enforce_multipath": value => $cinder_enforce_multipath;
"${name}/cinder_use_multipath": value => $cinder_use_multipath;
"${name}/cinder_store_password": value => $cinder_store_password;

View File

@ -80,10 +80,6 @@
# (optional) CA certificate file to use to verify connecting clients
# Defaults to $::os_service_default.
#
# [*os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to $::os_service_default.
#
# [*enable_v1_registry*]
# (optional) Deploy the v1 API Registry service.
# If glance::api::enable_v1_api is set to True, this option also needs to be
@ -98,6 +94,10 @@
# (optional) Minimum number of SQL connections to keep open in a pool.
# Defaults to undef.
#
# [*os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to undef.
#
class glance::registry(
$package_ensure = 'present',
$bind_host = $::os_service_default,
@ -117,10 +117,10 @@ class glance::registry(
$cert_file = $::os_service_default,
$key_file = $::os_service_default,
$ca_file = $::os_service_default,
$os_region_name = $::os_service_default,
$enable_v1_registry = false,
# DEPRECATED PARAMETERS
$database_min_pool_size = undef,
$os_region_name = undef,
) inherits glance {
warning('glance::registry is deprecated, and will be removed in a future release')
@ -128,6 +128,11 @@ class glance::registry(
include glance::deps
include glance::registry::db
if $os_region_name != undef {
warning('glance::registry::os_region_name is deprecated. Use \
cinder::backend::multistore::cinder::cinder_os_region_name instead.')
}
if ( $glance::params::api_package_name != $glance::params::registry_package_name ) {
ensure_packages($glance::params::registry_package_name,
{

View File

@ -0,0 +1,10 @@
---
features:
- |
The new parameter, ``cinder_os_region_name`` was added to
``glance::backend::cinder`` and ``glance::backend::multistore::cinder``,
to configure keystone region used for connection to cinder.
deprecations:
- |
``glance::api::os_region_name`` and ``glance::registry::os_region_name``
were deperecated. Use new cinder_os_region_name pamraeters instead.

View File

@ -33,7 +33,6 @@ describe 'glance::api' do
:image_member_quota => '<SERVICE DEFAULT>',
:image_cache_stall_time => '<SERVICE DEFAULT>',
:image_cache_max_size => '<SERVICE DEFAULT>',
:os_region_name => 'RegionOne',
:pipeline => 'keystone',
:task_time_to_live => '<SERVICE DEFAULT>',
:task_executor => '<SERVICE DEFAULT>',
@ -78,7 +77,6 @@ describe 'glance::api' do
:image_member_quota => '128',
:image_cache_stall_time => '10',
:image_cache_max_size => '10737418240',
:os_region_name => 'RegionOne2',
:pipeline => 'keystone2',
:sync_db => false,
:limit_param_default => '10',
@ -175,15 +173,6 @@ describe 'glance::api' do
end
end
it 'is_expected.to lay down default glance_store api and cache config' do
[
'os_region_name',
].each do |config|
is_expected.to contain_glance_cache_config("glance_store/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_api_config("glance_store/#{config}").with_value(param_hash[config.intern])
end
end
it 'is_expected.to lay down default glance_store api config' do
[
'filesystem_store_metadata_file',

View File

@ -41,6 +41,7 @@ describe 'glance::backend::cinder' do
is_expected.to contain_glance_api_config('glance_store/cinder_store_auth_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_store_project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_store_user_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_os_region_name').with_value('RegionOne')
is_expected.to contain_glance_api_config('glance_store/cinder_store_password').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
@ -52,6 +53,7 @@ describe 'glance::backend::cinder' do
is_expected.to contain_glance_cache_config('glance_store/cinder_store_auth_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_user_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_os_region_name').with_value('RegionOne')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_password').with_value('<SERVICE DEFAULT>')
end
end
@ -68,6 +70,7 @@ describe 'glance::backend::cinder' do
:cinder_store_project_name => 'services',
:cinder_store_user_name => 'glance',
:cinder_store_password => 'glance',
:cinder_os_region_name => 'RegionTwo',
}
end
it 'configures glance-api.conf' do
@ -80,6 +83,7 @@ describe 'glance::backend::cinder' do
is_expected.to contain_glance_api_config('glance_store/cinder_store_project_name').with_value('services')
is_expected.to contain_glance_api_config('glance_store/cinder_store_user_name').with_value('glance')
is_expected.to contain_glance_api_config('glance_store/cinder_store_password').with_value('glance')
is_expected.to contain_glance_api_config('glance_store/cinder_os_region_name').with_value('RegionTwo')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/cinder_api_insecure').with_value(true)
@ -91,6 +95,7 @@ describe 'glance::backend::cinder' do
is_expected.to contain_glance_cache_config('glance_store/cinder_store_project_name').with_value('services')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_user_name').with_value('glance')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_password').with_value('glance')
is_expected.to contain_glance_cache_config('glance_store/cinder_os_region_name').with_value('RegionTwo')
end
end
end

View File

@ -15,7 +15,6 @@ describe 'glance::registry' do
:enabled => true,
:manage_service => true,
:purge_config => false,
:os_region_name => '<SERVICE DEFAULT>',
:ca_file => '<SERVICE DEFAULT>',
:cert_file => '<SERVICE DEFAULT>',
:key_file => '<SERVICE DEFAULT>',
@ -30,7 +29,6 @@ describe 'glance::registry' do
:bind_port => '9111',
:workers => '5',
:enabled => false,
:os_region_name => 'RegionOne2',
}
].each do |param_set|
@ -74,13 +72,6 @@ describe 'glance::registry' do
is_expected.to contain_glance_registry_config("paste_deploy/flavor").with_value('keystone')
end
end
it 'is_expected.to lay down default glance_store registry config' do
[
'os_region_name',
].each do |config|
is_expected.to contain_glance_registry_config("glance_store/#{config}").with_value(param_hash[config.intern])
end
end
it 'is_expected.to lay down default ssl config' do
[
'ca_file',

View File

@ -40,6 +40,7 @@ describe 'glance::backend::multistore::cinder' do
is_expected.to contain_glance_api_config('cinder/cinder_store_project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('cinder/cinder_store_user_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('cinder/cinder_store_password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('cinder/cinder_os_region_name').with_value('RegionOne')
is_expected.to contain_glance_api_config('cinder/cinder_enforce_multipath').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('cinder/cinder_use_multipath').with_value('<SERVICE DEFAULT>')
end
@ -54,6 +55,7 @@ describe 'glance::backend::multistore::cinder' do
is_expected.to contain_glance_cache_config('cinder/cinder_store_project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('cinder/cinder_store_user_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('cinder/cinder_store_password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('cinder/cinder_os_region_name').with_value('RegionOne')
is_expected.to contain_glance_cache_config('cinder/cinder_enforce_multipath').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('cinder/cinder_use_multipath').with_value('<SERVICE DEFAULT>')
end
@ -72,6 +74,7 @@ describe 'glance::backend::multistore::cinder' do
:cinder_store_project_name => 'services',
:cinder_store_user_name => 'glance',
:cinder_store_password => 'glance',
:cinder_os_region_name => 'RegionTwo',
:cinder_enforce_multipath => true,
:cinder_use_multipath => true,
}
@ -87,6 +90,7 @@ describe 'glance::backend::multistore::cinder' do
is_expected.to contain_glance_api_config('cinder/cinder_store_project_name').with_value('services')
is_expected.to contain_glance_api_config('cinder/cinder_store_user_name').with_value('glance')
is_expected.to contain_glance_api_config('cinder/cinder_store_password').with_value('glance')
is_expected.to contain_glance_api_config('cinder/cinder_os_region_name').with_value('RegionTwo')
is_expected.to contain_glance_api_config('cinder/cinder_enforce_multipath').with_value(true)
is_expected.to contain_glance_api_config('cinder/cinder_use_multipath').with_value(true)
end
@ -101,6 +105,7 @@ describe 'glance::backend::multistore::cinder' do
is_expected.to contain_glance_cache_config('cinder/cinder_store_project_name').with_value('services')
is_expected.to contain_glance_cache_config('cinder/cinder_store_user_name').with_value('glance')
is_expected.to contain_glance_cache_config('cinder/cinder_store_password').with_value('glance')
is_expected.to contain_glance_cache_config('cinder/cinder_os_region_name').with_value('RegionTwo')
is_expected.to contain_glance_cache_config('cinder/cinder_enforce_multipath').with_value(true)
is_expected.to contain_glance_cache_config('cinder/cinder_use_multipath').with_value(true)
end