From 5c8d8e80d314884862015238a6739f2762bbfa77 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 13 Feb 2019 13:05:33 +0100 Subject: [PATCH] Add cloudkitty::storage_version This adds the storage/version configuration option that can be used in combination with storage_backend to select the backend and version to use. Also fixes acceptance testing so that the testing actually passes without us needing to set it to nv. Change-Id: I7a17889b60c4e72e559ace248f24ccfd53db809a --- manifests/init.pp | 6 ++++++ releasenotes/notes/storage-version-6d2569db240bd23d.yaml | 5 +++++ spec/acceptance/cloudkitty_wsgi_apache_spec.rb | 5 +++++ spec/classes/cloudkitty_init_spec.rb | 3 +++ 4 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/storage-version-6d2569db240bd23d.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 5bdf6bd..79abfea 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -226,6 +226,10 @@ # (Optional) Name of the storage backend driver. # Defaults to $::os_service_default. # +# [*storage_version*] +# (Optional) Version of the storage backend to use. +# Defaults to $::os_service_default +# # [*tenant_fetcher_backend*] # (Optional) Driver used to fetch tenant list. # Defaults to $::os_service_default. @@ -284,6 +288,7 @@ class cloudkitty( $output_basepath = $::os_service_default, $pipeline = $::os_service_default, $storage_backend = $::os_service_default, + $storage_version = $::os_service_default, $tenant_fetcher_backend = $::os_service_default, $auth_section = 'keystone_authtoken', $keystone_version = '3', @@ -369,6 +374,7 @@ class cloudkitty( cloudkitty_config { 'storage/backend': value => $storage_backend; + 'storage/version': value => $storage_version; 'tenant_fetcher/backend': value => $tenant_fetcher_backend; } diff --git a/releasenotes/notes/storage-version-6d2569db240bd23d.yaml b/releasenotes/notes/storage-version-6d2569db240bd23d.yaml new file mode 100644 index 0000000..3f86919 --- /dev/null +++ b/releasenotes/notes/storage-version-6d2569db240bd23d.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added cloudkitty::storage_version that can be used to set the version of + the storage backend. diff --git a/spec/acceptance/cloudkitty_wsgi_apache_spec.rb b/spec/acceptance/cloudkitty_wsgi_apache_spec.rb index e6cb0ff..63e8cd5 100644 --- a/spec/acceptance/cloudkitty_wsgi_apache_spec.rb +++ b/spec/acceptance/cloudkitty_wsgi_apache_spec.rb @@ -41,6 +41,11 @@ describe 'basic cloudkitty' do } class { '::cloudkitty': default_transport_url => 'rabbit://cloudkitty:an_even_bigger_secret@127.0.0.1:5672', + # NOTE(tobias-urdin): Cloudkitty in Stein has moved to storage v2 by default and the + # only driver available is InfluxDB which we do not deploy. This sets it back to the + # old sqlalchemy storage driver in version 1. + storage_backend => 'sqlalchemy', + storage_version => '1', } class { '::cloudkitty::keystone::auth': password => 'a_big_secret', diff --git a/spec/classes/cloudkitty_init_spec.rb b/spec/classes/cloudkitty_init_spec.rb index a3fc906..9f79ed2 100644 --- a/spec/classes/cloudkitty_init_spec.rb +++ b/spec/classes/cloudkitty_init_spec.rb @@ -31,6 +31,7 @@ describe 'cloudkitty' do is_expected.to contain_cloudkitty_config('oslo_messaging_notifications/transport_url').with_value('') is_expected.to contain_cloudkitty_config('oslo_messaging_notifications/driver').with_value('') is_expected.to contain_cloudkitty_config('storage/backend').with_value('') + is_expected.to contain_cloudkitty_config('storage/version').with_value('') end it 'passes purge to resource' do @@ -54,6 +55,7 @@ describe 'cloudkitty' do :rpc_response_timeout => '120', :control_exchange => 'cloudkitty', :storage_backend => 'gnocchi', + :storage_version => '1', :auth_section => 'keystone_authtoken', :keystone_version => '3', } @@ -71,6 +73,7 @@ describe 'cloudkitty' do it 'configures various things' do is_expected.to contain_cloudkitty_config('oslo_messaging_notifications/topics').with_value('openstack') is_expected.to contain_cloudkitty_config('storage/backend').with_value('gnocchi') + is_expected.to contain_cloudkitty_config('storage/version').with_value('1') is_expected.to contain_cloudkitty_config('keystone_fetcher/auth_section').with_value('keystone_authtoken') is_expected.to contain_cloudkitty_config('keystone_fetcher/keystone_version').with_value('3') end