summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPradeep Kilambi <pkilambi@redhat.com>2017-05-25 18:12:50 -0400
committerJuan Antonio Osorio Robles <jaosorior@redhat.com>2017-06-15 10:18:03 +0300
commit5e91493f7aaecef924a78f0743f812a225080085 (patch)
treeb6ac0dbb895fb5d94f279376ce1d491ee6b011a6
parentd0970575cd315adad50b42051e96972b34de6e88 (diff)
Move gnocchi upgrade and api to step 4
gnocchi upgrade requires storage sacks to be initialized. This means we need to ensure the storage backends are up before running the upgrade and starting the api. Lets move the api to step 4 so we can ensure other dependencies are in place. Co-Authored-By: Juan Antonio Osorio Robles <jaosorior@redhat.com> Depends-On: Ibfa9fb39f60c1e4a802d189b32ff4c34476c93d3 Change-Id: If2ae48b21389e76fd638c0b48c148a5d4f227630
Notes
Notes (review): Code-Review+2: Pradeep Kilambi <pkilambi@redhat.com> Workflow+1: Emilien Macchi <emilien@redhat.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 15 Jun 2017 13:28:08 +0000 Reviewed-on: https://review.openstack.org/469506 Project: openstack/puppet-tripleo Branch: refs/heads/master
-rw-r--r--manifests/profile/base/gnocchi/api.pp24
-rw-r--r--spec/classes/tripleo_profile_base_gnocchi_api_spec.rb22
2 files changed, 14 insertions, 32 deletions
diff --git a/manifests/profile/base/gnocchi/api.pp b/manifests/profile/base/gnocchi/api.pp
index a4e9a30..910375f 100644
--- a/manifests/profile/base/gnocchi/api.pp
+++ b/manifests/profile/base/gnocchi/api.pp
@@ -89,12 +89,11 @@ class tripleo::profile::base::gnocchi::api (
89 $tls_keyfile = undef 89 $tls_keyfile = undef
90 } 90 }
91 91
92 if $step >= 3 and $sync_db { 92 if $step >= 4 and $sync_db {
93 include ::gnocchi::db::sync 93 include ::gnocchi::db::sync
94 } 94 }
95 95
96 if $step >= 3 { 96 if $step >= 4 or ($step >= 3 and $sync_db) {
97 include ::gnocchi::api
98 include ::apache::mod::ssl 97 include ::apache::mod::ssl
99 class { '::gnocchi::wsgi::apache': 98 class { '::gnocchi::wsgi::apache':
100 ssl_cert => $tls_certfile, 99 ssl_cert => $tls_certfile,
@@ -107,19 +106,20 @@ class tripleo::profile::base::gnocchi::api (
107 coordination_url => join(['redis://:', $gnocchi_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']), 106 coordination_url => join(['redis://:', $gnocchi_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']),
108 } 107 }
109 case $gnocchi_backend { 108 case $gnocchi_backend {
110 'swift': { include ::gnocchi::storage::swift } 109 'swift': {
110 include ::gnocchi::storage::swift
111 if $sync_db {
112 include ::swift::deps
113 # Ensure we have swift proxy available before running gnocchi-upgrade
114 # as storage is initialized at this point.
115 Anchor<| title == 'swift::service::end' |> ~> Class['Gnocchi::db::sync']
116 }
117 }
111 'file': { include ::gnocchi::storage::file } 118 'file': { include ::gnocchi::storage::file }
112 'rbd': { include ::gnocchi::storage::ceph } 119 'rbd': { include ::gnocchi::storage::ceph }
113 default: { fail('Unrecognized gnocchi_backend parameter.') } 120 default: { fail('Unrecognized gnocchi_backend parameter.') }
114 } 121 }
122 include ::gnocchi::api
115 } 123 }
116 124
117 # Re-run gnochci upgrade with storage as swift/ceph should be up at this
118 # stage.
119 if $step >= 5 and $sync_db {
120 exec {'run gnocchi upgrade with storage':
121 command => 'gnocchi-upgrade --config-file=/etc/gnocchi/gnocchi.conf',
122 path => ['/usr/bin', '/usr/sbin'],
123 }
124 }
125} 125}
diff --git a/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb b/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb
index 6c04e9d..90bdea0 100644
--- a/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb
+++ b/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb
@@ -36,9 +36,9 @@ describe 'tripleo::profile::base::gnocchi::api' do
36 } 36 }
37 end 37 end
38 38
39 context 'with step 3 on bootstrap' do 39 context 'with step 4 on bootstrap' do
40 let(:params) { { 40 let(:params) { {
41 :step => 3, 41 :step => 4,
42 :bootstrap_node => 'node.example.com', 42 :bootstrap_node => 'node.example.com',
43 :gnocchi_redis_password => 'gnocchi', 43 :gnocchi_redis_password => 'gnocchi',
44 :redis_vip => '127.0.0.1' 44 :redis_vip => '127.0.0.1'
@@ -51,20 +51,6 @@ describe 'tripleo::profile::base::gnocchi::api' do
51 } 51 }
52 end 52 end
53 53
54 context 'with step 3' do
55 let(:params) { {
56 :step => 3,
57 :gnocchi_redis_password => 'gnocchi',
58 :redis_vip => '127.0.0.1'
59 } }
60
61 it {
62 is_expected.to_not contain_class('gnocchi::db::sync')
63 is_expected.to contain_class('gnocchi::api')
64 is_expected.to contain_class('gnocchi::wsgi::apache')
65 }
66 end
67
68 context 'with step 4' do 54 context 'with step 4' do
69 let(:params) { { 55 let(:params) { {
70 :step => 4, 56 :step => 4,
@@ -129,10 +115,6 @@ describe 'tripleo::profile::base::gnocchi::api' do
129 it { 115 it {
130 is_expected.to contain_class('gnocchi::api') 116 is_expected.to contain_class('gnocchi::api')
131 is_expected.to contain_class('gnocchi::wsgi::apache') 117 is_expected.to contain_class('gnocchi::wsgi::apache')
132 is_expected.to contain_exec('run gnocchi upgrade with storage').with(
133 :command => 'gnocchi-upgrade --config-file=/etc/gnocchi/gnocchi.conf',
134 :path => ['/usr/bin', '/usr/sbin']
135 )
136 } 118 }
137 end 119 end
138 end 120 end