Add posibility to configure Glance backend settings for Glare service

This patch adds posibility to configure backend settings for Glare
service.

Since Glare service is experimental feature, it can be usually disabled
for deployment. Hence was added a optional parameter 'glare_enabled' for
each backend manifest. So, if Glare is enabled glance glare config
will (and should) have same backend options as main glance api config.

Change-Id: I112a332f490d2e57eef5fa7d41d465c0eb89da04
Related-bug: #1555697
This commit is contained in:
Denis Egorenko 2016-03-25 21:03:49 +03:00
parent 3941da05fc
commit ea0c4d5b51
12 changed files with 237 additions and 10 deletions

View File

@ -56,7 +56,10 @@
# (optional) Boolean describing if multiple backends will be configured # (optional) Boolean describing if multiple backends will be configured
# Defaults to false # Defaults to false
# #
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::cinder( class glance::backend::cinder(
$os_region_name = undef, $os_region_name = undef,
$cinder_ca_certificates_file = undef, $cinder_ca_certificates_file = undef,
@ -65,7 +68,7 @@ class glance::backend::cinder(
$cinder_endpoint_template = undef, $cinder_endpoint_template = undef,
$cinder_http_retries = '3', $cinder_http_retries = '3',
$multi_store = false, $multi_store = false,
$glare_enabled = false,
) { ) {
if $os_region_name { if $os_region_name {
@ -80,6 +83,9 @@ class glance::backend::cinder(
if !$multi_store { if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'cinder'; } glance_api_config { 'glance_store/default_store': value => 'cinder'; }
if $glare_enabled {
glance_glare_config { 'glance_store/default_store': value => 'cinder'; }
}
} }
glance_cache_config { glance_cache_config {
@ -88,20 +94,40 @@ class glance::backend::cinder(
'glance_store/cinder_http_retries': value => $cinder_http_retries; 'glance_store/cinder_http_retries': value => $cinder_http_retries;
} }
if $glare_enabled {
glance_glare_config {
'glance_store/cinder_api_insecure': value => $cinder_api_insecure;
'glance_store/cinder_catalog_info': value => $cinder_catalog_info;
'glance_store/cinder_http_retries': value => $cinder_http_retries;
}
}
if $cinder_endpoint_template { if $cinder_endpoint_template {
glance_api_config { 'glance_store/cinder_endpoint_template': value => $cinder_endpoint_template; } glance_api_config { 'glance_store/cinder_endpoint_template': value => $cinder_endpoint_template; }
glance_cache_config { 'glance_store/cinder_endpoint_template': value => $cinder_endpoint_template; } glance_cache_config { 'glance_store/cinder_endpoint_template': value => $cinder_endpoint_template; }
if $glare_enabled {
glance_glare_config { 'glance_store/cinder_endpoint_template': value => $cinder_endpoint_template; }
}
} else { } else {
glance_api_config { 'glance_store/cinder_endpoint_template': ensure => absent; } glance_api_config { 'glance_store/cinder_endpoint_template': ensure => absent; }
glance_cache_config { 'glance_store/cinder_endpoint_template': ensure => absent; } glance_cache_config { 'glance_store/cinder_endpoint_template': ensure => absent; }
if $glare_enabled {
glance_glare_config { 'glance_store/cinder_endpoint_template': ensure => absent; }
}
} }
if $cinder_ca_certificates_file { if $cinder_ca_certificates_file {
glance_api_config { 'glance_store/cinder_ca_certificates_file': value => $cinder_ca_certificates_file; } glance_api_config { 'glance_store/cinder_ca_certificates_file': value => $cinder_ca_certificates_file; }
glance_cache_config { 'glance_store/cinder_ca_certificates_file': value => $cinder_ca_certificates_file; } glance_cache_config { 'glance_store/cinder_ca_certificates_file': value => $cinder_ca_certificates_file; }
if $glare_enabled {
glance_glare_config { 'glance_store/cinder_ca_certificates_file': value => $cinder_ca_certificates_file; }
}
} else { } else {
glance_api_config { 'glance_store/cinder_ca_certificates_file': ensure => absent; } glance_api_config { 'glance_store/cinder_ca_certificates_file': ensure => absent; }
glance_cache_config { 'glance_store/cinder_ca_certificates_file': ensure => absent; } glance_cache_config { 'glance_store/cinder_ca_certificates_file': ensure => absent; }
if $glare_enabled {
glance_glare_config { 'glance_store/cinder_ca_certificates_file': ensure => absent; }
}
} }
} }

View File

@ -13,18 +13,33 @@
# (optional) Boolean describing if multiple backends will be configured # (optional) Boolean describing if multiple backends will be configured
# Defaults to false # Defaults to false
# #
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::file( class glance::backend::file(
$filesystem_store_datadir = '/var/lib/glance/images/', $filesystem_store_datadir = '/var/lib/glance/images/',
$multi_store = false, $multi_store = false,
$glare_enabled = false,
) { ) {
glance_api_config { glance_api_config {
'glance_store/filesystem_store_datadir': value => $filesystem_store_datadir; 'glance_store/filesystem_store_datadir': value => $filesystem_store_datadir;
} }
if $glare_enabled {
glance_glare_config {
'glance_store/filesystem_store_datadir': value => $filesystem_store_datadir;
}
}
if !$multi_store { if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'file'; } glance_api_config { 'glance_store/default_store': value => 'file'; }
if $glare_enabled {
glance_glare_config {
'glance_store/default_store': value => 'file';
}
}
} }
glance_cache_config { glance_cache_config {

View File

@ -35,7 +35,10 @@
# (optional) Boolean describing if multiple backends will be configured # (optional) Boolean describing if multiple backends will be configured
# Defaults to false # Defaults to false
# #
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::rbd( class glance::backend::rbd(
$rbd_store_user = undef, $rbd_store_user = undef,
$rbd_store_ceph_conf = '/etc/ceph/ceph.conf', $rbd_store_ceph_conf = '/etc/ceph/ceph.conf',
@ -45,6 +48,7 @@ class glance::backend::rbd(
$package_ensure = 'present', $package_ensure = 'present',
$rados_connect_timeout = '0', $rados_connect_timeout = '0',
$multi_store = false, $multi_store = false,
$glare_enabled = false,
) { ) {
include ::glance::params include ::glance::params
@ -60,8 +64,21 @@ class glance::backend::rbd(
'glance_store/rados_connect_timeout': value => $rados_connect_timeout; 'glance_store/rados_connect_timeout': value => $rados_connect_timeout;
} }
if $glare_enabled {
glance_glare_config {
'glance_store/rbd_store_ceph_conf': value => $rbd_store_ceph_conf;
'glance_store/rbd_store_user': value => $rbd_store_user;
'glance_store/rbd_store_pool': value => $rbd_store_pool;
'glance_store/rbd_store_chunk_size': value => $rbd_store_chunk_size;
'glance_store/rados_connect_timeout': value => $rados_connect_timeout;
}
}
if !$multi_store { if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'rbd'; } glance_api_config { 'glance_store/default_store': value => 'rbd'; }
if $glare_enabled {
glance_glare_config { 'glance_store/default_store': value => 'rbd'; }
}
} }
package { 'python-ceph': package { 'python-ceph':

View File

@ -50,6 +50,10 @@
# (optional) Boolean describing if multiple backends will be configured # (optional) Boolean describing if multiple backends will be configured
# Defaults to false # Defaults to false
# #
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
#
# === deprecated parameters: # === deprecated parameters:
# #
# [*default_store*] # [*default_store*]
@ -68,6 +72,7 @@ class glance::backend::s3(
$object_buffer_dir = undef, $object_buffer_dir = undef,
$thread_pools = 10, $thread_pools = 10,
$multi_store = false, $multi_store = false,
$glare_enabled = false,
# deprecated parameters # deprecated parameters
$default_store = undef, $default_store = undef,
) { ) {
@ -96,14 +101,37 @@ class glance::backend::s3(
'glance_store/s3_store_thread_pools': value => $thread_pools; 'glance_store/s3_store_thread_pools': value => $thread_pools;
} }
if $glare_enabled {
glance_glare_config {
'glance_store/s3_store_access_key': value => $access_key;
'glance_store/s3_store_secret_key': value => $secret_key;
'glance_store/s3_store_host': value => $host;
'glance_store/s3_store_bucket': value => $bucket;
'glance_store/s3_store_bucket_url_format': value => $bucket_url_format;
'glance_store/s3_store_create_bucket_on_put': value => $create_bucket_on_put;
'glance_store/s3_store_large_object_size': value => $large_object_size;
'glance_store/s3_store_large_object_chunk_size': value => $large_object_chunk_size;
'glance_store/s3_store_thread_pools': value => $thread_pools;
}
}
if !$multi_store { if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 's3'; } glance_api_config { 'glance_store/default_store': value => 's3'; }
if $glare_enabled {
glance_glare_config { 'glance_store/default_store': value => 's3'; }
}
} }
if $object_buffer_dir { if $object_buffer_dir {
glance_api_config { 'glance_store/s3_store_object_buffer_dir': value => $object_buffer_dir; } glance_api_config { 'glance_store/s3_store_object_buffer_dir': value => $object_buffer_dir; }
if $glare_enabled {
glance_glare_config { 'glance_store/s3_store_object_buffer_dir': value => $object_buffer_dir; }
}
} else { } else {
glance_api_config { 'glance_store/s3_store_object_buffer_dir': ensure => absent; } glance_api_config { 'glance_store/s3_store_object_buffer_dir': ensure => absent; }
if $glare_enabled {
glance_glare_config { 'glance_store/s3_store_object_buffer_dir': ensure => absent; }
}
} }
} }

View File

@ -42,7 +42,10 @@
# (optional) Boolean describing if multiple backends will be configured # (optional) Boolean describing if multiple backends will be configured
# Defaults to false # Defaults to false
# #
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::swift( class glance::backend::swift(
$swift_store_user, $swift_store_user,
$swift_store_key, $swift_store_key,
@ -55,6 +58,7 @@ class glance::backend::swift(
$swift_store_region = undef, $swift_store_region = undef,
$default_swift_reference = 'ref1', $default_swift_reference = 'ref1',
$multi_store = false, $multi_store = false,
$glare_enabled = false,
) { ) {
glance_api_config { glance_api_config {
@ -71,8 +75,27 @@ class glance::backend::swift(
'glance_store/default_swift_reference': value => $default_swift_reference; 'glance_store/default_swift_reference': value => $default_swift_reference;
} }
if $glare_enabled {
glance_glare_config {
'glance_store/swift_store_region': value => $swift_store_region;
'glance_store/swift_store_container': value => $swift_store_container;
'glance_store/swift_store_create_container_on_put':
value => $swift_store_create_container_on_put;
'glance_store/swift_store_large_object_size':
value => $swift_store_large_object_size;
'glance_store/swift_store_endpoint_type':
value => $swift_store_endpoint_type;
'glance_store/swift_store_config_file': value => '/etc/glance/glance-swift.conf';
'glance_store/default_swift_reference': value => $default_swift_reference;
}
}
if !$multi_store { if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'swift'; } glance_api_config { 'glance_store/default_store': value => 'swift'; }
if $glare_enabled {
glance_glare_config { 'glance_store/default_store': value => 'swift'; }
}
} }
glance_swift_config { glance_swift_config {

View File

@ -61,7 +61,10 @@
# (optional) Boolean describing if multiple backends will be configured # (optional) Boolean describing if multiple backends will be configured
# Defaults to false # Defaults to false
# #
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::vsphere( class glance::backend::vsphere(
$vcenter_host, $vcenter_host,
$vcenter_user, $vcenter_user,
@ -73,6 +76,7 @@ class glance::backend::vsphere(
$vcenter_task_poll_interval = '5', $vcenter_task_poll_interval = '5',
$vcenter_api_retry_count = '10', $vcenter_api_retry_count = '10',
$multi_store = false, $multi_store = false,
$glare_enabled = false,
) { ) {
glance_api_config { glance_api_config {
@ -87,7 +91,24 @@ class glance::backend::vsphere(
'glance_store/vmware_datacenter_path': value => $vcenter_datacenter; 'glance_store/vmware_datacenter_path': value => $vcenter_datacenter;
} }
if $glare_enabled {
glance_glare_config {
'glance_store/vmware_api_insecure': value => $vcenter_api_insecure;
'glance_store/vmware_server_host': value => $vcenter_host;
'glance_store/vmware_server_username': value => $vcenter_user;
'glance_store/vmware_server_password': value => $vcenter_password;
'glance_store/vmware_datastore_name': value => $vcenter_datastore;
'glance_store/vmware_store_image_dir': value => $vcenter_image_dir;
'glance_store/vmware_task_poll_interval': value => $vcenter_task_poll_interval;
'glance_store/vmware_api_retry_count': value => $vcenter_api_retry_count;
'glance_store/vmware_datacenter_path': value => $vcenter_datacenter;
}
}
if !$multi_store { if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'vsphere'; } glance_api_config { 'glance_store/default_store': value => 'vsphere'; }
if $glare_enabled {
glance_glare_config { 'glance_store/default_store': value => 'vsphere'; }
}
} }
} }

View File

@ -46,6 +46,13 @@ describe 'glance::backend::cinder' do
is_expected.to contain_glance_cache_config('glance_store/cinder_ca_certificates_file').with(:ensure => 'absent') is_expected.to contain_glance_cache_config('glance_store/cinder_ca_certificates_file').with(:ensure => 'absent')
is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with(:ensure => 'absent') is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with(:ensure => 'absent')
end end
it 'not configures glance-glare.conf' do
is_expected.to_not contain_glance_glare_config('glance_store/cinder_api_insecure').with_value(false)
is_expected.to_not contain_glance_glare_config('glance_store/cinder_catalog_info').with_value('volume:cinder:publicURL')
is_expected.to_not contain_glance_glare_config('glance_store/cinder_http_retries').with_value('3')
is_expected.to_not contain_glance_glare_config('glance_store/cinder_ca_certificates_file').with(:ensure => 'absent')
is_expected.to_not contain_glance_glare_config('glance_store/cinder_endpoint_template').with(:ensure => 'absent')
end
end end
context 'when overriding parameters' do context 'when overriding parameters' do
@ -56,6 +63,7 @@ describe 'glance::backend::cinder' do
:cinder_catalog_info => 'volume:cinder:internalURL', :cinder_catalog_info => 'volume:cinder:internalURL',
:cinder_endpoint_template => 'http://srv-foo:8776/v1/%(project_id)s', :cinder_endpoint_template => 'http://srv-foo:8776/v1/%(project_id)s',
:cinder_http_retries => '10', :cinder_http_retries => '10',
:glare_enabled => true,
} }
end end
it 'configures glance-api.conf' do it 'configures glance-api.conf' do
@ -72,8 +80,14 @@ describe 'glance::backend::cinder' do
is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s') is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
is_expected.to contain_glance_cache_config('glance_store/cinder_http_retries').with_value('10') is_expected.to contain_glance_cache_config('glance_store/cinder_http_retries').with_value('10')
end end
it 'configures glance-glare.conf' do
is_expected.to contain_glance_glare_config('glance_store/cinder_api_insecure').with_value(true)
is_expected.to contain_glance_glare_config('glance_store/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
is_expected.to contain_glance_glare_config('glance_store/cinder_catalog_info').with_value('volume:cinder:internalURL')
is_expected.to contain_glance_glare_config('glance_store/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
is_expected.to contain_glance_glare_config('glance_store/cinder_http_retries').with_value('10')
end
end end
end end

View File

@ -12,9 +12,14 @@ describe 'glance::backend::file' do
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/') is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
end end
it 'configures glance-glare.conf' do
is_expected.to_not contain_glance_glare_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
end
describe 'when overriding datadir' do describe 'when overriding datadir' do
let :params do let :params do
{:filesystem_store_datadir => '/tmp/'} {:filesystem_store_datadir => '/tmp/',
:glare_enabled => true,}
end end
it 'configures glance-api.conf' do it 'configures glance-api.conf' do
@ -24,6 +29,10 @@ describe 'glance::backend::file' do
it 'configures glance-cache.conf' do it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/tmp/') is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
end end
it 'configures glance-glare.conf' do
is_expected.to contain_glance_glare_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
end
end end
end end

View File

@ -20,6 +20,11 @@ describe 'glance::backend::rbd' do
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('8') } it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('8') }
it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('0')} it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('0')}
it { is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('rbd') }
it { is_expected.to_not contain_glance_glare_config('glance_store/rbd_store_pool').with_value('images') }
it { is_expected.to_not contain_glance_glare_config('glance_store/rbd_store_ceph_conf').with_value('/etc/ceph/ceph.conf') }
it { is_expected.to_not contain_glance_glare_config('glance_store/rbd_store_chunk_size').with_value('8') }
it { is_expected.to_not contain_glance_glare_config('glance_store/rados_connect_timeout').with_value('0')}
it { is_expected.to contain_package('python-ceph').with( it { is_expected.to contain_package('python-ceph').with(
:name => 'python-ceph', :name => 'python-ceph',
:ensure => 'present' :ensure => 'present'
@ -34,11 +39,15 @@ describe 'glance::backend::rbd' do
:rbd_store_chunk_size => '2', :rbd_store_chunk_size => '2',
:package_ensure => 'latest', :package_ensure => 'latest',
:rados_connect_timeout => '30', :rados_connect_timeout => '30',
:glare_enabled => true,
} }
end end
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_user').with_value('user') } it { is_expected.to contain_glance_api_config('glance_store/rbd_store_user').with_value('user') }
it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2') } it { is_expected.to contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2') }
it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30')} it { is_expected.to contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30')}
it { is_expected.to contain_glance_glare_config('glance_store/rbd_store_user').with_value('user') }
it { is_expected.to contain_glance_glare_config('glance_store/rbd_store_chunk_size').with_value('2') }
it { is_expected.to contain_glance_glare_config('glance_store/rados_connect_timeout').with_value('30')}
it { is_expected.to contain_package('python-ceph').with( it { is_expected.to contain_package('python-ceph').with(
:name => 'python-ceph', :name => 'python-ceph',
:ensure => 'latest' :ensure => 'latest'

View File

@ -26,6 +26,19 @@ describe 'glance::backend::s3' do
is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value(nil) is_expected.to contain_glance_api_config('glance_store/s3_store_object_buffer_dir').with_value(nil)
is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('10') is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('10')
end end
it 'not configures glance-glare.conf' do
is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('s3')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_access_key').with_value('access')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_secret_key').with_value('secret')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_host').with_value('host')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_bucket').with_value('bucket')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_bucket_url_format').with_value('subdomain')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_create_bucket_on_put').with_value('false')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_large_object_size').with_value('100')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_large_object_chunk_size').with_value('10')
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_object_buffer_dir').with_value(nil)
is_expected.to_not contain_glance_glare_config('glance_store/s3_store_thread_pools').with_value('10')
end
end end
@ -42,6 +55,7 @@ describe 'glance::backend::s3' do
:large_object_chunk_size => 20, :large_object_chunk_size => 20,
:object_buffer_dir => '/tmp', :object_buffer_dir => '/tmp',
:thread_pools => 20, :thread_pools => 20,
:glare_enabled => true,
} }
end end
@ -58,6 +72,18 @@ describe 'glance::backend::s3' do
is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('20') is_expected.to contain_glance_api_config('glance_store/s3_store_thread_pools').with_value('20')
end end
it 'configures glance-glare.conf' do
is_expected.to contain_glance_glare_config('glance_store/s3_store_access_key').with_value('access2')
is_expected.to contain_glance_glare_config('glance_store/s3_store_secret_key').with_value('secret2')
is_expected.to contain_glance_glare_config('glance_store/s3_store_host').with_value('host2')
is_expected.to contain_glance_glare_config('glance_store/s3_store_bucket').with_value('bucket2')
is_expected.to contain_glance_glare_config('glance_store/s3_store_bucket_url_format').with_value('path')
is_expected.to contain_glance_glare_config('glance_store/s3_store_create_bucket_on_put').with_value('true')
is_expected.to contain_glance_glare_config('glance_store/s3_store_large_object_size').with_value('200')
is_expected.to contain_glance_glare_config('glance_store/s3_store_large_object_chunk_size').with_value('20')
is_expected.to contain_glance_glare_config('glance_store/s3_store_object_buffer_dir').with_value('/tmp')
is_expected.to contain_glance_glare_config('glance_store/s3_store_thread_pools').with_value('20')
end
end end
describe 'with invalid bucket_url_format' do describe 'with invalid bucket_url_format' do

