Add all store options to glance-cache.conf

The glance-cache.conf is used by the glance-cache-prefetcher command
which requires access to backend store. Thus all store options should
be added to the glance-cache.conf file so that backend store can be
loaded properly.

Closes-Bug: #2034893
Change-Id: I8f0b2be8b138d267364f20ff81876902b225d29e
This commit is contained in:
Takashi Kajinami
2023-09-08 14:22:00 +09:00
parent 357e761bf7
commit 10d7bbdeef
22 changed files with 314 additions and 76 deletions

View File

@@ -434,6 +434,12 @@ class glance::api(
'glance_store/stores': ensure => absent;
'glance_store/default_store': ensure => absent;
}
glance_cache_config {
'DEFAULT/enabled_backends': value => join($enabled_backends_array, ',');
'glance_store/default_backend': value => $default_backend;
'glance_store/stores': ensure => absent;
'glance_store/default_store': ensure => absent;
}
} elsif $stores or $default_store {
warning('The stores and default_store parameters are deprecated. Please use \
@@ -462,25 +468,31 @@ enabled_backends instead.')
if $multi_store {
if $default_store_real {
glance_api_config {
'glance_store/default_store': value => $default_store_real;
$default_store_opt = {
'glance_store/default_store' => {'value' => $default_store_real}
}
} else {
glance_api_config {
'glance_store/default_store': ensure => absent;
$default_store_opt = {
'glance_store/default_store' => {'ensure' => absent}
}
}
} else {
$default_store_opt = {}
}
if $stores_real {
glance_api_config {
'glance_store/stores': value => join($stores_real, ',');
$stores_opt = {
'glance_store/stores' => {'value' => join($stores_real, ',')}
}
} else {
glance_api_config {
'glance_store/stores': ensure => absent;
$stores_opt = {
'glance_store/stores' => {'ensure' => absent}
}
}
create_resources('glance_api_config', merge($default_store_opt, $stores_opt))
create_resources('glance_cache_config', merge($default_store_opt, $stores_opt))
} else {
warning('Glance-api is being provisioned without any backends')
}
@@ -491,6 +503,12 @@ enabled_backends instead.')
'glance_store/filesystem_store_file_perm':
value => pick($filesystem_store_file_perm, $facts['os_service_default']);
}
glance_cache_config {
'glance_store/filesystem_store_metadata_file':
value => pick($filesystem_store_metadata_file, $facts['os_service_default']);
'glance_store/filesystem_store_file_perm':
value => pick($filesystem_store_file_perm, $facts['os_service_default']);
}
glance_api_config {
'image_format/container_formats': value => join(any2array($container_formats), ',');

View File

@@ -105,5 +105,6 @@ class glance::backend::cinder(
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'cinder'; }
glance_cache_config { 'glance_store/default_store': value => 'cinder'; }
}
}

View File

@@ -35,5 +35,6 @@ class glance::backend::file(
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'file'; }
glance_cache_config { 'glance_store/default_store': value => 'file'; }
}
}

View File

@@ -81,10 +81,16 @@ define glance::backend::multistore::file(
"${name}/filesystem_store_metadata_file": value => $filesystem_store_metadata_file;
"${name}/filesystem_store_file_perm": value => $filesystem_store_file_perm;
}
glance_cache_config {
"${name}/filesystem_store_metadata_file": value => $filesystem_store_metadata_file;
"${name}/filesystem_store_file_perm": value => $filesystem_store_file_perm;
}
}
glance_cache_config {
"${name}/filesystem_store_datadir": value => $filesystem_store_datadir;
"${name}/filesystem_store_datadirs": value => $filesystem_store_datadirs;
"${name}/filesystem_store_datadir": value => $filesystem_store_datadir;
"${name}/filesystem_store_datadirs": value => $filesystem_store_datadirs;
"${name}/filesystem_store_chunk_size": value => $filesystem_store_chunk_size;
"${name}/filesystem_thin_provisioning": value => $filesystem_thin_provisioning;
}
}

View File

@@ -56,4 +56,10 @@ define glance::backend::multistore::http(
"${name}/https_insecure": value => $https_insecure;
"${name}/http_proxy_information": value => join(any2array($http_proxy_information), ',');
}
glance_cache_config {
"${name}/https_ca_certificates_file": value => $https_ca_certificates_file;
"${name}/https_insecure": value => $https_insecure;
"${name}/http_proxy_information": value => join(any2array($http_proxy_information), ',');
}
}

View File

