Add parameter to set os_region_name in glance config

When https://review.openstack.org/#/c/125231/ was merged, the glance
providers became dependent on the DEFAULT/os_region_name parameter in
the glance configs, but the module had no way to set that parameter.
This caused the providers to fail.

This patch adds the parameter to glance::api so that the user can
control the value. It also removes functionality of the os_region_name
in glance::backend::cinder. While it would be better to deprecate this
parameter first and remove its functionality in a later release, there
is no clean way to do this and avoid a duplicate definition error.

An alternative to rapidly removing this functionality from
glance::backend::cinder would be modifying the glance parent provider
to make the DEFAULT/os_region_name glance config optional.

Change-Id: I075224acb9da2bb547d437b08cf6fccfed655d5c
This commit is contained in:
Colleen Murphy 2014-10-26 14:46:17 -07:00
parent abd028a5f6
commit a97bf99479
4 changed files with 23 additions and 16 deletions

View File

@ -162,6 +162,9 @@
# (optional) Base directory that the Image Cache uses.
# Defaults to '/var/lib/glance/image-cache'.
#
# [*os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
class glance::api(
$keystone_password,
$verbose = false,
@ -198,6 +201,7 @@ class glance::api(
$database_connection = 'sqlite:///var/lib/glance/glance.sqlite',
$database_idle_timeout = 3600,
$image_cache_dir = '/var/lib/glance/image-cache',
$os_region_name = 'RegionOne',
# DEPRECATED PARAMETERS
$mysql_module = undef,
$sql_idle_timeout = false,
@ -276,6 +280,7 @@ class glance::api(
'DEFAULT/workers': value => $workers;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'DEFAULT/os_region_name': value => $os_region_name;
}
# known_stores config
@ -290,8 +295,9 @@ class glance::api(
}
glance_cache_config {
'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug;
'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug;
'DEFAULT/os_region_name': value => $os_region_name;
}
# configure api service to connect registry service

View File

@ -33,9 +33,9 @@
# Defaults to 'undef'
#
# [*os_region_name*]
# (optional) Region name of this node.
# Should be a valid region name
# Defaults to 'RegionOne'
# (optional) The os_region_name parameter is deprecated and has no effect.
# Use glance::api::os_region_name instead.
# Defaults to 'undef'
#
# [*cinder_ca_certificates_file*]
# (optional) Location of ca certicate file to use for cinder client requests.
@ -54,7 +54,7 @@
#
class glance::backend::cinder(
$os_region_name = 'RegionOne',
$os_region_name = undef,
$cinder_ca_certificates_file = undef,
$cinder_api_insecure = false,
$cinder_catalog_info = 'volume:cinder:publicURL',
@ -63,19 +63,21 @@ class glance::backend::cinder(
) {
if $os_region_name {
notice('The os_region_name parameter is deprecated and has no effect. Use glance::api::os_region_name instead.')
}
glance_api_config {
'DEFAULT/cinder_api_insecure': value => $cinder_api_insecure;
'DEFAULT/cinder_catalog_info': value => $cinder_catalog_info;
'DEFAULT/cinder_http_retries': value => $cinder_http_retries;
'DEFAULT/default_store': value => 'cinder';
'DEFAULT/os_region_name': value => $os_region_name;
}
glance_cache_config {
'DEFAULT/cinder_api_insecure': value => $cinder_api_insecure;
'DEFAULT/cinder_catalog_info': value => $cinder_catalog_info;
'DEFAULT/cinder_http_retries': value => $cinder_http_retries;
'DEFAULT/os_region_name': value => $os_region_name;
}
if $cinder_endpoint_template {

View File

@ -38,6 +38,7 @@ describe 'glance::api' do
:purge_config => false,
:known_stores => false,
:image_cache_dir => '/var/lib/glance/image-cache',
:os_region_name => 'RegionOne',
}
end
@ -64,7 +65,8 @@ describe 'glance::api' do
:database_idle_timeout => '36002',
:database_connection => 'mysql:///var:lib@glance/glance',
:show_image_direct_url => true,
:image_cache_dir => '/tmp/glance'
:image_cache_dir => '/tmp/glance',
:os_region_name => 'RegionOne2',
}
].each do |param_set|
@ -96,7 +98,8 @@ describe 'glance::api' do
'registry_host',
'registry_port',
'registry_client_protocol',
'show_image_direct_url'
'show_image_direct_url',
'os_region_name',
].each do |config|
should contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end
@ -107,7 +110,8 @@ describe 'glance::api' do
'verbose',
'debug',
'registry_host',
'registry_port'
'registry_port',
'os_region_name',
].each do |config|
should contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end

View File

@ -34,7 +34,6 @@ describe 'glance::backend::cinder' do
should contain_glance_api_config('DEFAULT/default_store').with_value('cinder')
should contain_glance_api_config('DEFAULT/cinder_api_insecure').with_value(false)
should contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
should contain_glance_api_config('DEFAULT/os_region_name').with_value('RegionOne')
should contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('3')
should contain_glance_api_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
should contain_glance_api_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
@ -42,7 +41,6 @@ describe 'glance::backend::cinder' do
it 'configures glance-cache.conf' do
should contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(false)
should contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:publicURL')
should contain_glance_cache_config('DEFAULT/os_region_name').with_value('RegionOne')
should contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('3')
should contain_glance_cache_config('DEFAULT/cinder_ca_certificates_file').with(:ensure => 'absent')
should contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with(:ensure => 'absent')
@ -57,7 +55,6 @@ describe 'glance::backend::cinder' do
:cinder_catalog_info => 'volume:cinder:internalURL',
:cinder_endpoint_template => 'http://srv-foo:8776/v1/%(project_id)s',
:cinder_http_retries => '10',
:os_region_name => 'foo'
}
end
it 'configures glance-api.conf' do
@ -67,7 +64,6 @@ describe 'glance::backend::cinder' do
should contain_glance_api_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
should contain_glance_api_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
should contain_glance_api_config('DEFAULT/cinder_http_retries').with_value('10')
should contain_glance_api_config('DEFAULT/os_region_name').with_value('foo')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('DEFAULT/cinder_api_insecure').with_value(true)
@ -75,7 +71,6 @@ describe 'glance::backend::cinder' do
should contain_glance_cache_config('DEFAULT/cinder_catalog_info').with_value('volume:cinder:internalURL')
should contain_glance_cache_config('DEFAULT/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
should contain_glance_cache_config('DEFAULT/cinder_http_retries').with_value('10')
should contain_glance_cache_config('DEFAULT/os_region_name').with_value('foo')
end
end