View File

@ -30,6 +30,16 @@ describe 'glance::backend::swift' do
is_expected.to contain_glance_swift_config('ref1/auth_address').with_value('http://127.0.0.1:5000/v2.0/') is_expected.to contain_glance_swift_config('ref1/auth_address').with_value('http://127.0.0.1:5000/v2.0/')
end end
it 'not configures glance-glare.conf' do
is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('swift')
is_expected.to_not contain_glance_glare_config('glance_store/swift_store_large_object_size').with_value('5120')
is_expected.to_not contain_glance_glare_config('glance_store/swift_store_container').with_value('glance')
is_expected.to_not contain_glance_glare_config('glance_store/swift_store_create_container_on_put').with_value(false)
is_expected.to_not contain_glance_glare_config('glance_store/swift_store_endpoint_type').with_value('internalURL')
is_expected.to_not contain_glance_glare_config('glance_store/swift_store_region').with_value(nil)
is_expected.to_not contain_glance_glare_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
is_expected.to_not contain_glance_glare_config('glance_store/default_swift_reference').with_value('ref1')
end
end end
describe 'when overriding parameters' do describe 'when overriding parameters' do
@ -45,6 +55,7 @@ describe 'glance::backend::swift' do
:swift_store_endpoint_type => 'publicURL', :swift_store_endpoint_type => 'publicURL',
:swift_store_region => 'RegionTwo', :swift_store_region => 'RegionTwo',
:default_swift_reference => 'swift_creds', :default_swift_reference => 'swift_creds',
:glare_enabled => true,
} }
end end
@ -60,6 +71,15 @@ describe 'glance::backend::swift' do
is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1') is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1')
is_expected.to contain_glance_swift_config('swift_creds/auth_address').with_value('127.0.0.2:8080/v1.0/') is_expected.to contain_glance_swift_config('swift_creds/auth_address').with_value('127.0.0.2:8080/v1.0/')
end end
it 'configures glance-glare.conf' do
is_expected.to contain_glance_glare_config('glance_store/swift_store_container').with_value('swift')
is_expected.to contain_glance_glare_config('glance_store/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_glare_config('glance_store/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_glare_config('glance_store/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_glare_config('glance_store/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_glare_config('glance_store/default_swift_reference').with_value('swift_creds')
end
end end
end end

View File

@ -51,6 +51,18 @@ describe 'glance::backend::vsphere' do
is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('10') is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('10')
is_expected.to contain_glance_api_config('glance_store/vmware_datacenter_path').with_value('Datacenter') is_expected.to contain_glance_api_config('glance_store/vmware_datacenter_path').with_value('Datacenter')
end end
it 'not configures glance-glare.conf' do
is_expected.to_not contain_glance_glare_config('glance_store/default_store').with_value('vsphere')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_api_insecure').with_value('False')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_server_host').with_value('10.0.0.1')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_server_username').with_value('root')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_server_password').with_value('123456')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_datastore_name').with_value('Datastore')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_store_image_dir').with_value('/openstack_glance')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_task_poll_interval').with_value('5')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_api_retry_count').with_value('10')
is_expected.to_not contain_glance_glare_config('glance_store/vmware_datacenter_path').with_value('Datacenter')
end
end end
context 'when overriding parameters' do context 'when overriding parameters' do
@ -65,6 +77,7 @@ describe 'glance::backend::vsphere' do
:vcenter_api_insecure => 'True', :vcenter_api_insecure => 'True',
:vcenter_task_poll_interval => '6', :vcenter_task_poll_interval => '6',
:vcenter_api_retry_count => '11', :vcenter_api_retry_count => '11',
:glare_enabled => true,
} }
end end
it 'configures glance-api.conf' do it 'configures glance-api.conf' do
@ -72,6 +85,12 @@ describe 'glance::backend::vsphere' do
is_expected.to contain_glance_api_config('glance_store/vmware_task_poll_interval').with_value('6') is_expected.to contain_glance_api_config('glance_store/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('11') is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('11')
end end
it 'configures glance-glare.conf' do
is_expected.to contain_glance_glare_config('glance_store/vmware_api_insecure').with_value('True')
is_expected.to contain_glance_glare_config('glance_store/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_glare_config('glance_store/vmware_api_retry_count').with_value('11')
end
end end
end end