Allow to choose which Glance API to enable

- Allow to configure Glance API v1 with enable_v1_api boolean.
  If set to True, the glance::registry::enable_v1_registry also needs to
  be set to True. Note that if you set these values to True, Glance will
  send some deprecation warnings.
  This option is separated from enable_v2_api, and both API versions can be
  deployed together.

- Allow to configure Glance API v2 with enable_v2_api boolean.
  This option is separated from enable_v1_api, and both API versions can be
  deployed together.

Change-Id: Ibbb8b970971c899ae94097042465f605fe55f748
This commit is contained in:
Emilien Macchi 2016-12-06 16:50:37 +01:00
parent 634b182f55
commit d9fe9380d6
5 changed files with 42 additions and 0 deletions

View File

@ -227,6 +227,17 @@
# HTTPProxyToWSGI middleware.
# Defaults to $::os_service_default.
#
# [*enable_v1_api*]
# (Optional) Enable or not Glance API v1.
# If you enable this option, you'll get a deprecation warning in Glance
# logs. If enable_v2_api is set to True, glance::registry::enable_v1_registry
# must be configured to True, since Registry is required in API v1.
# Defaults to $::os_service_default.
#
# [*enable_v2_api*]
# (Optional) Enable or not Glance API v2.
# Defaults to $::os_service_default.
#
# [*validate*]
# (optional) Whether to validate the service is working after any service refreshes
# Defaults to false
@ -308,6 +319,8 @@ class glance::api(
$conversion_format = $::os_service_default,
$os_region_name = 'RegionOne',
$enable_proxy_headers_parsing = $::os_service_default,
$enable_v1_api = $::os_service_default,
$enable_v2_api = $::os_service_default,
$validate = false,
$validation_options = {},
# DEPRECATED PARAMETERS
@ -341,6 +354,8 @@ class glance::api(
'DEFAULT/scrub_time': value => $scrub_time;
'DEFAULT/delayed_delete': value => $delayed_delete;
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'DEFAULT/enable_v1_api': value => $enable_v1_api;
'DEFAULT/enable_v2_api': value => $enable_v2_api;
'glance_store/os_region_name': value => $os_region_name;
}

View File

@ -117,6 +117,14 @@
# (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
# set to True.
# If your OpenStack deployment is only using Glance API v2, this option
# should be set to False.
# Defaults to $::os_service_default.
#
class glance::registry(
$package_ensure = 'present',
$debug = undef,
@ -145,6 +153,7 @@ class glance::registry(
$ca_file = $::os_service_default,
$sync_db = true,
$os_region_name = $::os_service_default,
$enable_v1_registry = $::os_service_default,
) inherits glance {
include ::glance::deps
@ -168,6 +177,7 @@ class glance::registry(
'DEFAULT/workers': value => $workers;
'DEFAULT/bind_host': value => $bind_host;
'DEFAULT/bind_port': value => $bind_port;
'DEFAULT/enable_v1_registry': value => $enable_v1_registry;
'glance_store/os_region_name': value => $os_region_name;
}

View File

@ -0,0 +1,11 @@
---
features:
- Allow to configure Glance API v1 with enable_v1_api boolean.
If set to True, the glance::registry::enable_v1_registry also needs to
be set to True. Note that if you set these values to True, Glance will
send some deprecation warnings.
This option is separated from enable_v2_api, and both API versions can be
deployed together.
- Allow to configure Glance API v2 with enable_v2_api boolean.
This option is separated from enable_v1_api, and both API versions can be
deployed together.

View File

@ -42,6 +42,8 @@ describe 'glance::api' do
:taskflow_engine_mode => '<SERVICE DEFAULT>',
:taskflow_max_workers => '<SERVICE DEFAULT>',
:conversion_format => '<SERVICE DEFAULT>',
:enable_v1_api => '<SERVICE DEFAULT>',
:enable_v2_api => '<SERVICE DEFAULT>',
}
end
@ -111,6 +113,8 @@ describe 'glance::api' do
'delayed_delete',
'scrub_time',
'image_cache_dir',
'enable_v1_api',
'enable_v2_api',
].each do |config|
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end

View File

@ -24,6 +24,7 @@ describe 'glance::registry' do
:ca_file => '<SERVICE DEFAULT>',
:cert_file => '<SERVICE DEFAULT>',
:key_file => '<SERVICE DEFAULT>',
:enable_v1_registry => '<SERVICE DEFAULT>',
}
end
@ -78,6 +79,7 @@ describe 'glance::registry' do
'workers',
'bind_port',
'bind_host',
'enable_v1_registry',
].each do |config|
is_expected.to contain_glance_registry_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end