Cinder store: Add support for domain_name parameters

Depends-on: https://review.opendev.org/793826
Change-Id: I330378856fa8a488b85373bb4e0236f8c10d8526
This commit is contained in:
Takashi Kajinami 2021-09-03 22:22:46 +09:00
parent ef245de870
commit e57bb37768
3 changed files with 91 additions and 59 deletions

View File

@ -61,6 +61,14 @@
# (optional) A valid password for the user specified by `cinder_store_user_name'
# Defaults to $::os_service_default.
#
# [*cinder_store_user_domain_name*]
# (optional) Domain of the user to authenticate against cinder.
# Defaults to $::os_service_default.
#
# [*cinder_store_project_domain_name*]
# (optional) Domain of the project to authenticate against cinder.
# Defaults to $::os_service_default.
#
# [*cinder_os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
@ -88,21 +96,23 @@
# Defaults to $::os_service_default.
#
define glance::backend::multistore::cinder(
$cinder_ca_certificates_file = $::os_service_default,
$cinder_api_insecure = $::os_service_default,
$cinder_catalog_info = $::os_service_default,
$cinder_endpoint_template = $::os_service_default,
$cinder_http_retries = $::os_service_default,
$cinder_store_auth_address = $::os_service_default,
$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_volume_type = $::os_service_default,
$cinder_enforce_multipath = $::os_service_default,
$cinder_use_multipath = $::os_service_default,
$cinder_mount_point_base = $::os_service_default,
$store_description = $::os_service_default,
$cinder_ca_certificates_file = $::os_service_default,
$cinder_api_insecure = $::os_service_default,
$cinder_catalog_info = $::os_service_default,
$cinder_endpoint_template = $::os_service_default,
$cinder_http_retries = $::os_service_default,
$cinder_store_auth_address = $::os_service_default,
$cinder_store_project_name = $::os_service_default,
$cinder_store_user_name = $::os_service_default,
$cinder_store_password = $::os_service_default,
$cinder_store_user_domain_name = $::os_service_default,
$cinder_store_project_domain_name = $::os_service_default,
$cinder_os_region_name = 'RegionOne',
$cinder_volume_type = $::os_service_default,
$cinder_enforce_multipath = $::os_service_default,
$cinder_use_multipath = $::os_service_default,
$cinder_mount_point_base = $::os_service_default,
$store_description = $::os_service_default,
) {
include glance::deps
@ -111,38 +121,42 @@ define glance::backend::multistore::cinder(
$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;
"${name}/cinder_http_retries": value => $cinder_http_retries;
"${name}/cinder_endpoint_template": value => $cinder_endpoint_template;
"${name}/cinder_ca_certificates_file": value => $cinder_ca_certificates_file;
"${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_store_password": value => $cinder_store_password, secret => true;
"${name}/cinder_os_region_name": value => $cinder_os_region_name_real;
"${name}/cinder_volume_type": value => $cinder_volume_type;
"${name}/cinder_enforce_multipath": value => $cinder_enforce_multipath;
"${name}/cinder_use_multipath": value => $cinder_use_multipath;
"${name}/cinder_mount_point_base": value => $cinder_mount_point_base;
"${name}/store_description": value => $store_description;
"${name}/cinder_api_insecure": value => $cinder_api_insecure;
"${name}/cinder_catalog_info": value => $cinder_catalog_info;
"${name}/cinder_http_retries": value => $cinder_http_retries;
"${name}/cinder_endpoint_template": value => $cinder_endpoint_template;
"${name}/cinder_ca_certificates_file": value => $cinder_ca_certificates_file;
"${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_store_password": value => $cinder_store_password, secret => true;
"${name}/cinder_store_user_domain_name": value => $cinder_store_user_domain_name;
"${name}/cinder_store_project_domain_name": value => $cinder_store_project_domain_name;
"${name}/cinder_os_region_name": value => $cinder_os_region_name_real;
"${name}/cinder_volume_type": value => $cinder_volume_type;
"${name}/cinder_enforce_multipath": value => $cinder_enforce_multipath;
"${name}/cinder_use_multipath": value => $cinder_use_multipath;
"${name}/cinder_mount_point_base": value => $cinder_mount_point_base;
"${name}/store_description": value => $store_description;
}
glance_cache_config {
"${name}/cinder_api_insecure": value => $cinder_api_insecure;
"${name}/cinder_catalog_info": value => $cinder_catalog_info;
"${name}/cinder_http_retries": value => $cinder_http_retries;
"${name}/cinder_endpoint_template": value => $cinder_endpoint_template;
"${name}/cinder_ca_certificates_file": value => $cinder_ca_certificates_file;
"${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_store_password": value => $cinder_store_password, secret => true;
"${name}/cinder_os_region_name": value => $cinder_os_region_name_real;
"${name}/cinder_volume_type": value => $cinder_volume_type;
"${name}/cinder_enforce_multipath": value => $cinder_enforce_multipath;
"${name}/cinder_mount_point_base": value => $cinder_mount_point_base;
"${name}/cinder_use_multipath": value => $cinder_use_multipath;
"${name}/cinder_api_insecure": value => $cinder_api_insecure;
"${name}/cinder_catalog_info": value => $cinder_catalog_info;
"${name}/cinder_http_retries": value => $cinder_http_retries;
"${name}/cinder_endpoint_template": value => $cinder_endpoint_template;
"${name}/cinder_ca_certificates_file": value => $cinder_ca_certificates_file;
"${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_store_password": value => $cinder_store_password, secret => true;
"${name}/cinder_store_project_domain_name": value => $cinder_store_project_domain_name;
"${name}/cinder_store_user_domain_name": value => $cinder_store_user_domain_name;
"${name}/cinder_os_region_name": value => $cinder_os_region_name_real;
"${name}/cinder_volume_type": value => $cinder_volume_type;
"${name}/cinder_enforce_multipath": value => $cinder_enforce_multipath;
"${name}/cinder_mount_point_base": value => $cinder_mount_point_base;
"${name}/cinder_use_multipath": value => $cinder_use_multipath;
}
create_resources('glance_api_config', {})

View File

@ -0,0 +1,8 @@
---
features:
- |
The following two parameters have been added to
the ``cinder::backend::multistore::cinder`` resource type.
- ``cinder_store_user_domain_name``
- ``cinder_store_project_domain_name``

View File

@ -40,6 +40,8 @@ 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>').with_secret(true)
is_expected.to contain_glance_api_config('cinder/cinder_store_user_domain_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('cinder/cinder_store_project_domain_name').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_volume_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('cinder/cinder_enforce_multipath').with_value('<SERVICE DEFAULT>')
@ -57,6 +59,8 @@ 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>').with_secret(true)
is_expected.to contain_glance_cache_config('cinder/cinder_store_user_domain_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('cinder/cinder_store_project_domain_name').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_volume_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('cinder/cinder_enforce_multipath').with_value('<SERVICE DEFAULT>')
@ -68,21 +72,23 @@ describe 'glance::backend::multistore::cinder' do
context 'when overriding parameters' do
let :params do
{
:store_description => 'My cinder store',
:cinder_api_insecure => true,
:cinder_ca_certificates_file => '/etc/ssh/ca.crt',
:cinder_catalog_info => 'volume:cinder:internalURL',
:cinder_endpoint_template => 'http://srv-foo:8776/v1/%(project_id)s',
:cinder_http_retries => '10',
:cinder_store_auth_address => '127.0.0.2:8080/v3/',
:cinder_store_project_name => 'services',
:cinder_store_user_name => 'glance',
:cinder_store_password => 'glance',
:cinder_os_region_name => 'RegionTwo',
:cinder_volume_type => 'glance-fast',
:cinder_enforce_multipath => true,
:cinder_use_multipath => true,
:cinder_mount_point_base => '/var/lib/glance/mnt',
:store_description => 'My cinder store',
:cinder_api_insecure => true,
:cinder_ca_certificates_file => '/etc/ssh/ca.crt',
:cinder_catalog_info => 'volume:cinder:internalURL',
:cinder_endpoint_template => 'http://srv-foo:8776/v1/%(project_id)s',
:cinder_http_retries => '10',
:cinder_store_auth_address => '127.0.0.2:8080/v3/',
:cinder_store_project_name => 'services',
:cinder_store_user_name => 'glance',
:cinder_store_password => 'glance',
:cinder_store_user_domain_name => 'Default',
:cinder_store_project_domain_name => 'Default',
:cinder_os_region_name => 'RegionTwo',
:cinder_volume_type => 'glance-fast',
:cinder_enforce_multipath => true,
:cinder_use_multipath => true,
:cinder_mount_point_base => '/var/lib/glance/mnt',
}
end
it 'configures glance-api.conf' do
@ -96,6 +102,8 @@ 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').with_secret(true)
is_expected.to contain_glance_api_config('cinder/cinder_store_user_domain_name').with_value('Default')
is_expected.to contain_glance_api_config('cinder/cinder_store_project_domain_name').with_value('Default')
is_expected.to contain_glance_api_config('cinder/cinder_os_region_name').with_value('RegionTwo')
is_expected.to contain_glance_api_config('cinder/cinder_volume_type').with_value('glance-fast')
is_expected.to contain_glance_api_config('cinder/cinder_enforce_multipath').with_value(true)
@ -113,6 +121,8 @@ 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').with_secret(true)
is_expected.to contain_glance_cache_config('cinder/cinder_store_user_domain_name').with_value('Default')
is_expected.to contain_glance_cache_config('cinder/cinder_store_project_domain_name').with_value('Default')
is_expected.to contain_glance_cache_config('cinder/cinder_os_region_name').with_value('RegionTwo')
is_expected.to contain_glance_cache_config('cinder/cinder_volume_type').with_value('glance-fast')
is_expected.to contain_glance_cache_config('cinder/cinder_enforce_multipath').with_value(true)