@@ -72,13 +72,22 @@ define glance::backend::multistore::rbd(
include glance::params
glance_api_config {
"${name}/rbd_store_ceph_conf": value => $rbd_store_ceph_conf;
"${name}/rbd_store_user": value => $rbd_store_user;
"${name}/rbd_store_pool": value => $rbd_store_pool;
"${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size;
"${name}/rbd_thin_provisioning": value => $rbd_thin_provisioning;
"${name}/rados_connect_timeout": value => $rados_connect_timeout;
"${name}/store_description": value => $store_description;
"${name}/rbd_store_ceph_conf": value => $rbd_store_ceph_conf;
"${name}/rbd_store_user": value => $rbd_store_user;
"${name}/rbd_store_pool": value => $rbd_store_pool;
"${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size;
"${name}/rbd_thin_provisioning": value => $rbd_thin_provisioning;
"${name}/rados_connect_timeout": value => $rados_connect_timeout;
"${name}/store_description": value => $store_description;
}
glance_cache_config {
"${name}/rbd_store_ceph_conf": value => $rbd_store_ceph_conf;
"${name}/rbd_store_user": value => $rbd_store_user;
"${name}/rbd_store_pool": value => $rbd_store_pool;
"${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size;
"${name}/rbd_thin_provisioning": value => $rbd_thin_provisioning;
"${name}/rados_connect_timeout": value => $rados_connect_timeout;
}
if $manage_packages {

View File

@@ -147,6 +147,20 @@ define glance::backend::multistore::swift(
"${name}/swift_store_retry_get_count": value => $swift_store_retry_get_count;
"${name}/store_description": value => $store_description;
}
glance_cache_config {
"${name}/swift_store_region": value => $swift_store_region;
"${name}/swift_store_container": value => $swift_store_container;
"${name}/swift_store_create_container_on_put": value => $swift_store_create_container_on_put;
"${name}/swift_store_large_object_size": value => $swift_store_large_object_size;
"${name}/swift_store_large_object_chunk_size": value => $swift_store_large_object_chunk_size;
"${name}/swift_store_endpoint_type": value => $swift_store_endpoint_type;
"${name}/swift_store_service_type": value => $swift_store_service_type;
"${name}/swift_store_config_file": value => $swift_store_config_file_real;
"${name}/default_swift_reference": value => $default_swift_reference;
"${name}/swift_buffer_on_upload": value => $swift_buffer_on_upload;
"${name}/swift_upload_buffer_dir": value => $swift_upload_buffer_dir;
"${name}/swift_store_retry_get_count": value => $swift_store_retry_get_count;
}
glance_swift_config {
"${default_swift_reference}/user": value => $swift_store_user;

View File

@@ -104,4 +104,16 @@ define glance::backend::multistore::vsphere(
"${name}/vmware_datastores": value => $vmware_datastores;
"${name}/store_description": value => $store_description;
}
glance_cache_config {
"${name}/vmware_insecure": value => $vmware_insecure;
"${name}/vmware_ca_file": value => $vmware_ca_file;
"${name}/vmware_server_host": value => $vmware_server_host;
"${name}/vmware_server_username": value => $vmware_server_username;
"${name}/vmware_server_password": value => $vmware_server_password, secret => true;
"${name}/vmware_store_image_dir": value => $vmware_store_image_dir;
"${name}/vmware_task_poll_interval": value => $vmware_task_poll_interval;
"${name}/vmware_api_retry_count": value => $vmware_api_retry_count;
"${name}/vmware_datastores": value => $vmware_datastores;
}
}

View File

@@ -71,5 +71,6 @@ class glance::backend::rbd(
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'rbd'; }
glance_cache_config { 'glance_store/default_store': value => 'rbd'; }
}
}

View File

@@ -97,5 +97,6 @@ class glance::backend::swift(
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'swift'; }
glance_cache_config { 'glance_store/default_store': value => 'swift'; }
}
}

View File

@@ -109,6 +109,7 @@ class glance::backend::vsphere(
}
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'vsphere'; }
glance_api_config { 'glance_store/default_store': value => 'vsphere'; }
glance_cache_config { 'glance_store/default_store': value => 'vsphere'; }
}
}

View File

