diff --git a/manifests/api.pp b/manifests/api.pp index 2bebedab..5c61b09a 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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), ','); diff --git a/manifests/backend/cinder.pp b/manifests/backend/cinder.pp index 998a5283..675eaaf4 100644 --- a/manifests/backend/cinder.pp +++ b/manifests/backend/cinder.pp @@ -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'; } } } diff --git a/manifests/backend/file.pp b/manifests/backend/file.pp index c2992962..0030d092 100644 --- a/manifests/backend/file.pp +++ b/manifests/backend/file.pp @@ -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'; } } } diff --git a/manifests/backend/multistore/file.pp b/manifests/backend/multistore/file.pp index 16b1bf8c..7e17734f 100644 --- a/manifests/backend/multistore/file.pp +++ b/manifests/backend/multistore/file.pp @@ -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; } } diff --git a/manifests/backend/multistore/http.pp b/manifests/backend/multistore/http.pp index ee33e9bb..a42cb595 100644 --- a/manifests/backend/multistore/http.pp +++ b/manifests/backend/multistore/http.pp @@ -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), ','); + } } diff --git a/manifests/backend/multistore/rbd.pp b/manifests/backend/multistore/rbd.pp index a4a55259..651a46bd 100644 --- a/manifests/backend/multistore/rbd.pp +++ b/manifests/backend/multistore/rbd.pp @@ -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 { diff --git a/manifests/backend/multistore/swift.pp b/manifests/backend/multistore/swift.pp index 6292238e..2cc802af 100644 --- a/manifests/backend/multistore/swift.pp +++ b/manifests/backend/multistore/swift.pp @@ -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; diff --git a/manifests/backend/multistore/vsphere.pp b/manifests/backend/multistore/vsphere.pp index 8c4e921a..ff020cb7 100644 --- a/manifests/backend/multistore/vsphere.pp +++ b/manifests/backend/multistore/vsphere.pp @@ -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; + } } diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index 9489fb32..eb2729ef 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -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'; } } } diff --git a/manifests/backend/swift.pp b/manifests/backend/swift.pp index b517b9f1..978a66e2 100644 --- a/manifests/backend/swift.pp +++ b/manifests/backend/swift.pp @@ -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'; } } } diff --git a/manifests/backend/vsphere.pp b/manifests/backend/vsphere.pp index a64a4e0b..6a98a077 100644 --- a/manifests/backend/vsphere.pp +++ b/manifests/backend/vsphere.pp @@ -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'; } } } diff --git a/spec/classes/glance_api_spec.rb b/spec/classes/glance_api_spec.rb index a9ab14d3..9b593cb9 100644 --- a/spec/classes/glance_api_spec.rb +++ b/spec/classes/glance_api_spec.rb @@ -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('') } it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('') } + + it { is_expected.to_not contain_glance_cache_config('DEFAULT/enabled_backends').with_value('') } + it { is_expected.to_not contain_glance_cache_config('glance_store/stores').with_value('') } 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 diff --git a/spec/classes/glance_backend_cinder_spec.rb b/spec/classes/glance_backend_cinder_spec.rb index 002c0866..1dc0687c 100644 --- a/spec/classes/glance_backend_cinder_spec.rb +++ b/spec/classes/glance_backend_cinder_spec.rb @@ -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('') is_expected.to contain_glance_api_config('glance_store/cinder_catalog_info').with_value('') @@ -45,6 +44,7 @@ describe 'glance::backend::cinder' do is_expected.to contain_glance_api_config('glance_store/cinder_store_password').with_value('') 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('') is_expected.to contain_glance_cache_config('glance_store/cinder_catalog_info').with_value('') is_expected.to contain_glance_cache_config('glance_store/cinder_http_retries').with_value('') diff --git a/spec/classes/glance_backend_file_spec.rb b/spec/classes/glance_backend_file_spec.rb index ce9371bf..3de9e3a1 100644 --- a/spec/classes/glance_backend_file_spec.rb +++ b/spec/classes/glance_backend_file_spec.rb @@ -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('') 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 diff --git a/spec/classes/glance_backend_rbd_spec.rb b/spec/classes/glance_backend_rbd_spec.rb index 787e3e2d..973b6ef5 100644 --- a/spec/classes/glance_backend_rbd_spec.rb +++ b/spec/classes/glance_backend_rbd_spec.rb @@ -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('') } - it { should contain_glance_api_config('glance_store/rbd_store_ceph_conf').with_value('') } - it { should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('') } - it { should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('') } - it { should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('')} - it { should contain_glance_api_config('glance_store/rbd_store_user').with_value('')} + 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('') + should contain_glance_api_config('glance_store/rbd_store_ceph_conf').with_value('') + should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('') + should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('') + should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('') + should contain_glance_api_config('glance_store/rbd_store_user').with_value('') + 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('') + should contain_glance_cache_config('glance_store/rbd_store_ceph_conf').with_value('') + should contain_glance_cache_config('glance_store/rbd_store_chunk_size').with_value('') + should contain_glance_cache_config('glance_store/rbd_thin_provisioning').with_value('') + should contain_glance_cache_config('glance_store/rados_connect_timeout').with_value('') + should contain_glance_cache_config('glance_store/rbd_store_user').with_value('') + 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], diff --git a/spec/classes/glance_backend_swift_spec.rb b/spec/classes/glance_backend_swift_spec.rb index b1a079ed..defa1644 100644 --- a/spec/classes/glance_backend_swift_spec.rb +++ b/spec/classes/glance_backend_swift_spec.rb @@ -28,6 +28,19 @@ describe 'glance::backend::swift' do is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value('') 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('') + is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_chunk_size').with_value('') + is_expected.to contain_glance_cache_config('glance_store/swift_store_container').with_value('') + is_expected.to contain_glance_cache_config('glance_store/swift_store_create_container_on_put').with_value('') + 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('') + 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') diff --git a/spec/classes/glance_backend_vsphere_spec.rb b/spec/classes/glance_backend_vsphere_spec.rb index 6ddd53e2..ca88014f 100644 --- a/spec/classes/glance_backend_vsphere_spec.rb +++ b/spec/classes/glance_backend_vsphere_spec.rb @@ -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('') 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('') + is_expected.to contain_glance_cache_config('glance_store/vmware_api_retry_count').with_value('') + 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('') + 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 diff --git a/spec/defines/glance_backend_multistore_file_spec.rb b/spec/defines/glance_backend_multistore_file_spec.rb index f65c7bbb..84472b1d 100644 --- a/spec/defines/glance_backend_multistore_file_spec.rb +++ b/spec/defines/glance_backend_multistore_file_spec.rb @@ -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('') is_expected.to contain_glance_cache_config('file/filesystem_store_datadirs').with_value('') + is_expected.to contain_glance_cache_config('file/filesystem_store_metadata_file').with_value('') + is_expected.to contain_glance_cache_config('file/filesystem_store_file_perm').with_value('') + is_expected.to contain_glance_cache_config('file/filesystem_store_chunk_size').with_value('') + is_expected.to contain_glance_cache_config('file/filesystem_thin_provisioning').with_value('') 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('') + 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 diff --git a/spec/defines/glance_backend_multistore_http_spec.rb b/spec/defines/glance_backend_multistore_http_spec.rb index 58ae1101..130c2b27 100644 --- a/spec/defines/glance_backend_multistore_http_spec.rb +++ b/spec/defines/glance_backend_multistore_http_spec.rb @@ -29,6 +29,11 @@ describe 'glance::backend::multistore::http' do should contain_glance_api_config('http/https_insecure').with_value('') should contain_glance_api_config('http/http_proxy_information')\ .with_value('') + should contain_glance_cache_config('http/https_ca_certificates_file')\ + .with_value('') + should contain_glance_cache_config('http/https_insecure').with_value('') + should contain_glance_cache_config('http/http_proxy_information')\ + .with_value('') 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 diff --git a/spec/defines/glance_backend_multistore_rbd_spec.rb b/spec/defines/glance_backend_multistore_rbd_spec.rb index ae5c776d..ce29f8b1 100644 --- a/spec/defines/glance_backend_multistore_rbd_spec.rb +++ b/spec/defines/glance_backend_multistore_rbd_spec.rb @@ -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('') } - it { should contain_glance_api_config('rbd/rbd_store_pool').with_value('') } - it { should contain_glance_api_config('rbd/rbd_store_ceph_conf').with_value('') } - it { should contain_glance_api_config('rbd/rbd_store_chunk_size').with_value('') } - it { should contain_glance_api_config('rbd/rbd_thin_provisioning').with_value('') } - it { should contain_glance_api_config('rbd/rados_connect_timeout').with_value('')} - it { should contain_glance_api_config('rbd/rbd_store_user').with_value('')} + it 'configures glance-api.conf' do + should contain_glance_api_config('rbd/store_description').with_value('') + should contain_glance_api_config('rbd/rbd_store_pool').with_value('') + should contain_glance_api_config('rbd/rbd_store_ceph_conf').with_value('') + should contain_glance_api_config('rbd/rbd_store_chunk_size').with_value('') + should contain_glance_api_config('rbd/rbd_thin_provisioning').with_value('') + should contain_glance_api_config('rbd/rados_connect_timeout').with_value('') + should contain_glance_api_config('rbd/rbd_store_user').with_value('') + 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('') + should contain_glance_cache_config('rbd/rbd_store_ceph_conf').with_value('') + should contain_glance_cache_config('rbd/rbd_store_chunk_size').with_value('') + should contain_glance_cache_config('rbd/rbd_thin_provisioning').with_value('') + should contain_glance_cache_config('rbd/rados_connect_timeout').with_value('') + should contain_glance_cache_config('rbd/rbd_store_user').with_value('') + 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], diff --git a/spec/defines/glance_backend_multistore_swift_spec.rb b/spec/defines/glance_backend_multistore_swift_spec.rb index a770bc6c..5eb81fdf 100644 --- a/spec/defines/glance_backend_multistore_swift_spec.rb +++ b/spec/defines/glance_backend_multistore_swift_spec.rb @@ -52,6 +52,23 @@ describe 'glance::backend::multistore::swift' do is_expected.to contain_glance_api_config('swift/swift_buffer_on_upload').with_value('') is_expected.to contain_glance_api_config('swift/swift_upload_buffer_dir').with_value('') is_expected.to contain_glance_api_config('swift/swift_store_retry_get_count').with_value('') + 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('') + is_expected.to contain_glance_cache_config('swift/swift_store_large_object_chunk_size').with_value('') + is_expected.to contain_glance_cache_config('swift/swift_store_container').with_value('') + is_expected.to contain_glance_cache_config('swift/swift_store_create_container_on_put').with_value('') + 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('') + is_expected.to contain_glance_cache_config('swift/swift_store_region').with_value('') + 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('') + is_expected.to contain_glance_cache_config('swift/swift_upload_buffer_dir').with_value('') + is_expected.to contain_glance_cache_config('swift/swift_store_retry_get_count').with_value('') + 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') diff --git a/spec/defines/glance_backend_multistore_vsphere_spec.rb b/spec/defines/glance_backend_multistore_vsphere_spec.rb index 5375e1f8..623c6ab3 100644 --- a/spec/defines/glance_backend_multistore_vsphere_spec.rb +++ b/spec/defines/glance_backend_multistore_vsphere_spec.rb @@ -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('') 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('') 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('') + is_expected.to contain_glance_cache_config('vsphere/vmware_api_retry_count').with_value('') + 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('') + 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