From 30b188b1b9f0cdebd3f8cc00a7aa4ab9e16d9cb8 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 8 Sep 2023 12:18:05 +0900 Subject: [PATCH] Add support for store weight option This introduces the support for the weight option in each store which is used to sort locations. Depends-on: https://review.opendev.org/886811 Change-Id: Ia08ab9b396a9f7ba3ee1f41a81cb666e9a80ccde --- manifests/backend/multistore/cinder.pp | 10 +++++++++- manifests/backend/multistore/file.pp | 8 ++++++++ manifests/backend/multistore/http.pp | 8 ++++++++ manifests/backend/multistore/rbd.pp | 8 ++++++++ manifests/backend/multistore/s3.pp | 8 ++++++++ manifests/backend/multistore/swift.pp | 8 ++++++++ manifests/backend/multistore/vsphere.pp | 8 ++++++++ .../notes/store-weight-986ecfa153a9762e.yaml | 4 ++++ .../glance_backend_multistore_cinder_spec.rb | 5 +++++ .../glance_backend_multistore_file_spec.rb | 5 +++++ .../glance_backend_multistore_http_spec.rb | 19 +++++++++++-------- .../glance_backend_multistore_rbd_spec.rb | 5 +++++ .../glance_backend_multistore_s3_spec.rb | 5 +++++ .../glance_backend_multistore_swift_spec.rb | 5 +++++ .../glance_backend_multistore_vsphere_spec.rb | 5 +++++ 15 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/store-weight-986ecfa153a9762e.yaml diff --git a/manifests/backend/multistore/cinder.pp b/manifests/backend/multistore/cinder.pp index ba0491c6..06ee7abd 100644 --- a/manifests/backend/multistore/cinder.pp +++ b/manifests/backend/multistore/cinder.pp @@ -100,6 +100,11 @@ # end users. # Defaults to $facts['os_service_default']. # +# [*weight*] +# (optional) Define a relative weight for this store over any others that +# are configured. +# Defaults to $facts['os_service_default']. +# define glance::backend::multistore::cinder( $cinder_ca_certificates_file = $facts['os_service_default'], $cinder_api_insecure = $facts['os_service_default'], @@ -119,6 +124,7 @@ define glance::backend::multistore::cinder( $cinder_mount_point_base = $facts['os_service_default'], $cinder_do_extend_attached = $facts['os_service_default'], $store_description = $facts['os_service_default'], + $weight = $facts['os_service_default'], ) { include glance::deps @@ -142,6 +148,7 @@ define glance::backend::multistore::cinder( "${name}/cinder_mount_point_base": value => $cinder_mount_point_base; "${name}/cinder_do_extend_attached": value => $cinder_do_extend_attached; "${name}/store_description": value => $store_description; + "${name}/weight": value => $weight; } glance_cache_config { @@ -159,8 +166,9 @@ define glance::backend::multistore::cinder( "${name}/cinder_os_region_name": value => $cinder_os_region_name; "${name}/cinder_volume_type": value => $cinder_volume_type; "${name}/cinder_enforce_multipath": value => $cinder_enforce_multipath; + "${name}/cinder_use_multipath": value => $cinder_use_multipath; "${name}/cinder_mount_point_base": value => $cinder_mount_point_base; "${name}/cinder_do_extend_attached": value => $cinder_do_extend_attached; - "${name}/cinder_use_multipath": value => $cinder_use_multipath; + "${name}/weight": value => $weight; } } diff --git a/manifests/backend/multistore/file.pp b/manifests/backend/multistore/file.pp index 7e17734f..12fb67c4 100644 --- a/manifests/backend/multistore/file.pp +++ b/manifests/backend/multistore/file.pp @@ -51,6 +51,11 @@ # end users. # Defaults to $facts['os_service_default']. # +# [*weight*] +# (optional) Define a relative weight for this store over any others that +# are configured. +# Defaults to $facts['os_service_default']. +# define glance::backend::multistore::file( $filesystem_store_datadir = $facts['os_service_default'], $filesystem_store_datadirs = $facts['os_service_default'], @@ -59,6 +64,7 @@ define glance::backend::multistore::file( $filesystem_store_chunk_size = $facts['os_service_default'], $filesystem_thin_provisioning = $facts['os_service_default'], $store_description = $facts['os_service_default'], + $weight = $facts['os_service_default'], ) { include glance::deps @@ -73,6 +79,7 @@ define glance::backend::multistore::file( "${name}/filesystem_store_chunk_size": value => $filesystem_store_chunk_size; "${name}/filesystem_thin_provisioning": value => $filesystem_thin_provisioning; "${name}/store_description": value => $store_description; + "${name}/weight": value => $weight; } if $name != 'glance_store' { @@ -92,5 +99,6 @@ define glance::backend::multistore::file( "${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; + "${name}/weight": value => $weight; } } diff --git a/manifests/backend/multistore/http.pp b/manifests/backend/multistore/http.pp index a42cb595..c158878d 100644 --- a/manifests/backend/multistore/http.pp +++ b/manifests/backend/multistore/http.pp @@ -32,10 +32,16 @@ # remote server. # Defaults to $facts['os_service_default'] # +# [*weight*] +# (optional) Define a relative weight for this store over any others that +# are configured. +# Defaults to $facts['os_service_default']. +# define glance::backend::multistore::http( $https_ca_certificates_file = $facts['os_service_default'], $https_insecure = $facts['os_service_default'], $http_proxy_information = $facts['os_service_default'], + $weight = $facts['os_service_default'], ) { include glance::deps @@ -55,11 +61,13 @@ define glance::backend::multistore::http( "${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), ','); + "${name}/weight": value => $weight; } 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), ','); + "${name}/weight": value => $weight; } } diff --git a/manifests/backend/multistore/rbd.pp b/manifests/backend/multistore/rbd.pp index 651a46bd..bd179516 100644 --- a/manifests/backend/multistore/rbd.pp +++ b/manifests/backend/multistore/rbd.pp @@ -56,6 +56,11 @@ # end users. # Defaults to $facts['os_service_default']. # +# [*weight*] +# (optional) Define a relative weight for this store over any others that +# are configured. +# Defaults to $facts['os_service_default']. +# define glance::backend::multistore::rbd( $rbd_store_user = $facts['os_service_default'], $rbd_store_ceph_conf = $facts['os_service_default'], @@ -66,6 +71,7 @@ define glance::backend::multistore::rbd( $package_ensure = 'present', $rados_connect_timeout = $facts['os_service_default'], $store_description = $facts['os_service_default'], + $weight = $facts['os_service_default'], ) { include glance::deps @@ -79,6 +85,7 @@ define glance::backend::multistore::rbd( "${name}/rbd_thin_provisioning": value => $rbd_thin_provisioning; "${name}/rados_connect_timeout": value => $rados_connect_timeout; "${name}/store_description": value => $store_description; + "${name}/weight": value => $weight; } glance_cache_config { @@ -88,6 +95,7 @@ define glance::backend::multistore::rbd( "${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}/weight": value => $weight; } if $manage_packages { diff --git a/manifests/backend/multistore/s3.pp b/manifests/backend/multistore/s3.pp index c62a6326..22c286c6 100644 --- a/manifests/backend/multistore/s3.pp +++ b/manifests/backend/multistore/s3.pp @@ -62,6 +62,11 @@ # end users. # Defaults to $facts['os_service_default']. # +# [*weight*] +# (optional) Define a relative weight for this store over any others that +# are configured. +# Defaults to $facts['os_service_default']. +# # [*manage_packages*] # Optional. Whether we should manage the packages. # Defaults to true, @@ -82,6 +87,7 @@ define glance::backend::multistore::s3( $s3_store_large_object_chunk_size = $facts['os_service_default'], $s3_store_thread_pools = $facts['os_service_default'], $store_description = $facts['os_service_default'], + $weight = $facts['os_service_default'], Boolean $manage_packages = true, $package_ensure = 'present', ) { @@ -108,6 +114,7 @@ define glance::backend::multistore::s3( "${name}/s3_store_large_object_chunk_size": value => $s3_store_large_object_chunk_size; "${name}/s3_store_thread_pools": value => $s3_store_thread_pools; "${name}/store_description": value => $store_description; + "${name}/weight": value => $weight; } glance_cache_config { @@ -120,5 +127,6 @@ define glance::backend::multistore::s3( "${name}/s3_store_large_object_size": value => $s3_store_large_object_size; "${name}/s3_store_large_object_chunk_size": value => $s3_store_large_object_chunk_size; "${name}/s3_store_thread_pools": value => $s3_store_thread_pools; + "${name}/weight": value => $weight; } } diff --git a/manifests/backend/multistore/swift.pp b/manifests/backend/multistore/swift.pp index 2cc802af..42e91e8a 100644 --- a/manifests/backend/multistore/swift.pp +++ b/manifests/backend/multistore/swift.pp @@ -91,6 +91,11 @@ # end users. # Defaults to $facts['os_service_default']. # +# [*weight*] +# (optional) Define a relative weight for this store over any others that +# are configured. +# Defaults to $facts['os_service_default']. +# # DEPRECATED PARAMETERS # # [*swift_store_config_file*] @@ -115,6 +120,7 @@ define glance::backend::multistore::swift( $swift_upload_buffer_dir = $facts['os_service_default'], $swift_store_retry_get_count = $facts['os_service_default'], $store_description = $facts['os_service_default'], + $weight = $facts['os_service_default'], # DEPRECATED PARAMETERS $swift_store_config_file = undef, ) { @@ -146,6 +152,7 @@ define glance::backend::multistore::swift( "${name}/swift_upload_buffer_dir": value => $swift_upload_buffer_dir; "${name}/swift_store_retry_get_count": value => $swift_store_retry_get_count; "${name}/store_description": value => $store_description; + "${name}/weight": value => $weight; } glance_cache_config { "${name}/swift_store_region": value => $swift_store_region; @@ -160,6 +167,7 @@ define glance::backend::multistore::swift( "${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; + "${name}/weight": value => $weight; } glance_swift_config { diff --git a/manifests/backend/multistore/vsphere.pp b/manifests/backend/multistore/vsphere.pp index ff020cb7..2160035d 100644 --- a/manifests/backend/multistore/vsphere.pp +++ b/manifests/backend/multistore/vsphere.pp @@ -77,6 +77,11 @@ # end users. # Defaults to $facts['os_service_default']. # +# [*weight*] +# (optional) Define a relative weight for this store over any others that +# are configured. +# Defaults to $facts['os_service_default']. +# define glance::backend::multistore::vsphere( $vmware_server_host, $vmware_server_username, @@ -88,6 +93,7 @@ define glance::backend::multistore::vsphere( $vmware_task_poll_interval = $facts['os_service_default'], $vmware_api_retry_count = $facts['os_service_default'], $store_description = $facts['os_service_default'], + $weight = $facts['os_service_default'], ) { include glance::deps @@ -103,6 +109,7 @@ define glance::backend::multistore::vsphere( "${name}/vmware_api_retry_count": value => $vmware_api_retry_count; "${name}/vmware_datastores": value => $vmware_datastores; "${name}/store_description": value => $store_description; + "${name}/weight": value => $weight; } glance_cache_config { @@ -115,5 +122,6 @@ define glance::backend::multistore::vsphere( "${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; + "${name}/weight": value => $weight; } } diff --git a/releasenotes/notes/store-weight-986ecfa153a9762e.yaml b/releasenotes/notes/store-weight-986ecfa153a9762e.yaml new file mode 100644 index 00000000..19b01b55 --- /dev/null +++ b/releasenotes/notes/store-weight-986ecfa153a9762e.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Support for the ``weight`` option in store backends has been added. diff --git a/spec/defines/glance_backend_multistore_cinder_spec.rb b/spec/defines/glance_backend_multistore_cinder_spec.rb index 09f0aec5..d9503472 100644 --- a/spec/defines/glance_backend_multistore_cinder_spec.rb +++ b/spec/defines/glance_backend_multistore_cinder_spec.rb @@ -31,6 +31,7 @@ describe 'glance::backend::multistore::cinder' do it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('cinder/store_description').with_value('') + is_expected.to contain_glance_api_config('cinder/weight').with_value('') is_expected.to contain_glance_api_config('cinder/cinder_api_insecure').with_value('') is_expected.to contain_glance_api_config('cinder/cinder_catalog_info').with_value('') is_expected.to contain_glance_api_config('cinder/cinder_http_retries').with_value('') @@ -51,6 +52,7 @@ describe 'glance::backend::multistore::cinder' do end it 'configures glance-cache.conf' do is_expected.to_not contain_glance_cache_config('cinder/store_description') + is_expected.to contain_glance_cache_config('cinder/weight').with_value('') is_expected.to contain_glance_cache_config('cinder/cinder_api_insecure').with_value('') is_expected.to contain_glance_cache_config('cinder/cinder_catalog_info').with_value('') is_expected.to contain_glance_cache_config('cinder/cinder_http_retries').with_value('') @@ -75,6 +77,7 @@ describe 'glance::backend::multistore::cinder' do let :params do { :store_description => 'My cinder store', + :weight => 0, :cinder_api_insecure => true, :cinder_ca_certificates_file => '/etc/ssh/ca.crt', :cinder_catalog_info => 'volume:cinder:internalURL', @@ -96,6 +99,7 @@ describe 'glance::backend::multistore::cinder' do end it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('cinder/store_description').with_value('My cinder store') + is_expected.to contain_glance_api_config('cinder/weight').with_value(0) is_expected.to contain_glance_api_config('cinder/cinder_api_insecure').with_value(true) is_expected.to contain_glance_api_config('cinder/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt') is_expected.to contain_glance_api_config('cinder/cinder_catalog_info').with_value('volume:cinder:internalURL') @@ -116,6 +120,7 @@ describe 'glance::backend::multistore::cinder' do end it 'configures glance-cache.conf' do is_expected.to_not contain_glance_cache_config('cinder/store_description') + is_expected.to contain_glance_cache_config('cinder/weight').with_value(0) is_expected.to contain_glance_cache_config('cinder/cinder_api_insecure').with_value(true) is_expected.to contain_glance_cache_config('cinder/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt') is_expected.to contain_glance_cache_config('cinder/cinder_catalog_info').with_value('volume:cinder:internalURL') diff --git a/spec/defines/glance_backend_multistore_file_spec.rb b/spec/defines/glance_backend_multistore_file_spec.rb index 84472b1d..f54297da 100644 --- a/spec/defines/glance_backend_multistore_file_spec.rb +++ b/spec/defines/glance_backend_multistore_file_spec.rb @@ -24,6 +24,7 @@ describe 'glance::backend::multistore::file' do shared_examples_for 'glance::backend::multistore::file' do it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('file/store_description').with_value('') + is_expected.to contain_glance_api_config('file/weight').with_value('') is_expected.to contain_glance_api_config('file/filesystem_store_datadir').with_value('') is_expected.to contain_glance_api_config('file/filesystem_store_datadirs').with_value('') is_expected.to contain_glance_api_config('file/filesystem_store_metadata_file').with_value('') @@ -34,6 +35,7 @@ describe 'glance::backend::multistore::file' do it 'configures glance-cache.conf' do is_expected.to_not contain_glance_cache_config('file/store_description') + is_expected.to contain_glance_cache_config('file/weight').with_value('') 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('') @@ -45,6 +47,7 @@ describe 'glance::backend::multistore::file' do describe 'when overriding datadir' do let :params do { + :weight => 0, :filesystem_store_datadir => '/var/lib/glance/images', :filesystem_store_metadata_file => '/var/lib/glance/metadata.json', :filesystem_store_file_perm => 0, @@ -54,6 +57,7 @@ describe 'glance::backend::multistore::file' do end it 'configures glance-api.conf' do + is_expected.to contain_glance_api_config('file/weight').with_value(0) is_expected.to contain_glance_api_config('file/filesystem_store_datadir')\ .with_value('/var/lib/glance/images') is_expected.to contain_glance_api_config('file/filesystem_store_datadirs')\ @@ -69,6 +73,7 @@ describe 'glance::backend::multistore::file' do end it 'configures glance-cache.conf' do + is_expected.to contain_glance_cache_config('file/weight').with_value(0) is_expected.to contain_glance_cache_config('file/filesystem_store_datadir')\ .with_value('/var/lib/glance/images') is_expected.to contain_glance_cache_config('file/filesystem_store_datadirs')\ diff --git a/spec/defines/glance_backend_multistore_http_spec.rb b/spec/defines/glance_backend_multistore_http_spec.rb index 130c2b27..bf11ce06 100644 --- a/spec/defines/glance_backend_multistore_http_spec.rb +++ b/spec/defines/glance_backend_multistore_http_spec.rb @@ -24,22 +24,22 @@ describe 'glance::backend::multistore::http' do shared_examples 'glance::backend::multistore::http' do context 'with default params' do it 'sets the default values' do - should contain_glance_api_config('http/https_ca_certificates_file')\ - .with_value('') + should contain_glance_api_config('http/weight').with_value('') + should contain_glance_api_config('http/https_ca_certificates_file').with_value('') 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_api_config('http/http_proxy_information').with_value('') + + should contain_glance_cache_config('http/weight').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('') + should contain_glance_cache_config('http/http_proxy_information').with_value('') end end context 'when passing params' do let :params do { + :weight => 0, :https_ca_certificates_file => '/etc/glance/https_ca_cert.pem', :https_insecure => true, :http_proxy_information => ['http:10.0.0.1:3128', 'https:10.0.0.1:1080'], @@ -47,11 +47,14 @@ describe 'glance::backend::multistore::http' do end it 'sets the given values' do + should contain_glance_api_config('http/weight').with_value(0) should contain_glance_api_config('http/https_ca_certificates_file')\ .with_value('/etc/glance/https_ca_cert.pem') 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/weight').with_value(0) 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) diff --git a/spec/defines/glance_backend_multistore_rbd_spec.rb b/spec/defines/glance_backend_multistore_rbd_spec.rb index ce29f8b1..fc16c2c2 100644 --- a/spec/defines/glance_backend_multistore_rbd_spec.rb +++ b/spec/defines/glance_backend_multistore_rbd_spec.rb @@ -25,6 +25,7 @@ describe 'glance::backend::multistore::rbd' do context 'with default params' do it 'configures glance-api.conf' do should contain_glance_api_config('rbd/store_description').with_value('') + should contain_glance_api_config('rbd/weight').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('') @@ -34,6 +35,7 @@ describe 'glance::backend::multistore::rbd' do end it 'configures glance-cache.conf' do should_not contain_glance_cache_config('rbd/store_description') + should contain_glance_cache_config('rbd/weight').with_value('') 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('') @@ -53,6 +55,7 @@ describe 'glance::backend::multistore::rbd' do let :params do { :store_description => 'My rbd store', + :weight => 0, :rbd_store_user => 'user', :rbd_store_chunk_size => '2', :rbd_thin_provisioning => 'true', @@ -63,6 +66,7 @@ describe 'glance::backend::multistore::rbd' do 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/weight').with_value(0) 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') @@ -70,6 +74,7 @@ describe 'glance::backend::multistore::rbd' do end it 'configures glance-cache.conf' do should_not contain_glance_cache_config('rbd/store_description') + should contain_glance_cache_config('rbd/weight').with_value(0) 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') diff --git a/spec/defines/glance_backend_multistore_s3_spec.rb b/spec/defines/glance_backend_multistore_s3_spec.rb index d24971bd..ed8358af 100644 --- a/spec/defines/glance_backend_multistore_s3_spec.rb +++ b/spec/defines/glance_backend_multistore_s3_spec.rb @@ -42,6 +42,7 @@ describe 'glance::backend::multistore::s3' do it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('s3/store_description').with_value('') + is_expected.to contain_glance_api_config('s3/weight').with_value('') is_expected.to contain_glance_api_config('s3/s3_store_host').with_value('host') is_expected.to contain_glance_api_config('s3/s3_store_access_key').with_value('access').with_secret(true) is_expected.to contain_glance_api_config('s3/s3_store_secret_key').with_value('secret').with_secret(true) @@ -55,6 +56,7 @@ describe 'glance::backend::multistore::s3' do it 'configures glance-cache.conf' do is_expected.to_not contain_glance_cache_config('s3/store_description') + is_expected.to contain_glance_cache_config('s3/weight').with_value('') is_expected.to contain_glance_cache_config('s3/s3_store_host').with_value('host') is_expected.to contain_glance_cache_config('s3/s3_store_access_key').with_value('access').with_secret(true) is_expected.to contain_glance_cache_config('s3/s3_store_secret_key').with_value('secret').with_secret(true) @@ -71,6 +73,7 @@ describe 'glance::backend::multistore::s3' do before :each do params.merge!({ :store_description => 's3store', + :weight => 0, :s3_store_create_bucket_on_put => false, :s3_store_bucket_url_format => 'auto', :s3_store_large_object_size => 100, @@ -90,6 +93,7 @@ describe 'glance::backend::multistore::s3' do it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('s3/store_description').with_value('s3store') + is_expected.to contain_glance_api_config('s3/weight').with_value(0) is_expected.to contain_glance_api_config('s3/s3_store_host').with_value('host') is_expected.to contain_glance_api_config('s3/s3_store_access_key').with_value('access').with_secret(true) is_expected.to contain_glance_api_config('s3/s3_store_secret_key').with_value('secret').with_secret(true) @@ -103,6 +107,7 @@ describe 'glance::backend::multistore::s3' do it 'configures glance-cache.conf' do is_expected.to_not contain_glance_cache_config('s3/store_description') + is_expected.to contain_glance_cache_config('s3/weight').with_value(0) is_expected.to contain_glance_cache_config('s3/s3_store_host').with_value('host') is_expected.to contain_glance_cache_config('s3/s3_store_access_key').with_value('access').with_secret(true) is_expected.to contain_glance_cache_config('s3/s3_store_secret_key').with_value('secret').with_secret(true) diff --git a/spec/defines/glance_backend_multistore_swift_spec.rb b/spec/defines/glance_backend_multistore_swift_spec.rb index 5eb81fdf..4ff544ea 100644 --- a/spec/defines/glance_backend_multistore_swift_spec.rb +++ b/spec/defines/glance_backend_multistore_swift_spec.rb @@ -40,6 +40,7 @@ describe 'glance::backend::multistore::swift' do it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('swift/store_description').with_value('') + is_expected.to contain_glance_api_config('swift/weight').with_value('') is_expected.to contain_glance_api_config('swift/swift_store_large_object_size').with_value('') is_expected.to contain_glance_api_config('swift/swift_store_large_object_chunk_size').with_value('') is_expected.to contain_glance_api_config('swift/swift_store_container').with_value('') @@ -55,6 +56,7 @@ describe 'glance::backend::multistore::swift' do 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/weight').with_value('') 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('') @@ -82,6 +84,7 @@ describe 'glance::backend::multistore::swift' do let :params do { :store_description => 'My swift store', + :weight => 0, :swift_store_user => 'user2', :swift_store_key => 'key2', :swift_store_auth_version => '1', @@ -105,6 +108,7 @@ describe 'glance::backend::multistore::swift' do it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('swift/store_description').with_value('My swift store') + is_expected.to contain_glance_api_config('swift/weight').with_value(0) is_expected.to contain_glance_api_config('swift/swift_store_container').with_value('swift') is_expected.to contain_glance_api_config('swift/swift_store_create_container_on_put').with_value(true) is_expected.to contain_glance_api_config('swift/swift_store_large_object_size').with_value('100') @@ -120,6 +124,7 @@ describe 'glance::backend::multistore::swift' do 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/weight').with_value(0) 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') diff --git a/spec/defines/glance_backend_multistore_vsphere_spec.rb b/spec/defines/glance_backend_multistore_vsphere_spec.rb index 623c6ab3..6573b0b8 100644 --- a/spec/defines/glance_backend_multistore_vsphere_spec.rb +++ b/spec/defines/glance_backend_multistore_vsphere_spec.rb @@ -39,6 +39,7 @@ describe 'glance::backend::multistore::vsphere' do context 'when default parameters' do 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/weight').with_value('') is_expected.to contain_glance_api_config('vsphere/vmware_insecure').with_value('True') is_expected.to contain_glance_api_config('vsphere/vmware_server_host').with_value('10.0.0.1') is_expected.to contain_glance_api_config('vsphere/vmware_server_username').with_value('root') @@ -51,6 +52,7 @@ describe 'glance::backend::multistore::vsphere' do 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/weight').with_value('') 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') @@ -67,6 +69,7 @@ describe 'glance::backend::multistore::vsphere' do before do params.merge!({ :store_description => 'My vsphere store', + :weight => 0, :vmware_ca_file => '/etc/glance/vcenter-ca.pem', :vmware_task_poll_interval => '6', :vmware_api_retry_count => '11', @@ -74,12 +77,14 @@ describe 'glance::backend::multistore::vsphere' do end it 'configures glance-api.conf' do is_expected.to contain_glance_api_config('vsphere/store_description').with_value('My vsphere store') + is_expected.to contain_glance_api_config('vsphere/weight').with_value(0) is_expected.to contain_glance_api_config('vsphere/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem') 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/weight').with_value(0) 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')