@@ -195,6 +195,7 @@ describe 'glance::api' do
'filesystem_store_file_perm',
].each do |config|
is_expected.to contain_glance_api_config("glance_store/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_cache_config("glance_store/#{config}").with_value(param_hash[config.intern])
end
end
@@ -362,6 +363,9 @@ describe 'glance::api' do
describe 'with enabled_backends and stores by default' do
it { is_expected.to_not contain_glance_api_config('DEFAULT/enabled_backends').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_glance_cache_config('DEFAULT/enabled_backends').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_glance_cache_config('glance_store/stores').with_value('<SERVICE DEFAULT>') }
end
describe 'with enabled_backends' do
@@ -378,6 +382,11 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('glance_store/default_backend').with_value('file1') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_ensure('absent') }
it { is_expected.to contain_glance_cache_config('DEFAULT/enabled_backends').with_value('file1:file,http1:http') }
it { is_expected.to contain_glance_cache_config('glance_store/default_backend').with_value('file1') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_ensure('absent') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_ensure('absent') }
end
describe 'with invalid backend type' do
@@ -434,6 +443,9 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file,http') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file,http') }
end
describe 'with single store override and no default store' do
@@ -446,6 +458,9 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file') }
end
describe 'with multiple stores override and no default store' do
@@ -458,6 +473,9 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file,http') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file,http') }
end
describe 'with default_store' do
@@ -470,6 +488,9 @@ describe 'glance::api' do
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file') }
end
describe 'with task & taskflow configuration' do

View File

@@ -31,7 +31,6 @@ describe 'glance::backend::cinder' do
context 'when default parameters' do
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('cinder')
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('cinder')
is_expected.to contain_glance_api_config('glance_store/cinder_api_insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_catalog_info').with_value('<SERVICE DEFAULT>')
@@ -45,6 +44,7 @@ describe 'glance::backend::cinder' do
is_expected.to contain_glance_api_config('glance_store/cinder_store_password').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('cinder')
is_expected.to contain_glance_cache_config('glance_store/cinder_api_insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_catalog_info').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_http_retries').with_value('<SERVICE DEFAULT>')

View File

