summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Karpin <mkarpin@mirantis.com>2016-02-29 17:18:35 +0200
committerMykyta Karpin <mkarpin@mirantis.com>2016-02-29 17:18:35 +0200
commit7aca0c5f1c2b4dbd6b56b762c0bde69f24cf0881 (patch)
treed2139724cdb1781748710cd8141dddf19577f965
parent5adb4d407b665d0ac4fc660e68b9c9f8022ab803 (diff)
Fix idempotency for Ceilometer Redis pluginv0.1
Notes
Notes (review): Code-Review+1: Maksym Yatsenko <myatsenko@mirantis.com> Code-Review+1: Artem Minasyan <aminasyan@mirantis.com> Code-Review+2: Ivan Berezovskiy <iberezovskiy@mirantis.com> Workflow+1: Ivan Berezovskiy <iberezovskiy@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 03 Mar 2016 13:50:22 +0000 Reviewed-on: https://review.openstack.org/286108 Project: openstack/fuel-plugin-ceilometer-redis Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/modules/redis/manifests/main.pp202
1 files changed, 57 insertions, 145 deletions
diff --git a/deployment_scripts/puppet/modules/redis/manifests/main.pp b/deployment_scripts/puppet/modules/redis/manifests/main.pp
index 1212343..11f3106 100644
--- a/deployment_scripts/puppet/modules/redis/manifests/main.pp
+++ b/deployment_scripts/puppet/modules/redis/manifests/main.pp
@@ -71,6 +71,23 @@ class redis::main (
71 } 71 }
72 } 72 }
73 73
74 $metadata = {
75 'resource-stickiness' => '1',
76 }
77
78 $operations = {
79 'monitor' => {
80 'interval' => '20',
81 'timeout' => '10',
82 },
83 'start' => {
84 'timeout' => '360',
85 },
86 'stop' => {
87 'timeout' => '360',
88 },
89 }
90
74 firewall {'121 redis_port': 91 firewall {'121 redis_port':
75 port => $redis_port, 92 port => $redis_port,
76 proto => 'tcp', 93 proto => 'tcp',
@@ -91,8 +108,8 @@ class redis::main (
91 108
92 # Use custom function to generate sentinel configuration 109 # Use custom function to generate sentinel configuration
93 $sentinel_confs = sentinel_confs($redis_hosts, $redis_port, $quorum, 110 $sentinel_confs = sentinel_confs($redis_hosts, $redis_port, $quorum,
94 $parallel_syncs, $down_after_milliseconds, 111 $parallel_syncs, $down_after_milliseconds,
95 $failover_timeout) 112 $failover_timeout)
96 113
97 package {'python-redis': 114 package {'python-redis':
98 ensure => 'present', 115 ensure => 'present',
@@ -101,8 +118,8 @@ class redis::main (
101 class { '::redis': 118 class { '::redis':
102 conf_bind => $redis_bind_address, 119 conf_bind => $redis_bind_address,
103 conf_slave_read_only => 'no', 120 conf_slave_read_only => 'no',
104 service_enable => false, 121 service_enable => true,
105 service_ensure => 'stopped', 122 service_ensure => 'running',
106 conf_slaveof => $conf_slaveof, 123 conf_slaveof => $conf_slaveof,
107 } -> 124 } ->
108 125
@@ -119,152 +136,16 @@ class redis::main (
119 'notification/workload_partitioning': value => true 136 'notification/workload_partitioning': value => true
120 } 137 }
121 138
122 if $primary_controller {
123 exec {'remove_old_resource_central_agent':
124 path => '/usr/sbin:/usr/bin:/sbin:/bin',
125 command => 'pcs resource delete p_ceilometer-agent-central --wait=120',
126 onlyif => 'pcs resource show p_ceilometer-agent-central > /dev/null 2>&1',
127 }
128
129 exec {'remove_old_resource_alarm_evaluator':
130 path => '/usr/sbin:/usr/bin:/sbin:/bin',
131 command => 'pcs resource delete p_ceilometer-alarm-evaluator --wait=120',
132 onlyif => 'pcs resource show p_ceilometer-alarm-evaluator > /dev/null 2>&1',
133 }
134
135 Exec['remove_old_resource_central_agent'] -> Cluster::Corosync::Cs_service["$::ceilometer::params::agent_central_service_name"]
136 Exec['remove_old_resource_alarm_evaluator'] -> Cluster::Corosync::Cs_service["$::ceilometer::params::alarm_evaluator_service_name"]
137 }
138
139 file {'redis_ocf_script':
140 path => '/usr/lib/ocf/resource.d/fuel/redis-server',
141 owner => 'root',
142 group => 'root',
143 mode => '0755',
144 source => 'puppet:///modules/redis/ocf/redis-server'
145 }
146
147 cluster::corosync::cs_service { "$::ceilometer::params::agent_central_service_name":
148 ocf_script => 'ceilometer-agent-central',
149 csr_parameters => {},
150 csr_metadata => undef,
151 csr_complex_type => 'clone',
152 csr_ms_metadata => { 'interleave' => true },
153 csr_mon_intr => '20',
154 csr_mon_timeout => '10',
155 csr_timeout => '60',
156 service_name => $::ceilometer::params::agent_central_service_name,
157 package_name => $::ceilometer::params::agent_central_package_name,
158 service_title => 'ceilometer-agent-central',
159 primary => $primary_controller,
160 hasrestart => false,
161 }
162
163 cluster::corosync::cs_service { "$::ceilometer::params::alarm_evaluator_service_name":
164 ocf_script => 'ceilometer-alarm-evaluator',
165 csr_parameters => {},
166 csr_metadata => undef,
167 csr_complex_type => 'clone',
168 csr_ms_metadata => { 'interleave' => true },
169 csr_mon_intr => '20',
170 csr_mon_timeout => '10',
171 csr_timeout => '60',
172 service_name => $::ceilometer::params::alarm_evaluator_service_name,
173 package_name => $::ceilometer::params::alarm_evaluator_package_name,
174 service_title => 'ceilometer-alarm-evaluator',
175 primary => $primary_controller,
176 hasrestart => false,
177 }
178
179 cluster::corosync::cs_service { 'redis':
180 ocf_script => 'redis-server',
181 csr_parameters => {},
182 csr_metadata => undef,
183 csr_complex_type => 'clone',
184 csr_ms_metadata => { 'interleave' => true },
185 csr_mon_intr => '20',
186 csr_mon_timeout => '10',
187 csr_timeout => '60',
188 service_name => $::redis::params::service,
189 package_name => $::redis::params::package,
190 service_title => 'redis',
191 primary => $primary_controller,
192 hasrestart => false,
193 }
194
195
196 File['redis_ocf_script'] ->
197 Cluster::Corosync::Cs_service['redis'] ->
198 Ceilometer_config <||> ->
199 Cluster::Corosync::Cs_service["$::ceilometer::params::agent_central_service_name"] ->
200 Cluster::Corosync::Cs_service["$::ceilometer::params::alarm_evaluator_service_name"]
201
202 if !$primary_controller {
203 exec {'waiting-for-agent-up-on-primary':
204 tries => 10,
205 try_sleep => 30,
206 command => "pcs resource | grep -A 1 p_${::ceilometer::params::agent_central_service_name} | grep Started > /dev/null 2>&1",
207 path => '/usr/sbin:/usr/bin:/sbin:/bin',
208 }
209
210 exec {'waiting-for-evaluator-up-on-primary':
211 tries => 10,
212 try_sleep => 30,
213 command => "pcs resource | grep -A 1 p_${::ceilometer::params::alarm_evaluator_service_name} | grep Started > /dev/null 2>&1",
214 path => '/usr/sbin:/usr/bin:/sbin:/bin',
215 }
216
217 exec {'waiting-for-redis-up-on-primary':
218 tries => 10,
219 try_sleep => 30,
220 command => "pcs resource | grep -A 1 p_${::redis::params::service} | grep Started > /dev/null 2>&1",
221 path => '/usr/sbin:/usr/bin:/sbin:/bin',
222 }
223
224 service {"p_${::ceilometer::params::agent_central_service_name}":
225 enable => true,
226 ensure => 'running',
227 hasstatus => true,
228 hasrestart => true,
229 provider => 'pacemaker',
230 }
231
232 service {"p_${::ceilometer::params::alarm_evaluator_service_name}":
233 enable => true,
234 ensure => 'running',
235 hasstatus => true,
236 hasrestart => true,
237 provider => 'pacemaker',
238 }
239
240 service {"p_${::redis::params::service}":
241 enable => true,
242 ensure => 'running',
243 hasstatus => true,
244 hasrestart => true,
245 provider => 'pacemaker',
246 }
247
248 Exec['waiting-for-redis-up-on-primary'] ->
249 Service["p_${::redis::params::service}"] ->
250 Cluster::Corosync::Cs_service['redis'] ->
251 Exec['waiting-for-agent-up-on-primary'] ->
252 Ceilometer_config <||> ->
253 Cluster::Corosync::Cs_service["$::ceilometer::params::agent_central_service_name"] ->
254 Exec['waiting-for-evaluator-up-on-primary'] ->
255 Cluster::Corosync::Cs_service["$::ceilometer::params::alarm_evaluator_service_name"]
256 }
257
258 service { 'ceilometer-agent-central': 139 service { 'ceilometer-agent-central':
259 ensure => 'stopped', 140 ensure => 'running',
260 name => $::ceilometer::params::agent_central_service_name, 141 name => $::ceilometer::params::agent_central_service_name,
261 enable => false, 142 enable => true,
262 } 143 }
263 144
264 service { 'ceilometer-alarm-evaluator': 145 service { 'ceilometer-alarm-evaluator':
265 ensure => 'stopped', 146 ensure => 'running',
266 name => $::ceilometer::params::alarm_evaluator_service_name, 147 name => $::ceilometer::params::alarm_evaluator_service_name,
267 enable => false, 148 enable => true,
268 } 149 }
269 150
270 service { 'ceilometer-agent-notification': 151 service { 'ceilometer-agent-notification':
@@ -275,6 +156,37 @@ class redis::main (
275 hasrestart => true, 156 hasrestart => true,
276 } 157 }
277 158
159 pacemaker_wrappers::service { $::ceilometer::params::agent_central_service_name :
160 complex_type => 'clone',
161 ms_metadata => { 'interleave' => true },
162 primitive_type => 'ceilometer-agent-central',
163 metadata => $metadata,
164 parameters => { 'user' => 'ceilometer' },
165 operations => $operations,
166 }
167
168 pacemaker_wrappers::service { $::ceilometer::params::alarm_evaluator_service_name :
169 complex_type => 'clone',
170 ms_metadata => { 'interleave' => true },
171 primitive_type => 'ceilometer-alarm-evaluator',
172 metadata => $metadata,
173 parameters => { 'user' => 'ceilometer' },
174 operations => $operations,
175 }
176
177 pacemaker_wrappers::service { 'redis-server' :
178 ocf_script_file => 'redis/ocf/redis-server',
179 complex_type => 'clone',
180 ms_metadata => { 'interleave' => true },
181 primitive_type => 'redis-server',
182 operations => $operations,
183 }
184
185 Pacemaker_wrappers::Service['redis-server'] ->
186 Ceilometer_config <||> ->
187 Pacemaker_wrappers::Service["$::ceilometer::params::agent_central_service_name"] ->
188 Pacemaker_wrappers::Service["$::ceilometer::params::alarm_evaluator_service_name"]
189
278 Ceilometer_config <||> ~> Service['ceilometer-agent-notification'] 190 Ceilometer_config <||> ~> Service['ceilometer-agent-notification']
279 191
280} 192} \ No newline at end of file