@@ -10,6 +10,8 @@ describe 'glance::backend::file' do
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file')
is_expected.to contain_glance_cache_config('glance_store/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
end
@@ -28,6 +30,7 @@ describe 'glance::backend::file' 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_thin_provisioning').with_value('true')
end
end

View File

@@ -3,13 +3,24 @@ require 'spec_helper'
describe 'glance::backend::rbd' do
shared_examples 'glance::backend::rbd' do
context 'with default params' do
it { should contain_glance_api_config('glance_store/default_store').with_value('rbd') }
it { should contain_glance_api_config('glance_store/rbd_store_pool').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('glance_store/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('<SERVICE DEFAULT>')}
it { should contain_glance_api_config('glance_store/rbd_store_user').with_value('<SERVICE DEFAULT>')}
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/default_store').with_value('rbd')
should contain_glance_api_config('glance_store/rbd_store_pool').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_store_user').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('glance_store/default_store').with_value('rbd')
should contain_glance_cache_config('glance_store/rbd_store_pool').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rados_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_store_user').with_value('<SERVICE DEFAULT>')
end
it { should contain_package('python-ceph').with(
:name => platform_params[:pyceph_package_name],
@@ -28,10 +39,18 @@ describe 'glance::backend::rbd' do
}
end
it { should contain_glance_api_config('glance_store/rbd_store_user').with_value('user') }
it { should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2') }
it { should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('true') }
it { should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30')}
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/rbd_store_user').with_value('user')
should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2')
should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('true')
should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('glance_store/rbd_store_user').with_value('user')
should contain_glance_cache_config('glance_store/rbd_store_chunk_size').with_value('2')
should contain_glance_cache_config('glance_store/rbd_thin_provisioning').with_value('true')
should contain_glance_cache_config('glance_store/rados_connect_timeout').with_value('30')
end
it { should contain_package('python-ceph').with(
:name => platform_params[:pyceph_package_name],

View File

@@ -28,6 +28,19 @@ describe 'glance::backend::swift' do
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('ref1')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('swift')
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_container').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_create_container_on_put').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_endpoint_type').with_value('internalURL')
is_expected.to contain_glance_cache_config('glance_store/swift_store_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
is_expected.to contain_glance_cache_config('glance_store/default_swift_reference').with_value('ref1')
end
it 'configures glance-swift.conf' do
is_expected.to contain_glance_swift_config('ref1/key').with_value('key')
is_expected.to contain_glance_swift_config('ref1/user').with_value('user')
is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('3')
@@ -64,6 +77,17 @@ describe 'glance::backend::swift' do
is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('swift_creds')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/swift_store_container').with_value('swift')
is_expected.to contain_glance_cache_config('glance_store/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_chunk_size').with_value('50')
is_expected.to contain_glance_cache_config('glance_store/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_cache_config('glance_store/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_cache_config('glance_store/default_swift_reference').with_value('swift_creds')
end
it 'configures glance-swift.conf' do
is_expected.to contain_glance_swift_config('swift_creds/key').with_value('key2')
is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2')
is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1')

View File

@@ -27,17 +27,17 @@ describe 'glance::backend::vsphere' do
end
shared_examples_for 'glance with vsphere backend' do
let :params do
{
:vcenter_host => '10.0.0.1',
:vcenter_user => 'root',
:vcenter_password => '123456',
:vcenter_datastores => 'Datacenter:Datastore',
:vcenter_image_dir => '/openstack_glance',
}
end
context 'when default parameters' do
let :params do
{
:vcenter_host => '10.0.0.1',
:vcenter_user => 'root',
:vcenter_password => '123456',
:vcenter_datastores => 'Datacenter:Datastore',
:vcenter_image_dir => '/openstack_glance',
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('vsphere')
is_expected.to contain_glance_api_config('glance_store/vmware_insecure').with_value('True')
@@ -50,26 +50,38 @@ describe 'glance::backend::vsphere' do
is_expected.to contain_glance_api_config('glance_store/vmware_datastores').with_value('Datacenter:Datastore')
is_expected.to contain_glance_api_config('glance_store/vmware_ca_file').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('vsphere')
is_expected.to contain_glance_cache_config('glance_store/vmware_insecure').with_value('True')
is_expected.to contain_glance_cache_config('glance_store/vmware_server_host').with_value('10.0.0.1')
is_expected.to contain_glance_cache_config('glance_store/vmware_server_username').with_value('root')
is_expected.to contain_glance_cache_config('glance_store/vmware_server_password').with_value('123456').with_secret(true)
is_expected.to contain_glance_cache_config('glance_store/vmware_store_image_dir').with_value('/openstack_glance')
is_expected.to contain_glance_cache_config('glance_store/vmware_task_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/vmware_api_retry_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/vmware_datastores').with_value('Datacenter:Datastore')
is_expected.to contain_glance_cache_config('glance_store/vmware_ca_file').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding parameters' do
let :params do
{
:vcenter_host => '10.0.0.1',
:vcenter_user => 'root',
:vcenter_password => '123456',
:vcenter_datastores => 'Datacenter:Datastore',
:vcenter_image_dir => '/openstack_glance',
before do
params.merge!({
:vcenter_ca_file => '/etc/glance/vcenter-ca.pem',
:vcenter_task_poll_interval => '6',
:vcenter_api_retry_count => '11',
}
})
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem')
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')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem')
is_expected.to contain_glance_cache_config('glance_store/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_cache_config('glance_store/vmware_api_retry_count').with_value('11')
end
end
end

View File

@@ -36,6 +36,10 @@ describe 'glance::backend::multistore::file' do
is_expected.to_not contain_glance_cache_config('file/store_description')
is_expected.to contain_glance_cache_config('file/filesystem_store_datadir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('file/filesystem_store_datadirs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('file/filesystem_store_metadata_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('file/filesystem_store_file_perm').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('file/filesystem_store_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('file/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
end
describe 'when overriding datadir' do
@@ -69,6 +73,14 @@ describe 'glance::backend::multistore::file' do
.with_value('/var/lib/glance/images')
is_expected.to contain_glance_cache_config('file/filesystem_store_datadirs')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('file/filesystem_store_metadata_file')\
.with_value('/var/lib/glance/metadata.json')
is_expected.to contain_glance_cache_config('file/filesystem_store_file_perm')\
.with_value(0)
is_expected.to contain_glance_cache_config('file/filesystem_store_chunk_size')\
.with_value(65536)
is_expected.to contain_glance_cache_config('file/filesystem_thin_provisioning')\
.with_value(true)
end
end

View File

@@ -29,6 +29,11 @@ describe 'glance::backend::multistore::http' do
should contain_glance_api_config('http/https_insecure').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('http/http_proxy_information')\
.with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('http/https_ca_certificates_file')\
.with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('http/https_insecure').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('http/http_proxy_information')\
.with_value('<SERVICE DEFAULT>')
end
end
@@ -47,6 +52,11 @@ describe 'glance::backend::multistore::http' do
should contain_glance_api_config('http/https_insecure').with_value(true)
should contain_glance_api_config('http/http_proxy_information')\
.with_value('http:10.0.0.1:3128,https:10.0.0.1:1080')
should contain_glance_cache_config('http/https_ca_certificates_file')\
.with_value('/etc/glance/https_ca_cert.pem')
should contain_glance_cache_config('http/https_insecure').with_value(true)
should contain_glance_cache_config('http/http_proxy_information')\
.with_value('http:10.0.0.1:3128,https:10.0.0.1:1080')
end
end

View File

@@ -23,13 +23,24 @@ describe 'glance::backend::multistore::rbd' do
shared_examples 'glance::backend::multistore::rbd' do
context 'with default params' do
it { should contain_glance_api_config('rbd/store_description').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('rbd/rbd_store_pool').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('rbd/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('rbd/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('rbd/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>') }
it { should contain_glance_api_config('rbd/rados_connect_timeout').with_value('<SERVICE DEFAULT>')}
it { should contain_glance_api_config('rbd/rbd_store_user').with_value('<SERVICE DEFAULT>')}
it 'configures glance-api.conf' do
should contain_glance_api_config('rbd/store_description').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('rbd/rbd_store_pool').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('rbd/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('rbd/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('rbd/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('rbd/rados_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('rbd/rbd_store_user').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
should_not contain_glance_cache_config('rbd/store_description')
should contain_glance_cache_config('rbd/rbd_store_pool').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('rbd/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('rbd/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('rbd/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('rbd/rados_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('rbd/rbd_store_user').with_value('<SERVICE DEFAULT>')
end
it { should contain_package('python-ceph').with(
:name => platform_params[:pyceph_package_name],
@@ -50,11 +61,20 @@ describe 'glance::backend::multistore::rbd' do
}
end
it { should contain_glance_api_config('rbd/store_description').with_value('My rbd store') }
it { should contain_glance_api_config('rbd/rbd_store_user').with_value('user') }
it { should contain_glance_api_config('rbd/rbd_store_chunk_size').with_value('2') }
it { should contain_glance_api_config('rbd/rbd_thin_provisioning').with_value('true') }
it { should contain_glance_api_config('rbd/rados_connect_timeout').with_value('30')}
it 'configures glance-api.conf' do
should contain_glance_api_config('rbd/store_description').with_value('My rbd store')
should contain_glance_api_config('rbd/rbd_store_user').with_value('user')
should contain_glance_api_config('rbd/rbd_store_chunk_size').with_value('2')
should contain_glance_api_config('rbd/rbd_thin_provisioning').with_value('true')
should contain_glance_api_config('rbd/rados_connect_timeout').with_value('30')
end
it 'configures glance-cache.conf' do
should_not contain_glance_cache_config('rbd/store_description')
should contain_glance_cache_config('rbd/rbd_store_user').with_value('user')
should contain_glance_cache_config('rbd/rbd_store_chunk_size').with_value('2')
should contain_glance_cache_config('rbd/rbd_thin_provisioning').with_value('true')
should contain_glance_cache_config('rbd/rados_connect_timeout').with_value('30')
end
it { should contain_package('python-ceph').with(
:name => platform_params[:pyceph_package_name],

View File

@@ -52,6 +52,23 @@ describe 'glance::backend::multistore::swift' do
is_expected.to contain_glance_api_config('swift/swift_buffer_on_upload').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('swift/swift_upload_buffer_dir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('swift/swift_store_retry_get_count').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
is_expected.to_not contain_glance_cache_config('swift/store_description')
is_expected.to contain_glance_cache_config('swift/swift_store_large_object_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_store_large_object_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_store_container').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_store_create_container_on_put').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_store_endpoint_type').with_value('internalURL')
is_expected.to contain_glance_cache_config('swift/swift_store_service_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_store_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
is_expected.to contain_glance_cache_config('swift/default_swift_reference').with_value('ref1')
is_expected.to contain_glance_cache_config('swift/swift_buffer_on_upload').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_upload_buffer_dir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('swift/swift_store_retry_get_count').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-swift.conf' do
is_expected.to contain_glance_swift_config('ref1/key').with_value('key').with_secret(true)
is_expected.to contain_glance_swift_config('ref1/user').with_value('user')
is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('3')
@@ -100,6 +117,23 @@ describe 'glance::backend::multistore::swift' do
is_expected.to contain_glance_api_config('swift/swift_buffer_on_upload').with_value(true)
is_expected.to contain_glance_api_config('swift/swift_upload_buffer_dir').with_value('/var/glance/swift')
is_expected.to contain_glance_api_config('swift/swift_store_retry_get_count').with_value(3)
end
it 'configures glance-cache.conf' do
is_expected.to_not contain_glance_cache_config('swift/store_description')
is_expected.to contain_glance_cache_config('swift/swift_store_container').with_value('swift')
is_expected.to contain_glance_cache_config('swift/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_cache_config('swift/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_cache_config('swift/swift_store_large_object_chunk_size').with_value('50')
is_expected.to contain_glance_cache_config('swift/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_cache_config('swift/swift_store_service_type').with_value('object-store')
is_expected.to contain_glance_cache_config('swift/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_cache_config('swift/swift_store_config_file').with_value('/etc/glance/glance-swift2.conf')
is_expected.to contain_glance_cache_config('swift/default_swift_reference').with_value('swift_creds')
is_expected.to contain_glance_cache_config('swift/swift_buffer_on_upload').with_value(true)
is_expected.to contain_glance_cache_config('swift/swift_upload_buffer_dir').with_value('/var/glance/swift')
is_expected.to contain_glance_cache_config('swift/swift_store_retry_get_count').with_value(3)
end
it 'configures glance-swift.conf' do
is_expected.to contain_glance_swift_config('swift_creds/key').with_value('key2').with_secret(true)
is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2')
is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1')

View File

@@ -26,17 +26,17 @@ describe 'glance::backend::multistore::vsphere' do
end
shared_examples_for 'glance::backend::multistore::vsphere' do
let :params do
{
:vmware_server_host => '10.0.0.1',
:vmware_server_username => 'root',
:vmware_server_password => '123456',
:vmware_datastores => 'Datacenter:Datastore',
:vmware_store_image_dir => '/openstack_glance',
}
end
context 'when default parameters' do
let :params do
{
:vmware_server_host => '10.0.0.1',
:vmware_server_username => 'root',
:vmware_server_password => '123456',
:vmware_datastores => 'Datacenter:Datastore',
:vmware_store_image_dir => '/openstack_glance',
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('vsphere/store_description').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('vsphere/vmware_insecure').with_value('True')
@@ -49,21 +49,28 @@ describe 'glance::backend::multistore::vsphere' do
is_expected.to contain_glance_api_config('vsphere/vmware_datastores').with_value('Datacenter:Datastore')
is_expected.to contain_glance_api_config('vsphere/vmware_ca_file').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
is_expected.to_not contain_glance_cache_config('vsphere/store_description')
is_expected.to contain_glance_cache_config('vsphere/vmware_insecure').with_value('True')
is_expected.to contain_glance_cache_config('vsphere/vmware_server_host').with_value('10.0.0.1')
is_expected.to contain_glance_cache_config('vsphere/vmware_server_username').with_value('root')
is_expected.to contain_glance_cache_config('vsphere/vmware_server_password').with_value('123456').with_secret(true)
is_expected.to contain_glance_cache_config('vsphere/vmware_store_image_dir').with_value('/openstack_glance')
is_expected.to contain_glance_cache_config('vsphere/vmware_task_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('vsphere/vmware_api_retry_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('vsphere/vmware_datastores').with_value('Datacenter:Datastore')
is_expected.to contain_glance_cache_config('vsphere/vmware_ca_file').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding parameters' do
let :params do
{
before do
params.merge!({
:store_description => 'My vsphere store',
:vmware_server_host => '10.0.0.1',
:vmware_server_username => 'root',
:vmware_server_password => '123456',
:vmware_datastores => 'Datacenter:Datastore',
:vmware_store_image_dir => '/openstack_glance',
:vmware_ca_file => '/etc/glance/vcenter-ca.pem',
:vmware_task_poll_interval => '6',
:vmware_api_retry_count => '11',
}
})
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('vsphere/store_description').with_value('My vsphere store')
@@ -71,6 +78,12 @@ describe 'glance::backend::multistore::vsphere' do
is_expected.to contain_glance_api_config('vsphere/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_api_config('vsphere/vmware_api_retry_count').with_value('11')
end
it 'configures glance-cache.conf' do
is_expected.to_not contain_glance_cache_config('vsphere/store_description')
is_expected.to contain_glance_cache_config('vsphere/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem')
is_expected.to contain_glance_cache_config('vsphere/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_cache_config('vsphere/vmware_api_retry_count').with_value('11')
end
end
end