Browse Source

Fix bashate E006 violations

This commit fixes bashate E006 (lines longer than 79 columns) violations
in the OCF scripts.

Partial-Bug: #1550203
Change-Id: Ic208477b2299697a03b641f8272a0946c897fb3e
Signed-off-by: Norbert Illes <norbert.e.illes@ericsson.com>
tags/kilo-eol
Norbert Illes 3 years ago
parent
commit
98a54ad759
22 changed files with 655 additions and 354 deletions
  1. 16
    8
      ocf/NovaCompute
  2. 13
    7
      ocf/NovaEvacuate
  3. 37
    19
      ocf/ceilometer-agent-central
  4. 31
    19
      ocf/cinder-api
  5. 32
    17
      ocf/cinder-schedule
  6. 31
    16
      ocf/cinder-volume
  7. 19
    11
      ocf/glance-api
  8. 33
    20
      ocf/glance-registry
  9. 33
    18
      ocf/heat-engine
  10. 18
    11
      ocf/keystone
  11. 31
    19
      ocf/manila-api
  12. 36
    19
      ocf/neutron-agent-dhcp
  13. 28
    15
      ocf/neutron-agent-l3
  14. 8
    4
      ocf/neutron-ha-tool
  15. 39
    21
      ocf/neutron-metadata-agent
  16. 33
    19
      ocf/neutron-server
  17. 33
    20
      ocf/nova-api
  18. 33
    16
      ocf/nova-cert
  19. 47
    22
      ocf/nova-consoleauth
  20. 34
    17
      ocf/nova-network
  21. 31
    17
      ocf/nova-novnc
  22. 39
    19
      ocf/nova-scheduler

+ 16
- 8
ocf/NovaCompute View File

@@ -178,13 +178,15 @@ nova_start() {
178 178
         return $OCF_SUCCESS
179 179
     fi
180 180
 
181
-    state=$(attrd_updater -p -n evacuate -N ${NOVA_HOST} | sed -e 's/.*value=//' | tr -d '"' )
181
+    state=$(attrd_updater -p -n evacuate -N ${NOVA_HOST} | \
182
+        sed -e 's/.*value=//' | tr -d '"' )
182 183
     if [ "x$state" = x ]; then
183 184
         : no fencing to recover
184 185
 
185 186
     elif [ "x$state" = xno ]; then
186 187
         : has been evacuated, however it could have been 1s ago
187
-        ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to complete"
188
+        ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to" \
189
+            "complete"
188 190
         sleep ${OCF_RESKEY_evacuation_delay}
189 191
 
190 192
         fence_compute ${fence_options} -o on -n ${NOVA_HOST}
@@ -192,11 +194,13 @@ nova_start() {
192 194
     else
193 195
         ocf_log info "Waiting for pending evacuations from ${NOVA_HOST}"
194 196
         while [ "x$state" != "xno" -a "x$state" != x ]; do
195
-            state=$(attrd_updater -p -n evacuate -N ${NOVA_HOST} | sed -e 's/.*value=//' | tr -d '"' )
197
+            state=$(attrd_updater -p -n evacuate -N ${NOVA_HOST} | \
198
+                sed -e 's/.*value=//' | tr -d '"' )
196 199
             sleep 5
197 200
         done
198 201
 
199
-        ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to complete"
202
+        ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to" \
203
+            "complete"
200 204
         sleep ${OCF_RESKEY_evacuation_delay}
201 205
 
202 206
         fence_compute ${fence_options} -o on -n ${NOVA_HOST}
@@ -297,7 +301,8 @@ nova_validate() {
297 301
     fi
298 302
 
299 303
     if [ -n "${OCF_RESKEY_region_name}" ]; then
300
-        fence_options="${fence_options} --region-name ${OCF_RESKEY_region_name}"
304
+        fence_options="${fence_options} \
305
+            --region-name ${OCF_RESKEY_region_name}"
301 306
     fi
302 307
 
303 308
     if [ -n "${OCF_RESKEY_insecure}" ]; then
@@ -317,7 +322,8 @@ nova_validate() {
317 322
             adminURL|publicURL|internalURL)
318 323
                 ;;
319 324
             *)
320
-                ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
325
+                ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type}" \
326
+                    "not valid. Use adminURL or publicURL or internalURL"
321 327
                 exit $OCF_ERR_CONFIGURED
322 328
                 ;;
323 329
         esac
@@ -342,12 +348,14 @@ nova_validate() {
342 348
         if [ "x${OCF_RESKEY_domain}" != x ]; then
343 349
             short_host=$(uname -n | awk -F. '{print $1}')
344 350
             if [ "x$NOVA_HOST" != "x${short_host}" ]; then
345
-                ocf_exit_reason "Invalid Nova host name, must be ${short_host} in order for instance recovery to function"
351
+                ocf_exit_reason "Invalid Nova host name, must be" \
352
+                    "${short_host} in order for instance recovery to function"
346 353
                 rc=$OCF_ERR_CONFIGURED
347 354
             fi
348 355
 
349 356
         elif [ "x$NOVA_HOST" != "x$(uname -n)" ]; then
350
-            ocf_exit_reason "Invalid Nova host name, must be $(uname -n) in order for instance recovery to function"
357
+            ocf_exit_reason "Invalid Nova host name, must be $(uname -n) in" \
358
+                "order for instance recovery to function"
351 359
             rc=$OCF_ERR_CONFIGURED
352 360
         fi
353 361
     fi

+ 13
- 7
ocf/NovaEvacuate View File

@@ -197,12 +197,15 @@ handle_evacuations() {
197 197
                 now=$(date +%s)
198 198
 
199 199
                 if [ $(($now - $when)) -gt 60 ]; then
200
-                    ocf_log info "Processing partial evacuation of $node by $where at $when"
200
+                    ocf_log info "Processing partial evacuation of $node by" \
201
+                        "$where at $when"
201 202
                     need_evacuate=1
202 203
                 else
203
-                    # Give some time for any in-flight evacuations to either complete or fail
204
-                    # Nova won't react well if there are two overlapping requests
205
-                    ocf_log info "Deferring processing partial evacuation of $node by $where at $when"
204
+                    # Give some time for any in-flight evacuations to either
205
+                    # complete or fail Nova won't react well if there are two
206
+                    # overlapping requests
207
+                    ocf_log info "Deferring processing partial evacuation of" \
208
+                        "$node by $where at $when"
206 209
                 fi
207 210
                 ;;
208 211
         esac
@@ -211,7 +214,8 @@ handle_evacuations() {
211 214
             found=0
212 215
             ocf_log notice "Initiating evacuation of $node"
213 216
 
214
-            for known in $(fence_compute ${fence_options} -o list | tr -d ','); do
217
+            for known in $(fence_compute ${fence_options} -o list | \
218
+                tr -d ','); do
215 219
                 if [ ${known} = ${node} ]; then
216 220
                     found=1
217 221
                     break
@@ -308,7 +312,8 @@ evacuate_validate() {
308 312
     fi
309 313
 
310 314
     if [ -n "${OCF_RESKEY_region_name}" ]; then
311
-        fence_options="${fence_options} --region-name ${OCF_RESKEY_region_name}"
315
+        fence_options="${fence_options} \
316
+            --region-name ${OCF_RESKEY_region_name}"
312 317
     fi
313 318
 
314 319
     if [ -n "${OCF_RESKEY_insecure}" ]; then
@@ -328,7 +333,8 @@ evacuate_validate() {
328 333
             adminURL|publicURL|internalURL)
329 334
                 ;;
330 335
             *)
331
-                ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
336
+                ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type}" \
337
+                    "not valid. Use adminURL or publicURL or internalURL"
332 338
                 exit $OCF_ERR_CONFIGURED
333 339
                 ;;
334 340
         esac

+ 37
- 19
ocf/ceilometer-agent-central View File

@@ -3,7 +3,8 @@
3 3
 #
4 4
 # OpenStack Ceilometer Central Agent Service (ceilometer-agent-central)
5 5
 #
6
-# Description: Manages an OpenStack Ceilometer Central Agent Service (ceilometer-agent-central) process as an HA resource
6
+# Description: Manages an OpenStack Ceilometer Central Agent Service
7
+#              (ceilometer-agent-central) process as an HA resource
7 8
 #
8 9
 # Authors: Emilien Macchi
9 10
 # Mainly inspired by the Nova Scheduler resource agent written by Sebastien Han
@@ -194,7 +195,8 @@ ceilometer_agent_central_status() {
194 195
     local rc
195 196
 
196 197
     if [ ! -f $OCF_RESKEY_pid ]; then
197
-        ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) is not running"
198
+        ocf_log info "OpenStack Ceilometer Central Agent" \
199
+            "(ceilometer-agent-central) is not running"
198 200
         return $OCF_NOT_RUNNING
199 201
     else
200 202
         pid=`cat $OCF_RESKEY_pid`
@@ -205,7 +207,8 @@ ceilometer_agent_central_status() {
205 207
     if [ $rc -eq 0 ]; then
206 208
         return $OCF_SUCCESS
207 209
     else
208
-        ocf_log info "Old PID file found, but OpenStack Ceilometer Central Agent (ceilometer-agent-central) is not running"
210
+        ocf_log info "Old PID file found, but OpenStack Ceilometer Central" \
211
+            "Agent (ceilometer-agent-central) is not running"
209 212
         return $OCF_NOT_RUNNING
210 213
     fi
211 214
 }
@@ -224,16 +227,20 @@ ceilometer_agent_central_monitor() {
224 227
     fi
225 228
 
226 229
     # Check the connections according to the PID.
227
-    # We are sure to hit the scheduler process and not other Cinder process with the same connection behavior (for example cinder-api)
230
+    # We are sure to hit the scheduler process and not other Cinder process
231
+    # with the same connection behavior (for example cinder-api)
228 232
         pid=`cat $OCF_RESKEY_pid`
229
-        scheduler_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
233
+        scheduler_amqp_check=`netstat -punt | \
234
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
235
+            grep -qs "ESTABLISHED"`
230 236
         rc=$?
231 237
         if [ $rc -ne 0 ]; then
232 238
         ocf_log err "Central Agent is not connected to the AMQP server : $rc"
233 239
         return $OCF_NOT_RUNNING
234 240
         fi
235 241
 
236
-    ocf_log debug "OpenStack Ceilometer Central Agent (ceilometer-agent-central) monitor succeeded"
242
+    ocf_log debug "OpenStack Ceilometer Central Agent" \
243
+        "(ceilometer-agent-central) monitor succeeded"
237 244
     return $OCF_SUCCESS
238 245
 }
239 246
 
@@ -243,14 +250,18 @@ ceilometer_agent_central_start() {
243 250
     ceilometer_agent_central_status
244 251
     rc=$?
245 252
     if [ $rc -eq $OCF_SUCCESS ]; then
246
-        ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) already running"
253
+        ocf_log info "OpenStack Ceilometer Central Agent" \
254
+            "(ceilometer-agent-central) already running"
247 255
         return $OCF_SUCCESS
248 256
     fi
249 257
 
250
-    # run the actual ceilometer-agent-central daemon. Don't use ocf_run as we're sending the tool's output
251
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
252
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
253
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
258
+    # run the actual ceilometer-agent-central daemon. Don't use ocf_run as
259
+    # we're sending the tool's output straight to /dev/null anyway and using
260
+    # ocf_run would break stdout-redirection here.
261
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
262
+        --config-file=$OCF_RESKEY_config \
263
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
264
+        > $OCF_RESKEY_pid
254 265
 
255 266
     # Spin waiting for the server to come up.
256 267
     while true; do
@@ -258,13 +269,15 @@ ceilometer_agent_central_start() {
258 269
     rc=$?
259 270
     [ $rc -eq $OCF_SUCCESS ] && break
260 271
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
261
-        ocf_log err "OpenStack Ceilometer Central Agent (ceilometer-agent-central) start failed"
272
+        ocf_log err "OpenStack Ceilometer Central Agent" \
273
+            "(ceilometer-agent-central) start failed"
262 274
         exit $OCF_ERR_GENERIC
263 275
     fi
264 276
     sleep 1
265 277
     done
266 278
 
267
-    ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) started"
279
+    ocf_log info "OpenStack Ceilometer Central Agent \
280
+        (ceilometer-agent-central) started"
268 281
     return $OCF_SUCCESS
269 282
 }
270 283
 
@@ -275,7 +288,8 @@ ceilometer_agent_central_stop() {
275 288
     ceilometer_agent_central_status
276 289
     rc=$?
277 290
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
278
-        ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) already stopped"
291
+        ocf_log info "OpenStack Ceilometer Central Agent \
292
+            (ceilometer-agent-central) already stopped"
279 293
         return $OCF_SUCCESS
280 294
     fi
281 295
 
@@ -284,7 +298,8 @@ ceilometer_agent_central_stop() {
284 298
     ocf_run kill -s TERM $pid
285 299
     rc=$?
286 300
     if [ $rc -ne 0 ]; then
287
-        ocf_log err "OpenStack Ceilometer Central Agent (ceilometer-agent-central) couldn't be stopped"
301
+        ocf_log err "OpenStack Ceilometer Central Agent \
302
+            (ceilometer-agent-central) couldn't be stopped"
288 303
         exit $OCF_ERR_GENERIC
289 304
     fi
290 305
 
@@ -302,19 +317,22 @@ ceilometer_agent_central_stop() {
302 317
         fi
303 318
         count=`expr $count + 1`
304 319
         sleep 1
305
-        ocf_log debug "OpenStack Ceilometer Central Agent (ceilometer-agent-central) still hasn't stopped yet. Waiting ..."
320
+        ocf_log debug "OpenStack Ceilometer Central Agent \
321
+            (ceilometer-agent-central) still hasn't stopped yet. Waiting ..."
306 322
     done
307 323
 
308 324
     ceilometer_agent_central_status
309 325
     rc=$?
310 326
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
311 327
         # SIGTERM didn't help either, try SIGKILL
312
-        ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) failed to stop after ${shutdown_timeout}s \
313
-            using SIGTERM. Trying SIGKILL ..."
328
+        ocf_log info "OpenStack Ceilometer Central Agent \
329
+            (ceilometer-agent-central) failed to stop after \
330
+            ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
314 331
         ocf_run kill -s KILL $pid
315 332
     fi
316 333
 
317
-    ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) stopped"
334
+    ocf_log info "OpenStack Ceilometer Central Agent \
335
+        (ceilometer-agent-central) stopped"
318 336
 
319 337
     rm -f $OCF_RESKEY_pid
320 338
 

+ 31
- 19
ocf/cinder-api View File

@@ -3,7 +3,8 @@
3 3
 #
4 4
 # OpenStack Cinder API (cinder-api)
5 5
 #
6
-# Description:  Manages an OpenStack Cinder API (cinder-api) process as an HA resource
6
+# Description:  Manages an OpenStack Cinder API (cinder-api) process as an HA
7
+#               resource
7 8
 #
8 9
 # Authors:      Emilien Macchi
9 10
 # Mainly inspired by the Nova API written by Sebastien Han
@@ -39,14 +40,14 @@ OCF_RESKEY_config_default="/etc/cinder/cinder.conf"
39 40
 OCF_RESKEY_user_default="cinder"
40 41
 OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
41 42
 OCF_RESKEY_url_default="http://127.0.0.1:8776/v1/"
42
-OCF_RESKEY_keystone_get_token_url_default="http://127.0.0.1:5000/v2.0/tokens"
43
+OCF_RESKEY_keystone_get_token_url_def="http://127.0.0.1:5000/v2.0/tokens"
43 44
 
44 45
 : ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
45 46
 : ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
46 47
 : ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
47 48
 : ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
48 49
 : ${OCF_RESKEY_url=${OCF_RESKEY_url_default}}
49
-: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_default}}
50
+: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_def}}
50 51
 
51 52
 #######################################################################
52 53
 
@@ -127,7 +128,7 @@ The default URL to use to acquire a Cinder API (cinder-api) token for monitoring
127 128
 of OpenStack Cinder API (cinder-api)
128 129
 </longdesc>
129 130
 <shortdesc lang="en">OpenStack Cinder API (cinder-api) url</shortdesc>
130
-<content type="string" default="${OCF_RESKEY_keystone_get_token_url_default}" />
131
+<content type="string" default="${OCF_RESKEY_keystone_get_token_url_def}" />
131 132
 </parameter>
132 133
 
133 134
 <parameter name="os_username" unique="0" required="0">
@@ -225,7 +226,8 @@ cinder_api_status() {
225 226
     if [ $rc -eq 0 ]; then
226 227
         return $OCF_SUCCESS
227 228
     else
228
-        ocf_log info "Old PID file found, but OpenStack Cinder API (cinder-api) is not running"
229
+        ocf_log info "Old PID file found, but OpenStack Cinder API" \
230
+            "(cinder-api) is not running"
229 231
         return $OCF_NOT_RUNNING
230 232
     fi
231 233
 }
@@ -245,15 +247,21 @@ cinder_api_monitor() {
245 247
 
246 248
     # Check detailed information about this specific version of the API.
247 249
     if [ -n "$OCF_RESKEY_os_username" ] && [ -n "$OCF_RESKEY_os_password" ] \
248
-    && [ -n "$OCF_RESKEY_os_tenant_name" ] && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
249
-        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": {\"username\": \"$OCF_RESKEY_os_username\", \
250
-            \"password\": \"$OCF_RESKEY_os_password\"}, \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
251
-            -H "Content-type: application/json" $OCF_RESKEY_keystone_get_token_url | tr ',' '\n' | grep '"id":' \
252
-            | cut -d'"' -f4 | head --lines 1`
253
-        http_code=`curl --write-out %{http_code} --output /dev/null -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
250
+        && [ -n "$OCF_RESKEY_os_tenant_name" ] \
251
+        && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
252
+        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": \
253
+            {\"username\": \"$OCF_RESKEY_os_username\", \
254
+            \"password\": \"$OCF_RESKEY_os_password\"}, \
255
+            \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
256
+            -H "Content-type: application/json" \
257
+            $OCF_RESKEY_keystone_get_token_url | \
258
+            tr ',' '\n' | grep '"id":' | cut -d'"' -f4 | head --lines 1`
259
+        http_code=`curl --write-out %{http_code} --output /dev/null \
260
+            -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
254 261
         rc=$?
255 262
         if [ $rc -ne 0 ] || [ $http_code -ne 200 ]; then
256
-            ocf_log err "Failed to connect to the OpenStack Cinder API (cinder-api): $rc and $http_code"
263
+            ocf_log err "Failed to connect to the OpenStack Cinder API" \
264
+                "(cinder-api): $rc and $http_code"
257 265
             return $OCF_NOT_RUNNING
258 266
         fi
259 267
     fi
@@ -272,10 +280,13 @@ cinder_api_start() {
272 280
         return $OCF_SUCCESS
273 281
     fi
274 282
 
275
-    # run the actual cinder-api daemon. Don't use ocf_run as we're sending the tool's output
276
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
277
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
278
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
283
+    # run the actual cinder-api daemon. Don't use ocf_run as we're sending the
284
+    # tool's output straight to /dev/null anyway and using ocf_run would break
285
+    # stdout-redirection here.
286
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
287
+        --config-file=$OCF_RESKEY_config \
288
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
289
+        > $OCF_RESKEY_pid
279 290
 
280 291
     # Spin waiting for the server to come up.
281 292
     # Let the CRM/LRM time us out if required
@@ -328,15 +339,16 @@ cinder_api_stop() {
328 339
         fi
329 340
         count=`expr $count + 1`
330 341
         sleep 1
331
-        ocf_log debug "OpenStack Cinder API (cinder-api) still hasn't stopped yet. Waiting ..."
342
+        ocf_log debug "OpenStack Cinder API (cinder-api) still hasn't" \
343
+            "stopped yet. Waiting ..."
332 344
     done
333 345
 
334 346
     cinder_api_status
335 347
     rc=$?
336 348
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
337 349
         # SIGTERM didn't help either, try SIGKILL
338
-        ocf_log info "OpenStack Cinder API (cinder-api) failed to stop after ${shutdown_timeout}s \
339
-            using SIGTERM. Trying SIGKILL ..."
350
+        ocf_log info "OpenStack Cinder API (cinder-api) failed to stop after" \
351
+            "${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
340 352
         ocf_run kill -s KILL $pid
341 353
     fi
342 354
 

+ 32
- 17
ocf/cinder-schedule View File

@@ -3,7 +3,8 @@
3 3
 #
4 4
 # OpenStack Cinder Scheduler Service (cinder-schedule)
5 5
 #
6
-# Description: Manages an OpenStack Cinder Scheduler Service (cinder-schedule) process as an HA resource
6
+# Description: Manages an OpenStack Cinder Scheduler Service (cinder-schedule)
7
+#              process as an HA resource
7 8
 #
8 9
 # Authors: Emilien Macchi
9 10
 # Mainly inspired by the Nova Scheduler resource agent written by Sebastien Han
@@ -194,7 +195,8 @@ cinder_scheduler_status() {
194 195
     local rc
195 196
 
196 197
     if [ ! -f $OCF_RESKEY_pid ]; then
197
-        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) is not running"
198
+        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) is not" \
199
+            "running"
198 200
         return $OCF_NOT_RUNNING
199 201
     else
200 202
         pid=`cat $OCF_RESKEY_pid`
@@ -205,7 +207,8 @@ cinder_scheduler_status() {
205 207
     if [ $rc -eq 0 ]; then
206 208
         return $OCF_SUCCESS
207 209
     else
208
-        ocf_log info "Old PID file found, but OpenStack Cinder Scheduler (cinder-schedule) is not running"
210
+        ocf_log info "Old PID file found, but OpenStack Cinder Scheduler" \
211
+            "(cinder-schedule) is not running"
209 212
         return $OCF_NOT_RUNNING
210 213
     fi
211 214
 }
@@ -224,16 +227,21 @@ cinder_scheduler_monitor() {
224 227
     fi
225 228
 
226 229
     # Check the connections according to the PID.
227
-    # We are sure to hit the scheduler process and not other Cinder process with the same connection behavior (for example cinder-api)
230
+    # We are sure to hit the scheduler process and not other Cinder process
231
+    # with the same connection behavior (for example cinder-api)
228 232
         pid=`cat $OCF_RESKEY_pid`
229
-        scheduler_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
233
+        scheduler_amqp_check=`netstat -punt | \
234
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
235
+            grep -qs "ESTABLISHED"`
230 236
         rc=$?
231 237
         if [ $rc -ne 0 ]; then
232
-        ocf_log err "Cinder Scheduler is not connected to the AMQP server : $rc"
238
+        ocf_log err "Cinder Scheduler is not connected to the AMQP server : " \
239
+            "$rc"
233 240
         return $OCF_NOT_RUNNING
234 241
         fi
235 242
 
236
-    ocf_log debug "OpenStack Cinder Scheduler (cinder-schedule) monitor succeeded"
243
+    ocf_log debug "OpenStack Cinder Scheduler (cinder-schedule) monitor" \
244
+        "succeeded"
237 245
     return $OCF_SUCCESS
238 246
 }
239 247
 
@@ -243,14 +251,18 @@ cinder_scheduler_start() {
243 251
     cinder_scheduler_status
244 252
     rc=$?
245 253
     if [ $rc -eq $OCF_SUCCESS ]; then
246
-        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) already running"
254
+        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) already" \
255
+            "running"
247 256
         return $OCF_SUCCESS
248 257
     fi
249 258
 
250
-    # run the actual cinder-schedule daemon. Don't use ocf_run as we're sending the tool's output
251
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
252
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
253
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
259
+    # run the actual cinder-schedule daemon. Don't use ocf_run as we're sending
260
+    # the tool's output straight to /dev/null anyway and using ocf_run would
261
+    # break stdout-redirection here.
262
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
263
+        --config-file=$OCF_RESKEY_config \
264
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
265
+        > $OCF_RESKEY_pid
254 266
 
255 267
     # Spin waiting for the server to come up.
256 268
     while true; do
@@ -275,7 +287,8 @@ cinder_scheduler_stop() {
275 287
     cinder_scheduler_status
276 288
     rc=$?
277 289
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
278
-        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) already stopped"
290
+        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) already" \
291
+            "stopped"
279 292
         return $OCF_SUCCESS
280 293
     fi
281 294
 
@@ -284,7 +297,8 @@ cinder_scheduler_stop() {
284 297
     ocf_run kill -s TERM $pid
285 298
     rc=$?
286 299
     if [ $rc -ne 0 ]; then
287
-        ocf_log err "OpenStack Cinder Scheduler (cinder-schedule) couldn't be stopped"
300
+        ocf_log err "OpenStack Cinder Scheduler (cinder-schedule) couldn't" \
301
+            "be stopped"
288 302
         exit $OCF_ERR_GENERIC
289 303
     fi
290 304
 
@@ -302,15 +316,16 @@ cinder_scheduler_stop() {
302 316
         fi
303 317
         count=`expr $count + 1`
304 318
         sleep 1
305
-        ocf_log debug "OpenStack Cinder Scheduler (cinder-schedule) still hasn't stopped yet. Waiting ..."
319
+        ocf_log debug "OpenStack Cinder Scheduler (cinder-schedule) still" \
320
+            "hasn't stopped yet. Waiting ..."
306 321
     done
307 322
 
308 323
     cinder_scheduler_status
309 324
     rc=$?
310 325
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
311 326
         # SIGTERM didn't help either, try SIGKILL
312
-        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) failed to stop after ${shutdown_timeout}s \
313
-            using SIGTERM. Trying SIGKILL ..."
327
+        ocf_log info "OpenStack Cinder Scheduler (cinder-schedule) failed to" \
328
+            "stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
314 329
         ocf_run kill -s KILL $pid
315 330
     fi
316 331
 

+ 31
- 16
ocf/cinder-volume View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack Cinder Volume (cinder-volume)
5 5
 #
6
-# Description:  Manages an OpenStack Volumes (cinder-volume) process as an HA resource
6
+# Description:  Manages an OpenStack Volumes (cinder-volume) process as an HA
7
+#               resource
7 8
 #
8 9
 # Authors:      Sébastien Han
9
-# Mainly inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Glance API resource agent written by Martin Gerhard
11
+# Loschwitz from Hastexo: http://goo.gl/whLpr
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -193,7 +195,8 @@ cinder_volume_status() {
193 195
     if [ $rc -eq 0 ]; then
194 196
         return $OCF_SUCCESS
195 197
     else
196
-        ocf_log info "Old PID file found, but OpenStack Cinder Volume (cinder-volume) is not running"
198
+        ocf_log info "Old PID file found, but OpenStack Cinder Volume" \
199
+            "(cinder-volume) is not running"
197 200
         return $OCF_NOT_RUNNING
198 201
     fi
199 202
 }
@@ -217,21 +220,28 @@ cinder_volume_monitor() {
217 220
     if ocf_is_true "$OCF_RESKEY_multibackend"; then
218 221
         # Grab the child's PIDs
219 222
         for i in `ps -o pid --no-headers --ppid $pid`; do
220
-            volume_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$i" | grep -qs "ESTABLISHED"`
223
+            volume_amqp_check=`netstat -punt | \
224
+                grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$i" | \
225
+                grep -qs "ESTABLISHED"`
221 226
             rc=$?
222 227
             if [ $rc -ne 0 ]; then
223
-                ocf_log err "This child process from Cinder Volume is not connected to the AMQP server: $rc"
228
+                ocf_log err "This child process from Cinder Volume is not" \
229
+                    "connected to the AMQP server: $rc"
224 230
                 return $OCF_NOT_RUNNING
225 231
             fi
226 232
         done
227 233
     else
228 234
         # Check the connections according to the PID
229
-        # We are sure to hit the scheduler process and not other nova process with the same connection behavior (for example nova-cert)
235
+        # We are sure to hit the scheduler process and not other nova process
236
+        # with the same connection behavior (for example nova-cert)
230 237
         # check the connections according to the PID
231
-        volume_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
238
+        volume_amqp_check=`netstat -punt | \
239
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
240
+            grep -qs "ESTABLISHED"`
232 241
         rc=$?
233 242
         if [ $rc -ne 0 ]; then
234
-            ocf_log err "Cinder Volume is not connected to the AMQP server: $rc"
243
+            ocf_log err "Cinder Volume is not connected to the AMQP server:" \
244
+                "$rc"
235 245
             return $OCF_NOT_RUNNING
236 246
         fi
237 247
     fi
@@ -250,10 +260,13 @@ cinder_volume_start() {
250 260
         return $OCF_SUCCESS
251 261
     fi
252 262
 
253
-    # run the actual cinder-volume daemon. Don't use ocf_run as we're sending the tool's output
254
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
255
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
256
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
263
+    # run the actual cinder-volume daemon. Don't use ocf_run as we're sending
264
+    # the tool's output straight to /dev/null anyway and using ocf_run would
265
+    # break stdout-redirection here.
266
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
267
+        --config-file=$OCF_RESKEY_config \
268
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
269
+        > $OCF_RESKEY_pid
257 270
 
258 271
     # Spin waiting for the server to come up.
259 272
     # Let the CRM/LRM time us out if required
@@ -288,7 +301,8 @@ cinder_volume_stop() {
288 301
     ocf_run kill -s TERM $pid
289 302
     rc=$?
290 303
     if [ $rc -ne 0 ]; then
291
-        ocf_log err "OpenStack Cinder Volume (cinder-volume) couldn't be stopped"
304
+        ocf_log err "OpenStack Cinder Volume (cinder-volume) couldn't be" \
305
+            "stopped"
292 306
         exit $OCF_ERR_GENERIC
293 307
     fi
294 308
 
@@ -306,15 +320,16 @@ cinder_volume_stop() {
306 320
         fi
307 321
         count=`expr $count + 1`
308 322
         sleep 1
309
-        ocf_log debug "OpenStack Cinder Volume (cinder-volume) still hasn't stopped yet. Waiting ..."
323
+        ocf_log debug "OpenStack Cinder Volume (cinder-volume) still hasn't" \
324
+            "stopped yet. Waiting ..."
310 325
     done
311 326
 
312 327
     cinder_volume_status
313 328
     rc=$?
314 329
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
315 330
         # SIGTERM didn't help either, try SIGKILL
316
-        ocf_log info "OpenStack Cinder Volume (cinder-volume) failed to stop after ${shutdown_timeout}s \
317
-            using SIGTERM. Trying SIGKILL ..."
331
+        ocf_log info "OpenStack Cinder Volume (cinder-volume) failed to stop" \
332
+            "after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
318 333
         ocf_run kill -s KILL $pid
319 334
     fi
320 335
 

+ 19
- 11
ocf/glance-api View File

@@ -3,7 +3,8 @@
3 3
 #
4 4
 # OpenStack ImageService (glance-api)
5 5
 #
6
-# Description:  Manages an OpenStack ImageService (glance-api) process as an HA resource
6
+# Description:  Manages an OpenStack ImageService (glance-api) process as an HA
7
+#               resource
7 8
 #
8 9
 # Authors:      Martin Gerhard Loschwitz
9 10
 #
@@ -219,7 +220,8 @@ glance_api_status() {
219 220
     if [ $rc -eq 0 ]; then
220 221
         return $OCF_SUCCESS
221 222
     else
222
-        ocf_log info "Old PID file found, but OpenStack ImageService (glance-api) is not running"
223
+        ocf_log info "Old PID file found, but OpenStack ImageService" \
224
+            "(glance-api) is not running"
223 225
         return $OCF_NOT_RUNNING
224 226
     fi
225 227
 }
@@ -237,7 +239,8 @@ glance_api_monitor() {
237 239
 
238 240
     # Monitor the RA by retrieving the image list
239 241
     if [ -n "$OCF_RESKEY_os_username" ] && [ -n "$OCF_RESKEY_os_password" ] \
240
-    && [ -n "$OCF_RESKEY_os_tenant_name" ] && [ -n "$OCF_RESKEY_os_auth_url" ]; then
242
+        && [ -n "$OCF_RESKEY_os_tenant_name" ] \
243
+        && \ [ -n "$OCF_RESKEY_os_auth_url" ]; then
241 244
         ocf_run -q $OCF_RESKEY_client_binary \
242 245
         --os_username "$OCF_RESKEY_os_username" \
243 246
         --os_password "$OCF_RESKEY_os_password" \
@@ -246,7 +249,8 @@ glance_api_monitor() {
246 249
         index > /dev/null 2>&1
247 250
         rc=$?
248 251
         if [ $rc -ne 0 ]; then
249
-            ocf_log err "Failed to connect to the OpenStack ImageService (glance-api): $rc"
252
+            ocf_log err "Failed to connect to the OpenStack ImageService" \
253
+                "(glance-api): $rc"
250 254
             return $OCF_NOT_RUNNING
251 255
         fi
252 256
     fi
@@ -265,10 +269,13 @@ glance_api_start() {
265 269
         return $OCF_SUCCESS
266 270
     fi
267 271
 
268
-    # run the actual glance-api daemon. Don't use ocf_run as we're sending the tool's output
269
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
270
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file $OCF_RESKEY_config \
271
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
272
+    # run the actual glance-api daemon. Don't use ocf_run as we're sending the
273
+    # tool's output straight to /dev/null anyway and using ocf_run would break
274
+    # stdout-redirection here.
275
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
276
+        --config-file $OCF_RESKEY_config \
277
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
278
+        > $OCF_RESKEY_pid
272 279
 
273 280
     # Spin waiting for the server to come up.
274 281
     # Let the CRM/LRM time us out if required
@@ -321,15 +328,16 @@ glance_api_stop() {
321 328
         fi
322 329
         count=`expr $count + 1`
323 330
         sleep 1
324
-        ocf_log debug "OpenStack ImageService (glance-api) still hasn't stopped yet. Waiting ..."
331
+        ocf_log debug "OpenStack ImageService (glance-api) still hasn't" \
332
+            "stopped yet. Waiting ..."
325 333
     done
326 334
 
327 335
     glance_api_status
328 336
     rc=$?
329 337
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
330 338
         # SIGTERM didn't help either, try SIGKILL
331
-        ocf_log info "OpenStack ImageService (glance-api) failed to stop after ${shutdown_timeout}s \
332
-            using SIGTERM. Trying SIGKILL ..."
339
+        ocf_log info "OpenStack ImageService (glance-api) failed to stop" \
340
+            "after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
333 341
         ocf_run kill -s KILL $pid
334 342
     fi
335 343
 

+ 33
- 20
ocf/glance-registry View File

@@ -3,7 +3,8 @@
3 3
 #
4 4
 # OpenStack ImageService (glance-registry)
5 5
 #
6
-# Description:  Manages an OpenStack ImageService (glance-registry) process as an HA resource
6
+# Description:  Manages an OpenStack ImageService (glance-registry) process as
7
+#               an HA resource
7 8
 #
8 9
 # Authors:      Martin Gerhard Loschwitz
9 10
 #
@@ -40,14 +41,14 @@ OCF_RESKEY_config_default="/etc/glance/glance-registry.conf"
40 41
 OCF_RESKEY_user_default="glance"
41 42
 OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
42 43
 OCF_RESKEY_url_default="http://127.0.0.1:9191/images"
43
-OCF_RESKEY_keystone_get_token_url_default="http://127.0.0.1:5000/v2.0/tokens"
44
+OCF_RESKEY_keystone_get_token_url_def="http://127.0.0.1:5000/v2.0/tokens"
44 45
 
45 46
 : ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
46 47
 : ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
47 48
 : ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
48 49
 : ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
49 50
 : ${OCF_RESKEY_url=${OCF_RESKEY_url_default}}
50
-: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_default}}
51
+: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_def}}
51 52
 
52 53
 #######################################################################
53 54
 
@@ -128,7 +129,7 @@ The default URL to use to acquire a ImageService (glance-registry) token for mon
128 129
 of OpenStack ImageService (glance-registry)
129 130
 </longdesc>
130 131
 <shortdesc lang="en">OpenStack ImageService (glance-registry) url</shortdesc>
131
-<content type="string" default="${OCF_RESKEY_keystone_get_token_url_default}" />
132
+<content type="string" default="${OCF_RESKEY_keystone_get_token_url_def}" />
132 133
 </parameter>
133 134
 
134 135
 <parameter name="os_username" unique="0" required="0">
@@ -226,7 +227,8 @@ glance_registry_status() {
226 227
     if [ $rc -eq 0 ]; then
227 228
         return $OCF_SUCCESS
228 229
     else
229
-        ocf_log info "Old PID file found, but OpenStack ImageService (glance-registry) is not running"
230
+        ocf_log info "Old PID file found, but OpenStack ImageService" \
231
+            "(glance-registry) is not running"
230 232
         return $OCF_NOT_RUNNING
231 233
     fi
232 234
 }
@@ -247,15 +249,21 @@ glance_registry_monitor() {
247 249
     # Check whether we are supposed to monitor by logging into glance-registry
248 250
     # and do it if that's the case.
249 251
     if [ -n "$OCF_RESKEY_os_username" ] && [ -n "$OCF_RESKEY_os_password" ] \
250
-    && [ -n "$OCF_RESKEY_os_tenant_name" ] && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
251
-        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": {\"username\": \"$OCF_RESKEY_os_username\", \
252
-            \"password\": \"$OCF_RESKEY_os_password\"}, \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
253
-            -H "Content-type: application/json" $OCF_RESKEY_keystone_get_token_url | tr ',' '\n' | grep '"id":' \
254
-            | cut -d'"' -f4 | head --lines 1`
255
-        http_code=`curl --write-out %{http_code} --output /dev/null -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
252
+        && [ -n "$OCF_RESKEY_os_tenant_name" ] \
253
+        && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
254
+        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": \
255
+            {\"username\": \"$OCF_RESKEY_os_username\", \
256
+            \"password\": \"$OCF_RESKEY_os_password\"}, \
257
+            \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
258
+            -H "Content-type: application/json" \
259
+            $OCF_RESKEY_keystone_get_token_url | \
260
+            tr ',' '\n' | grep '"id":' | cut -d'"' -f4 | head --lines 1`
261
+        http_code=`curl --write-out %{http_code} --output /dev/null \
262
+            -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
256 263
         rc=$?
257 264
         if [ $rc -ne 0 ] || [ $http_code -ne 200 ]; then
258
-            ocf_log err "Failed to connect to the OpenStack ImageService (glance-registry): $rc and $http_code"
265
+            ocf_log err "Failed to connect to the OpenStack ImageService" \
266
+                "(glance-registry): $rc and $http_code"
259 267
             return $OCF_NOT_RUNNING
260 268
         fi
261 269
     fi
@@ -274,10 +282,13 @@ glance_registry_start() {
274 282
         return $OCF_SUCCESS
275 283
     fi
276 284
 
277
-    # run the actual glance-registry daemon. Don't use ocf_run as we're sending the tool's output
278
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
279
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file $OCF_RESKEY_config \
280
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
285
+    # run the actual glance-registry daemon. Don't use ocf_run as we're sending
286
+    # the tool's output straight to /dev/null anyway and using ocf_run would
287
+    # break stdout-redirection here.
288
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
289
+        --config-file $OCF_RESKEY_config \
290
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
291
+        > $OCF_RESKEY_pid
281 292
 
282 293
     # Spin waiting for the server to come up.
283 294
     # Let the CRM/LRM time us out if required
@@ -312,7 +323,8 @@ glance_registry_stop() {
312 323
     ocf_run kill -s TERM $pid
313 324
     rc=$?
314 325
     if [ $rc -ne 0 ]; then
315
-        ocf_log err "OpenStack ImageService (glance-registry) couldn't be stopped"
326
+        ocf_log err "OpenStack ImageService (glance-registry) couldn't be" \
327
+            "stopped"
316 328
         exit $OCF_ERR_GENERIC
317 329
     fi
318 330
 
@@ -330,15 +342,16 @@ glance_registry_stop() {
330 342
         fi
331 343
         count=`expr $count + 1`
332 344
         sleep 1
333
-        ocf_log debug "OpenStack ImageService (glance-registry) still hasn't stopped yet. Waiting ..."
345
+        ocf_log debug "OpenStack ImageService (glance-registry) still hasn't" \
346
+            "stopped yet. Waiting ..."
334 347
     done
335 348
 
336 349
     glance_registry_status
337 350
     rc=$?
338 351
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
339 352
         # SIGTERM didn't help either, try SIGKILL
340
-        ocf_log info "OpenStack ImageService (glance-registry) failed to stop after ${shutdown_timeout}s \
341
-            using SIGTERM. Trying SIGKILL ..."
353
+        ocf_log info "OpenStack ImageService (glance-registry) failed to" \
354
+            "stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
342 355
         ocf_run kill -s KILL $pid
343 356
     fi
344 357
 

+ 33
- 18
ocf/heat-engine View File

@@ -3,7 +3,8 @@
3 3
 #
4 4
 # OpenStack Orchestration Engine Service (heat-engine)
5 5
 #
6
-# Description:  Manages an OpenStack Orchestration Engine Service (heat-engine) process as an HA resource
6
+# Description:  Manages an OpenStack Orchestration Engine Service (heat-engine)
7
+#               process as an HA resource
7 8
 #
8 9
 # Authors:      Emilien Macchi
9 10
 #
@@ -203,7 +204,8 @@ heat_engine_status() {
203 204
     local rc
204 205
 
205 206
     if [ ! -f $OCF_RESKEY_pid ]; then
206
-        ocf_log info "OpenStack Orchestration Engine (heat-engine) is not running"
207
+        ocf_log info "OpenStack Orchestration Engine (heat-engine) is not" \
208
+            "running"
207 209
         return $OCF_NOT_RUNNING
208 210
     else
209 211
         pid=`cat $OCF_RESKEY_pid`
@@ -214,7 +216,8 @@ heat_engine_status() {
214 216
     if [ $rc -eq 0 ]; then
215 217
         return $OCF_SUCCESS
216 218
     else
217
-        ocf_log info "Old PID file found, but OpenStack Orchestration Engine (heat-engine) is not running"
219
+        ocf_log info "Old PID file found, but OpenStack Orchestration Engine" \
220
+            "(heat-engine) is not running"
218 221
         return $OCF_NOT_RUNNING
219 222
     fi
220 223
 }
@@ -233,17 +236,22 @@ heat_engine_monitor() {
233 236
         return $rc
234 237
     fi
235 238
 
236
-    # Check the connections according to the PID.
237
-    # We are sure to hit the heat-engine process and not other heat process with the same connection behavior (for example heat-api)
239
+    # Check the connections according to the PID.  We are sure to hit the
240
+    # heat-engine process and not other heat process with the same connection
241
+    # behavior (for example heat-api)
238 242
     pid=`cat $OCF_RESKEY_pid`
239
-    engine_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
243
+    engine_amqp_check=`netstat -punt | \
244
+        grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
245
+        grep -qs "ESTABLISHED"`
240 246
     rc_amqp=$?
241 247
     if [ $rc_amqp -ne 0 ]; then
242
-        ocf_log err "Heat Engine is not connected to the AMQP server: AMQP connection test returned $rc_amqp"
248
+        ocf_log err "Heat Engine is not connected to the AMQP server: AMQP" \
249
+            "connection test returned $rc_amqp"
243 250
         return $OCF_NOT_RUNNING
244 251
     fi
245 252
 
246
-    ocf_log debug "OpenStack Orchestration Engine (heat-engine) monitor succeeded"
253
+    ocf_log debug "OpenStack Orchestration Engine (heat-engine) monitor" \
254
+        "succeeded"
247 255
     return $OCF_SUCCESS
248 256
 }
249 257
 
@@ -253,14 +261,18 @@ heat_engine_start() {
253 261
     heat_engine_status
254 262
     rc=$?
255 263
     if [ $rc -eq $OCF_SUCCESS ]; then
256
-        ocf_log info "OpenStack Orchestration Engine (heat-engine) already running"
264
+        ocf_log info "OpenStack Orchestration Engine (heat-engine) already" \
265
+            "running"
257 266
         return $OCF_SUCCESS
258 267
     fi
259 268
 
260
-    # run the actual heat-engine daemon. Don't use ocf_run as we're sending the tool's output
261
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
262
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
263
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
269
+    # run the actual heat-engine daemon. Don't use ocf_run as we're sending the
270
+    # tool's output straight to /dev/null anyway and using ocf_run would break
271
+    # stdout-redirection here.
272
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
273
+        --config-file=$OCF_RESKEY_config \
274
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
275
+        > $OCF_RESKEY_pid
264 276
 
265 277
     # Spin waiting for the server to come up.
266 278
     while true; do
@@ -285,7 +297,8 @@ heat_engine_stop() {
285 297
     heat_engine_status
286 298
     rc=$?
287 299
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
288
-        ocf_log info "OpenStack Orchestration Engine (heat-engine) already stopped"
300
+        ocf_log info "OpenStack Orchestration Engine (heat-engine) already" \
301
+            "stopped"
289 302
         return $OCF_SUCCESS
290 303
     fi
291 304
 
@@ -294,7 +307,8 @@ heat_engine_stop() {
294 307
     ocf_run kill -s TERM $pid
295 308
     rc=$?
296 309
     if [ $rc -ne 0 ]; then
297
-        ocf_log err "OpenStack Orchestration Engine (heat-engine) couldn't be stopped"
310
+        ocf_log err "OpenStack Orchestration Engine (heat-engine) couldn't" \
311
+            "be stopped"
298 312
         exit $OCF_ERR_GENERIC
299 313
     fi
300 314
 
@@ -312,15 +326,16 @@ heat_engine_stop() {
312 326
         fi
313 327
         count=`expr $count + 1`
314 328
         sleep 1
315
-        ocf_log debug "OpenStack Orchestration Engine (heat-engine) still hasn't stopped yet. Waiting ..."
329
+        ocf_log debug "OpenStack Orchestration Engine (heat-engine) still" \
330
+            "hasn't stopped yet. Waiting ..."
316 331
     done
317 332
 
318 333
     heat_engine_status
319 334
     rc=$?
320 335
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
321 336
         # SIGTERM didn't help either, try SIGKILL
322
-        ocf_log info "OpenStack Orchestration Engine (heat-engine) failed to stop after ${shutdown_timeout}s \
323
-            using SIGTERM. Trying SIGKILL ..."
337
+        ocf_log info "OpenStack Orchestration Engine (heat-engine) failed to" \
338
+            "stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
324 339
         ocf_run kill -s KILL $pid
325 340
     fi
326 341
 

+ 18
- 11
ocf/keystone View File

@@ -219,7 +219,8 @@ keystone_status() {
219 219
     if [ $rc -eq 0 ]; then
220 220
         return $OCF_SUCCESS
221 221
     else
222
-        ocf_log info "Old PID file found, but OpenStack Identity (Keystone) is not running"
222
+        ocf_log info "Old PID file found, but OpenStack Identity (Keystone)" \
223
+            "is not running"
223 224
         return $OCF_NOT_RUNNING
224 225
     fi
225 226
 }
@@ -238,8 +239,9 @@ keystone_monitor() {
238 239
     # Check whether we are supposed to monitor by logging into Keystone
239 240
     # and do it if that's the case.
240 241
     if [ -n "$OCF_RESKEY_client_binary" ] && [ -n "$OCF_RESKEY_os_username" ] \
241
-    && [ -n "$OCF_RESKEY_os_password" ] && [ -n "$OCF_RESKEY_os_tenant_name" ] \
242
-    && [ -n "$OCF_RESKEY_os_auth_url" ]; then
242
+        && [ -n "$OCF_RESKEY_os_password" ] \
243
+        && [ -n "$OCF_RESKEY_os_tenant_name" ] \
244
+        && [ -n "$OCF_RESKEY_os_auth_url" ]; then
243 245
         ocf_run -q $OCF_RESKEY_client_binary \
244 246
         --os-username "$OCF_RESKEY_os_username" \
245 247
         --os-password "$OCF_RESKEY_os_password" \
@@ -248,7 +250,8 @@ keystone_monitor() {
248 250
         user-list > /dev/null 2>&1
249 251
         rc=$?
250 252
         if [ $rc -ne 0 ]; then
251
-            ocf_log err "Failed to connect to the OpenStack Identity (Keystone): $rc"
253
+            ocf_log err "Failed to connect to the OpenStack Identity" \
254
+                "(Keystone): $rc"
252 255
             return $OCF_NOT_RUNNING
253 256
         fi
254 257
     fi
@@ -267,10 +270,13 @@ keystone_start() {
267 270
         return $OCF_SUCCESS
268 271
     fi
269 272
 
270
-    # run the actual keystone daemon. Don't use ocf_run as we're sending the tool's output
271
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
272
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file $OCF_RESKEY_config \
273
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
273
+    # run the actual keystone daemon. Don't use ocf_run as we're sending the
274
+    # tool's output straight to /dev/null anyway and using ocf_run would break
275
+    # stdout-redirection here.
276
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
277
+        --config-file $OCF_RESKEY_config \
278
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
279
+        > $OCF_RESKEY_pid
274 280
 
275 281
     # Spin waiting for the server to come up.
276 282
     # Let the CRM/LRM time us out if required
@@ -323,15 +329,16 @@ keystone_stop() {
323 329
         fi
324 330
         count=`expr $count + 1`
325 331
         sleep 1
326
-        ocf_log debug "OpenStack Identity (Keystone) still hasn't stopped yet. Waiting ..."
332
+        ocf_log debug "OpenStack Identity (Keystone) still hasn't stopped" \
333
+            "yet. Waiting ..."
327 334
     done
328 335
 
329 336
     keystone_status
330 337
     rc=$?
331 338
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
332 339
         # SIGTERM didn't help either, try SIGKILL
333
-        ocf_log info "OpenStack Identity (Keystone) failed to stop after ${shutdown_timeout}s \
334
-            using SIGTERM. Trying SIGKILL ..."
340
+        ocf_log info "OpenStack Identity (Keystone) failed to stop after" \
341
+            "${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
335 342
         ocf_run kill -s KILL $pid
336 343
     fi
337 344
 

+ 31
- 19
ocf/manila-api View File

@@ -3,7 +3,8 @@
3 3
 #
4 4
 # OpenStack Manila API (manila-api)
5 5
 #
6
-# Description:  Manages an OpenStack Manila API (manila-api) process as an HA resource
6
+# Description:  Manages an OpenStack Manila API (manila-api) process as an HA
7
+#               resource
7 8
 #
8 9
 # Authors:      Emilian Macchi, Clinton Knight
9 10
 # Mainly inspired by the Nova API written by Sebastien Han
@@ -40,14 +41,14 @@ OCF_RESKEY_config_default="/etc/manila/manila.conf"
40 41
 OCF_RESKEY_user_default="manila"
41 42
 OCF_RESKEY_pid_default="$HA_RSCTMP/manila.pid"
42 43
 OCF_RESKEY_url_default="http://127.0.0.1:8786/v2/"
43
-OCF_RESKEY_keystone_get_token_url_default="http://127.0.0.1:5000/v2.0/tokens"
44
+OCF_RESKEY_keystone_get_token_url_def="http://127.0.0.1:5000/v2.0/tokens"
44 45
 
45 46
 : ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
46 47
 : ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
47 48
 : ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
48 49
 : ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
49 50
 : ${OCF_RESKEY_url=${OCF_RESKEY_url_default}}
50
-: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_default}}
51
+: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_def}}
51 52
 
52 53
 #######################################################################
53 54
 
@@ -128,7 +129,7 @@ The default URL to use to acquire a Manila API (manila-api) token for monitoring
128 129
 of OpenStack Manila API (manila-api)
129 130
 </longdesc>
130 131
 <shortdesc lang="en">OpenStack Manila API (manila-api) url</shortdesc>
131
-<content type="string" default="${OCF_RESKEY_keystone_get_token_url_default}" />
132
+<content type="string" default="${OCF_RESKEY_keystone_get_token_url_def}" />
132 133
 </parameter>
133 134
 
134 135
 <parameter name="os_username" unique="0" required="0">
@@ -233,7 +234,8 @@ manila_api_status() {
233 234
     if [ $rc -eq 0 ]; then
234 235
         return $OCF_SUCCESS
235 236
     else
236
-        ocf_log info "Old PID file found, but OpenStack Manila API (manila-api) is not running"
237
+        ocf_log info "Old PID file found, but OpenStack Manila API" \
238
+            "(manila-api) is not running"
237 239
         return $OCF_NOT_RUNNING
238 240
     fi
239 241
 }
@@ -253,15 +255,21 @@ manila_api_monitor() {
253 255
 
254 256
     # Check detailed information about this specific version of the API.
255 257
     if [ -n "$OCF_RESKEY_os_username" ] && [ -n "$OCF_RESKEY_os_password" ] \
256
-    && [ -n "$OCF_RESKEY_os_tenant_name" ] && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
257
-        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": {\"username\": \"$OCF_RESKEY_os_username\", \
258
-            \"password\": \"$OCF_RESKEY_os_password\"}, \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
259
-            -H "Content-type: application/json" $OCF_RESKEY_keystone_get_token_url | tr ',' '\n' | grep '"id":' \
260
-            | cut -d'"' -f4 | head --lines 1`
261
-        http_code=`curl --write-out %{http_code} --output /dev/null -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
258
+        && [ -n "$OCF_RESKEY_os_tenant_name" ] \
259
+        && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
260
+        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": \
261
+            {\"username\": \"$OCF_RESKEY_os_username\", \
262
+            \"password\": \"$OCF_RESKEY_os_password\"}, \
263
+            \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
264
+            -H "Content-type: application/json" \
265
+            $OCF_RESKEY_keystone_get_token_url | \
266
+            tr ',' '\n' | grep '"id":' \ | cut -d'"' -f4 | head --lines 1`
267
+        http_code=`curl --write-out %{http_code} --output /dev/null \
268
+            -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
262 269
         rc=$?
263 270
         if [ $rc -ne 0 ] || [ $http_code -ne 200 ]; then
264
-            ocf_log err "Failed to connect to the OpenStack Manila API (manila-api): $rc and $http_code"
271
+            ocf_log err "Failed to connect to the OpenStack Manila API" \
272
+                "(manila-api): $rc and $http_code"
265 273
             return $OCF_NOT_RUNNING
266 274
         fi
267 275
     fi
@@ -280,10 +288,13 @@ manila_api_start() {
280 288
         return $OCF_SUCCESS
281 289
     fi
282 290
 
283
-    # run the actual manila-api daemon. Don't use ocf_run as we're sending the tool's output
284
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
285
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
286
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
291
+    # run the actual manila-api daemon. Don't use ocf_run as we're sending the
292
+    # tool's output straight to /dev/null anyway and using ocf_run would break
293
+    # stdout-redirection here.
294
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
295
+        --config-file=$OCF_RESKEY_config \
296
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
297
+        > $OCF_RESKEY_pid
287 298
 
288 299
     # Spin waiting for the server to come up.
289 300
     # Let the CRM/LRM time us out if required
@@ -336,15 +347,16 @@ manila_api_stop() {
336 347
         fi
337 348
         count=`expr $count + 1`
338 349
         sleep 1
339
-        ocf_log debug "OpenStack Manila API (manila-api) still hasn't stopped yet. Waiting ..."
350
+        ocf_log debug "OpenStack Manila API (manila-api) still hasn't" \
351
+            "stopped yet. Waiting ..."
340 352
     done
341 353
 
342 354
     manila_api_status
343 355
     rc=$?
344 356
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
345 357
         # SIGTERM didn't help either, try SIGKILL
346
-        ocf_log info "OpenStack Manila API (manila-api) failed to stop after ${shutdown_timeout}s \
347
-            using SIGTERM. Trying SIGKILL ..."
358
+        ocf_log info "OpenStack Manila API (manila-api) failed to stop after" \
359
+            "${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
348 360
         ocf_run kill -s KILL $pid
349 361
     fi
350 362
 

+ 36
- 19
ocf/neutron-agent-dhcp View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack DHCP Service (neutron-dhcp-agent)
5 5
 #
6
-# Description:  Manages an OpenStack DHCP Service (neutron-dhcp-agent) process as an HA resource
6
+# Description:  Manages an OpenStack DHCP Service (neutron-dhcp-agent) process
7
+#               as an HA resource
7 8
 #
8 9
 # Authors: Emilien Macchi
9
-# Mainly inspired by the Nova Network resource agent written by Emilien Macchi & Sebastien Han
10
+# Mainly inspired by the Nova Network resource agent written by Emilien Macchi
11
+# & Sebastien Han
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -184,7 +186,8 @@ neutron_dhcp_agent_status() {
184 186
     local rc
185 187
 
186 188
     if [ ! -f $OCF_RESKEY_pid ]; then
187
-        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) is not running"
189
+        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) is not" \
190
+            "running"
188 191
         return $OCF_NOT_RUNNING
189 192
     else
190 193
         pid=`cat $OCF_RESKEY_pid`
@@ -195,7 +198,8 @@ neutron_dhcp_agent_status() {
195 198
     if [ $rc -eq 0 ]; then
196 199
         return $OCF_SUCCESS
197 200
     else
198
-        ocf_log info "Old PID file found, but OpenStack DHCP Server (neutron-dhcp-agent) is not running"
201
+        ocf_log info "Old PID file found, but OpenStack DHCP Server" \
202
+            "(neutron-dhcp-agent) is not running"
199 203
         return $OCF_NOT_RUNNING
200 204
     fi
201 205
 }
@@ -214,17 +218,22 @@ neutron_dhcp_agent_monitor() {
214 218
     fi
215 219
 
216 220
     # Check the connections according to the PID.
217
-    # We are sure to hit the scheduler process and not other Neutron process with the same connection behavior (for example neutron-server)
221
+    # We are sure to hit the scheduler process and not other Neutron process
222
+    # with the same connection behavior (for example neutron-server)
218 223
         pid=`cat $OCF_RESKEY_pid`
219 224
         # check the connections according to the PID
220
-        network_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
225
+        network_amqp_check=`netstat -punt | \
226
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
227
+            grep -qs "ESTABLISHED"`
221 228
         rc=$?
222 229
         if [ $rc -ne 0 ]; then
223
-            ocf_log err "Neutron DHCP Server is not connected to the AMQP server : $rc"
230
+            ocf_log err "Neutron DHCP Server is not connected to the AMQP" \
231
+                "server : $rc"
224 232
             return $OCF_NOT_RUNNING
225 233
         fi
226 234
 
227
-    ocf_log debug "OpenStack DHCP Server (neutron-dhcp-agent) monitor succeeded"
235
+    ocf_log debug "OpenStack DHCP Server (neutron-dhcp-agent) monitor" \
236
+        "succeeded"
228 237
     return $OCF_SUCCESS
229 238
 }
230 239
 
@@ -234,15 +243,20 @@ neutron_dhcp_agent_start() {
234 243
     neutron_dhcp_agent_status
235 244
     rc=$?
236 245
     if [ $rc -eq $OCF_SUCCESS ]; then
237
-        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) already running"
246
+        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) already" \
247
+            "running"
238 248
         return $OCF_SUCCESS
239 249
     fi
240 250
 
241
-    # run the actual neutron-dhcp-agent daemon. Don't use ocf_run as we're sending the tool's output
242
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
243
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
244
-        --config-file=$OCF_RESKEY_plugin_config --log-file=/var/log/neutron/dhcp-agent.log $OCF_RESKEY_additional_parameters"' >> \
245
-        /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
251
+    # run the actual neutron-dhcp-agent daemon. Don't use ocf_run as we're
252
+    # sending the tool's output straight to /dev/null anyway and using ocf_run
253
+    # would break stdout-redirection here.
254
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
255
+        --config-file=$OCF_RESKEY_config \
256
+        --config-file=$OCF_RESKEY_plugin_config \
257
+        --log-file=/var/log/neutron/dhcp-agent.log \
258
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
259
+        > $OCF_RESKEY_pid
246 260
 
247 261
     # Spin waiting for the server to come up.
248 262
     # Let the CRM/LRM time us out if required
@@ -268,7 +282,8 @@ neutron_dhcp_agent_stop() {
268 282
     neutron_dhcp_agent_status
269 283
     rc=$?
270 284
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
271
-        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) already stopped"
285
+        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) already" \
286
+            "stopped"
272 287
         return $OCF_SUCCESS
273 288
     fi
274 289
 
@@ -278,7 +293,8 @@ neutron_dhcp_agent_stop() {
278 293
     ocf_run kill -s TERM $pid
279 294
     rc=$?
280 295
     if [ $rc -ne 0 ]; then
281
-        ocf_log err "OpenStack DHCP Server (neutron-dhcp-agent) couldn't be stopped"
296
+        ocf_log err "OpenStack DHCP Server (neutron-dhcp-agent) couldn't be" \
297
+            "stopped"
282 298
         exit $OCF_ERR_GENERIC
283 299
     fi
284 300
 
@@ -296,15 +312,16 @@ neutron_dhcp_agent_stop() {
296 312
         fi
297 313
         count=`expr $count + 1`
298 314
         sleep 1
299
-        ocf_log debug "OpenStack DHCP Server (neutron-dhcp-agent) still hasn't stopped yet. Waiting ..."
315
+        ocf_log debug "OpenStack DHCP Server (neutron-dhcp-agent) still" \
316
+            "hasn't stopped yet. Waiting ..."
300 317
     done
301 318
 
302 319
     neutron_dhcp_agent_status
303 320
     rc=$?
304 321
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
305 322
         # SIGTERM didn't help either, try SIGKILL
306
-        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) failed to stop after ${shutdown_timeout}s \
307
-            using SIGTERM. Trying SIGKILL ..."
323
+        ocf_log info "OpenStack DHCP Server (neutron-dhcp-agent) failed to" \
324
+            "stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
308 325
         ocf_run kill -s KILL $pid
309 326
     fi
310 327
 

+ 28
- 15
ocf/neutron-agent-l3 View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack L3 Service (neutron-l3-agent)
5 5
 #
6
-# Description:  Manages an OpenStack L3 Service (neutron-l3-agent) process as an HA resource
6
+# Description:  Manages an OpenStack L3 Service (neutron-l3-agent) process as
7
+#               an HA resource
7 8
 #
8 9
 # Authors: Emilien Macchi
9
-# Mainly inspired by the Nova Network resource agent written by Emilien Macchi & Sebastien Han
10
+# Mainly inspired by the Nova Network resource agent written by Emilien Macchi
11
+# & Sebastien Han
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -197,7 +199,8 @@ neutron_l3_agent_status() {
197 199
     if [ $rc -eq 0 ]; then
198 200
         return $OCF_SUCCESS
199 201
     else
200
-        ocf_log info "Old PID file found, but OpenStack L3 Server (neutron-l3-agent) is not running"
202
+        ocf_log info "Old PID file found, but OpenStack L3 Server" \
203
+            "(neutron-l3-agent) is not running"
201 204
         return $OCF_NOT_RUNNING
202 205
     fi
203 206
 }
@@ -216,13 +219,17 @@ neutron_l3_agent_monitor() {
216 219
     fi
217 220
 
218 221
     # Check the connections according to the PID.
219
-    # We are sure to hit the scheduler process and not other Neutron process with the same connection behavior (for example neutron-server)
222
+    # We are sure to hit the scheduler process and not other Neutron process
223
+    # with the same connection behavior (for example neutron-server)
220 224
         pid=`cat $OCF_RESKEY_pid`
221 225
         # check the connections according to the PID
222
-        network_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
226
+        network_amqp_check=`netstat -punt | \
227
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
228
+            grep -qs "ESTABLISHED"`
223 229
         rc=$?
224 230
         if [ $rc -ne 0 ]; then
225
-            ocf_log err "Neutron L3 Server is not connected to the Neutron server: $rc"
231
+            ocf_log err "Neutron L3 Server is not connected to the Neutron" \
232
+                "server: $rc"
226 233
             return $OCF_NOT_RUNNING
227 234
         fi
228 235
 
@@ -240,11 +247,15 @@ neutron_l3_agent_start() {
240 247
         return $OCF_SUCCESS
241 248
     fi
242 249
 
243
-    # run the actual neutron-l3-agent daemon. Don't use ocf_run as we're sending the tool's output
244
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
245
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
246
-        --config-file=$OCF_RESKEY_plugin_config --log-file=/var/log/neutron/l3-agent.log $OCF_RESKEY_additional_parameters"' >> \
247
-        /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
250
+    # run the actual neutron-l3-agent daemon. Don't use ocf_run as we're
251
+    # sending the tool's output straight to /dev/null anyway and using ocf_run
252
+    # would break stdout-redirection here.
253
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
254
+        --config-file=$OCF_RESKEY_config \
255
+        --config-file=$OCF_RESKEY_plugin_config \
256
+        --log-file=/var/log/neutron/l3-agent.log \
257
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
258
+        > $OCF_RESKEY_pid
248 259
 
249 260
     # Spin waiting for the server to come up.
250 261
     # Let the CRM/LRM time us out if required
@@ -279,7 +290,8 @@ neutron_l3_agent_stop() {
279 290
     ocf_run kill -s TERM $pid
280 291
     rc=$?
281 292
     if [ $rc -ne 0 ]; then
282
-        ocf_log err "OpenStack L3 Server (neutron-l3-agent) couldn't be stopped"
293
+        ocf_log err "OpenStack L3 Server (neutron-l3-agent) couldn't be" \
294
+            "stopped"
283 295
         exit $OCF_ERR_GENERIC
284 296
     fi
285 297
 
@@ -297,15 +309,16 @@ neutron_l3_agent_stop() {
297 309
         fi
298 310
         count=`expr $count + 1`
299 311
         sleep 1
300
-        ocf_log debug "OpenStack L3 Server (neutron-l3-agent) still hasn't stopped yet. Waiting ..."
312
+        ocf_log debug "OpenStack L3 Server (neutron-l3-agent) still hasn't" \
313
+            "stopped yet. Waiting ..."
301 314
     done
302 315
 
303 316
     neutron_l3_agent_status
304 317
     rc=$?
305 318
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
306 319
         # SIGTERM didn't help either, try SIGKILL
307
-        ocf_log info "OpenStack L3 Server (neutron-l3-agent) failed to stop after ${shutdown_timeout}s \
308
-            using SIGTERM. Trying SIGKILL ..."
320
+        ocf_log info "OpenStack L3 Server (neutron-l3-agent) failed to stop" \
321
+            "after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
309 322
         ocf_run kill -s KILL $pid
310 323
     fi
311 324
 

+ 8
- 4
ocf/neutron-ha-tool View File

@@ -166,7 +166,8 @@ neutron_ha_tool_validate() {
166 166
     check_binary $OCF_RESKEY_binary
167 167
     if [ -n "$OCF_RESKEY_os_cacert" ]; then
168 168
         if [ ! -f "$OCF_RESKEY_os_cacert" ]; then
169
-            ocf_log err "Failed to verify CA Certifcate Bundle ($OCF_RESKEY_os_cacert)"
169
+            ocf_log err "Failed to verify CA Certifcate Bundle" \
170
+                "($OCF_RESKEY_os_cacert)"
170 171
             return 1
171 172
         fi
172 173
     fi
@@ -207,7 +208,8 @@ neutron_ha_tool_start() {
207 208
 
208 209
     rc=$?
209 210
     if [ $rc -ne 0 ]; then
210
-        ocf_log err "Neutron HA Tool failed to replicate networks to DHCP agents."
211
+        ocf_log err "Neutron HA Tool failed to replicate networks to DHCP" \
212
+            "agents."
211 213
         return $OCF_ERR_GENERIC
212 214
     fi
213 215
 
@@ -215,10 +217,12 @@ neutron_ha_tool_start() {
215 217
 
216 218
     rc=$?
217 219
     if [ $rc -ne 0 ]; then
218
-        ocf_log err "Neutron HA Tool failed to migrate routers away from offline L3 agents."
220
+        ocf_log err "Neutron HA Tool failed to migrate routers away from" \
221
+            "offline L3 agents."
219 222
         return $OCF_ERR_GENERIC
220 223
     fi
221
-    ocf_log debug "Neutron HA Tool (neutron-ha-tool) router migration succeeded."
224
+    ocf_log debug "Neutron HA Tool (neutron-ha-tool) router migration" \
225
+        "succeeded."
222 226
     return $OCF_SUCCESS
223 227
 }
224 228
 

+ 39
- 21
ocf/neutron-metadata-agent View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack Neutron Metadata Agent (neutron-metadata-agent)
5 5
 #
6
-# Description:  Manages an OpenStack Volumes (neutron-metadata-agent) process as an HA resource
6
+# Description:  Manages an OpenStack Volumes (neutron-metadata-agent) process
7
+#               as an HA resource
7 8
 #
8 9
 # Authors:      Sébastien Han
9
-# Mainly inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Glance API resource agent written by Martin Gerhard
11
+# Loschwitz from Hastexo: http://goo.gl/whLpr
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -181,7 +183,8 @@ neutron_metadata_agent_status() {
181 183
     local rc
182 184
 
183 185
     if [ ! -f $OCF_RESKEY_pid ]; then
184
-        ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent) is not running"
186
+        ocf_log info "OpenStack Neutron Metadata Agent" \
187
+            "(neutron-metadata-agent) is not running"
185 188
         return $OCF_NOT_RUNNING
186 189
     else
187 190
         pid=`cat $OCF_RESKEY_pid`
@@ -192,7 +195,8 @@ neutron_metadata_agent_status() {
192 195
     if [ $rc -eq 0 ]; then
193 196
         return $OCF_SUCCESS
194 197
     else
195
-        ocf_log info "Old PID file found, but OpenStack Neutron Metadata Agent (neutron-metadata-agent) is not running"
198
+        ocf_log info "Old PID file found, but OpenStack Neutron Metadata" \
199
+            "Agent (neutron-metadata-agent) is not running"
196 200
         return $OCF_NOT_RUNNING
197 201
     fi
198 202
 }
@@ -202,7 +206,8 @@ neutron_metadata_agent_monitor() {
202 206
     local rc
203 207
 
204 208
     if [ ! -f $OCF_RESKEY_pid ]; then
205
-        ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent) is not running"
209
+        ocf_log info "OpenStack Neutron Metadata Agent" \
210
+            "(neutron-metadata-agent) is not running"
206 211
         return $OCF_NOT_RUNNING
207 212
     else
208 213
         pid=`cat $OCF_RESKEY_pid`
@@ -213,7 +218,8 @@ neutron_metadata_agent_monitor() {
213 218
     if [ $rc -eq 0 ]; then
214 219
         return $OCF_SUCCESS
215 220
     else
216
-        ocf_log info "Old PID file found, but OpenStack Neutron Metadata Agent (neutron-metadata-agent) is not running"
221
+        ocf_log info "Old PID file found, but OpenStack Neutron Metadata" \
222
+            "Agent (neutron-metadata-agent) is not running"
217 223
         return $OCF_NOT_RUNNING
218 224
     fi
219 225
 }
@@ -224,16 +230,21 @@ neutron_metadata_agent_start() {
224 230
     neutron_metadata_agent_status
225 231
     rc=$?
226 232
     if [ $rc -eq $OCF_SUCCESS ]; then
227
-        ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent) already running"
233
+        ocf_log info "OpenStack Neutron Metadata Agent" \
234
+            "(neutron-metadata-agent) already running"
228 235
         return $OCF_SUCCESS
229 236
     fi
230 237
 
231
-    # run the actual neutron-server daemon with correct configurations files (server + plugin)
232
-    # Don't use ocf_run as we're sending the tool's output
233
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
234
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
235
-        --config-file=$OCF_RESKEY_agent_config --log-file=/var/log/neutron/metadata.log $OCF_RESKEY_additional_parameters"' >> \
236
-        /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
238
+    # run the actual neutron-server daemon with correct configurations files
239
+    # (server + plugin)
240
+    # Don't use ocf_run as we're sending the tool's output straight to
241
+    # /dev/null anyway and using ocf_run would break stdout-redirection here.
242
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
243
+        --config-file=$OCF_RESKEY_config \
244
+        --config-file=$OCF_RESKEY_agent_config \
245
+        --log-file=/var/log/neutron/metadata.log \
246
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
247
+        > $OCF_RESKEY_pid
237 248
 
238 249
     # Spin waiting for the server to come up.
239 250
     # Let the CRM/LRM time us out if required
@@ -242,13 +253,15 @@ neutron_metadata_agent_start() {
242 253
     rc=$?
243 254
     [ $rc -eq $OCF_SUCCESS ] && break
244 255
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
245
-        ocf_log err "OpenStack Neutron Metadata Agent (neutron-metadata-agent) start failed"
256
+        ocf_log err "OpenStack Neutron Metadata Agent" \
257
+            "(neutron-metadata-agent) start failed"
246 258
         exit $OCF_ERR_GENERIC
247 259
     fi
248 260
     sleep 1
249 261
     done
250 262
 
251
-    ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent) started"
263
+    ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent)" \
264
+        "started"
252 265
     return $OCF_SUCCESS
253 266
 }
254 267
 
@@ -259,7 +272,8 @@ neutron_metadata_agent_stop() {
259 272
     neutron_metadata_agent_status
260 273
     rc=$?
261 274
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
262
-        ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent) already stopped"
275
+        ocf_log info "OpenStack Neutron Metadata Agent" \
276
+            "(neutron-metadata-agent) already stopped"
263 277
         return $OCF_SUCCESS
264 278
     fi
265 279
 
@@ -268,7 +282,8 @@ neutron_metadata_agent_stop() {
268 282
     ocf_run kill -s TERM $pid
269 283
     rc=$?
270 284
     if [ $rc -ne 0 ]; then
271
-        ocf_log err "OpenStack Neutron Metadata Agent (neutron-metadata-agent) couldn't be stopped"
285
+        ocf_log err "OpenStack Neutron Metadata Agent" \
286
+            "(neutron-metadata-agent) couldn't be stopped"
272 287
         exit $OCF_ERR_GENERIC
273 288
     fi
274 289
 
@@ -286,19 +301,22 @@ neutron_metadata_agent_stop() {
286 301
         fi
287 302
         count=`expr $count + 1`
288 303
         sleep 1
289
-        ocf_log debug "OpenStack Neutron Metadata Agent (neutron-metadata-agent) still hasn't stopped yet. Waiting ..."
304
+        ocf_log debug "OpenStack Neutron Metadata Agent" \
305
+            "(neutron-metadata-agent) still hasn't stopped yet. Waiting ..."
290 306
     done
291 307
 
292 308
     neutron_metadata_agent_status
293 309
     rc=$?
294 310
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
295 311
         # SIGTERM didn't help either, try SIGKILL
296
-        ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent) failed to stop after ${shutdown_timeout}s \
297
-            using SIGTERM. Trying SIGKILL ..."
312
+        ocf_log info "OpenStack Neutron Metadata Agent" \
313
+            "(neutron-metadata-agent) failed to stop after" \
314
+            "${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
298 315
         ocf_run kill -s KILL $pid
299 316
     fi
300 317
 
301
-    ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent) stopped"
318
+    ocf_log info "OpenStack Neutron Metadata Agent (neutron-metadata-agent)" \
319
+        "stopped"
302 320
 
303 321
     rm -f $OCF_RESKEY_pid
304 322
 

+ 33
- 19
ocf/neutron-server View File

@@ -3,11 +3,13 @@
3 3
 #
4 4
 # OpenStack Neutron Server (neutron-server)
5 5
 #
6
-# Description:  Manages an OpenStack Neutron Server (neutron-server) process as an HA resource
6
+# Description:  Manages an OpenStack Neutron Server (neutron-server) process as
7
+#               an HA resource
7 8
 #
8 9
 # Authors:      Emilien Macchi
9
-# Mainly inspired by the Neutron API resource agent written by Sebastien Han : http://goo.gl/s8hOU
10
-# Which is also inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Neutron API resource agent written by Sebastien Han:
11
+# http://goo.gl/s8hOU Which is also inspired by the Glance API resource agent
12
+# written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
11 13
 #
12 14
 # Support:      openstack@lists.launchpad.net
13 15
 # License:      Apache Software License (ASL) 2.0
@@ -39,7 +41,8 @@
39 41
 
40 42
 OCF_RESKEY_binary_default="neutron-server"
41 43
 OCF_RESKEY_config_default="/etc/neutron/neutron.conf"
42
-OCF_RESKEY_plugin_config_default="/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
44
+OCF_RESKEY_plugin_config_default=\
45
+"/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
43 46
 OCF_RESKEY_user_default="neutron"
44 47
 OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
45 48
 OCF_RESKEY_url_default="http://127.0.0.1:9696"
@@ -240,7 +243,8 @@ neutron_server_status() {
240 243
     if [ $rc -eq 0 ]; then
241 244
         return $OCF_SUCCESS
242 245
     else
243
-        ocf_log info "Old PID file found, but OpenStack Neutron Server (neutron-server) is not running"
246
+        ocf_log info "Old PID file found, but OpenStack Neutron Server" \
247
+            "(neutron-server) is not running"
244 248
         return $OCF_NOT_RUNNING
245 249
     fi
246 250
 }
@@ -259,10 +263,12 @@ neutron_server_monitor() {
259 263
     # Check the response code of the "List API versions" call.
260 264
     # If it's 200, we consider neutron-server is properly running.
261 265
     if [ -n "$OCF_RESKEY_url" ]; then
262
-        http_code=`curl --silent --write-out %{http_code} --output /dev/null -X GET $OCF_RESKEY_url`
266
+        http_code=`curl --silent --write-out %{http_code} --output /dev/null \
267
+            -X GET $OCF_RESKEY_url`
263 268
         rc=$?
264 269
         if [ $rc -ne 0 ] || [ $http_code -ne 200 ]; then
265
-            ocf_log err "Failed to connect to the OpenStack Neutron API (neutron-server): $rc and $http_code"
270
+            ocf_log err "Failed to connect to the OpenStack Neutron API" \
271
+                "(neutron-server): $rc and $http_code"
266 272
             return $OCF_NOT_RUNNING
267 273
         fi
268 274
     fi
@@ -277,16 +283,21 @@ neutron_server_start() {
277 283
     neutron_server_status
278 284
     rc=$?
279 285
     if [ $rc -eq $OCF_SUCCESS ]; then
280
-        ocf_log info "OpenStack Neutron Server (neutron-server) already running"
286
+        ocf_log info "OpenStack Neutron Server (neutron-server) already" \
287
+            "running"
281 288
         return $OCF_SUCCESS
282 289
     fi
283 290
 
284
-    # run the actual neutron-server daemon with correct configurations files (server + plugin)
285
-    # Don't use ocf_run as we're sending the tool's output
286
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
287
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
288
-        --config-file=$OCF_RESKEY_plugin_config --log-file=/var/log/neutron/server.log $OCF_RESKEY_additional_parameters"' >> \
289
-        /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
291
+    # run the actual neutron-server daemon with correct configurations files
292
+    # (server + plugin)
293
+    # Don't use ocf_run as we're sending the tool's output # straight to
294
+    # /dev/null anyway and using ocf_run would break stdout-redirection here.
295
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
296
+        --config-file=$OCF_RESKEY_config \
297
+        --config-file=$OCF_RESKEY_plugin_config \
298
+        --log-file=/var/log/neutron/server.log \
299
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
300
+        > $OCF_RESKEY_pid
290 301
 
291 302
     # Spin waiting for the server to come up.
292 303
     # Let the CRM/LRM time us out if required
@@ -312,7 +323,8 @@ neutron_server_stop() {
312 323
     neutron_server_status
313 324
     rc=$?
314 325
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
315
-        ocf_log info "OpenStack Neutron Server (neutron-server) already stopped"
326
+        ocf_log info "OpenStack Neutron Server (neutron-server) already" \
327
+            "stopped"
316 328
         return $OCF_SUCCESS
317 329
     fi
318 330
 
@@ -321,7 +333,8 @@ neutron_server_stop() {
321 333
     ocf_run kill -s TERM $pid
322 334
     rc=$?
323 335
     if [ $rc -ne 0 ]; then
324
-        ocf_log err "OpenStack Neutron Server (neutron-server) couldn't be stopped"
336
+        ocf_log err "OpenStack Neutron Server (neutron-server) couldn't be" \
337
+            "stopped"
325 338
         exit $OCF_ERR_GENERIC
326 339
     fi
327 340
 
@@ -339,15 +352,16 @@ neutron_server_stop() {
339 352
         fi
340 353
         count=`expr $count + 1`
341 354
         sleep 1
342
-        ocf_log debug "OpenStack Neutron Server (neutron-server) still hasn't stopped yet. Waiting ..."
355
+        ocf_log debug "OpenStack Neutron Server (neutron-server) still" \
356
+            "hasn't stopped yet. Waiting ..."
343 357
     done
344 358
 
345 359
     neutron_server_status
346 360
     rc=$?
347 361
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
348 362
         # SIGTERM didn't help either, try SIGKILL
349
-        ocf_log info "OpenStack Neutron Server (neutron-server) failed to stop after ${shutdown_timeout}s \
350
-            using SIGTERM. Trying SIGKILL ..."
363
+        ocf_log info "OpenStack Neutron Server (neutron-server) failed to" \
364
+            "stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
351 365
         ocf_run kill -s KILL $pid
352 366
     fi
353 367
 

+ 33
- 20
ocf/nova-api View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack NovaAPI (nova-api)
5 5
 #
6
-# Description:  Manages an OpenStack Nova API (nova-api) process as an HA resource
6
+# Description:  Manages an OpenStack Nova API (nova-api) process as an HA
7
+#               resource
7 8
 #
8 9
 # Authors:      Sébastien Han
9
-# Mainly inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Glance API resource agent written by Martin Gerhard
11
+# Loschwitz from Hastexo: http://goo.gl/whLpr
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -39,14 +41,14 @@ OCF_RESKEY_config_default="/etc/nova/nova.conf"
39 41
 OCF_RESKEY_user_default="nova"
40 42
 OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
41 43
 OCF_RESKEY_url_default="http://127.0.0.1:8774/v2/"
42
-OCF_RESKEY_keystone_get_token_url_default="http://127.0.0.1:5000/v2.0/tokens"
44
+OCF_RESKEY_keystone_get_token_url_def="http://127.0.0.1:5000/v2.0/tokens"
43 45
 
44 46
 : ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
45 47
 : ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
46 48
 : ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
47 49
 : ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
48 50
 : ${OCF_RESKEY_url=${OCF_RESKEY_url_default}}
49
-: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_default}}
51
+: ${OCF_RESKEY_keystone_get_token_url=${OCF_RESKEY_keystone_get_token_url_def}}
50 52
 
51 53
 #######################################################################
52 54
 
@@ -127,7 +129,7 @@ The default URL to use to acquire a Nova API (nova-api) token for monitoring thi
127 129
 of OpenStack Nova API (nova-api)
128 130
 </longdesc>
129 131
 <shortdesc lang="en">OpenStack Nova API (nova-api) url</shortdesc>
130
-<content type="string" default="${OCF_RESKEY_keystone_get_token_url_default}" />
132
+<content type="string" default="${OCF_RESKEY_keystone_get_token_url_def}" />
131 133
 </parameter>
132 134
 
133 135
 <parameter name="os_username" unique="0" required="0">
@@ -225,7 +227,8 @@ nova_api_status() {
225 227
     if [ $rc -eq 0 ]; then
226 228
         return $OCF_SUCCESS
227 229
     else
228
-        ocf_log info "Old PID file found, but OpenStack Nova API (nova-api) is not running"
230
+        ocf_log info "Old PID file found, but OpenStack Nova API (nova-api)" \
231
+            "is not running"
229 232
         return $OCF_NOT_RUNNING
230 233
     fi
231 234
 }
@@ -245,15 +248,21 @@ nova_api_monitor() {
245 248
 
246 249
     # Check detailed information about this specific version of the API.
247 250
     if [ -n "$OCF_RESKEY_os_username" ] && [ -n "$OCF_RESKEY_os_password" ] \
248
-    && [ -n "$OCF_RESKEY_os_tenant_name" ] && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
249
-        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": {\"username\": \"$OCF_RESKEY_os_username\", \
250
-            \"password\": \"$OCF_RESKEY_os_password\"}, \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
251
-            -H "Content-type: application/json" $OCF_RESKEY_keystone_get_token_url | tr ',' '\n' | grep '"id":' \
252
-            | cut -d'"' -f4 | head --lines 1`
253
-        http_code=`curl --write-out %{http_code} --output /dev/null -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
251
+        && [ -n "$OCF_RESKEY_os_tenant_name" ] \
252
+        && [ -n "$OCF_RESKEY_keystone_get_token_url" ]; then
253
+        token=`curl -s -d  "{\"auth\":{\"passwordCredentials\": \
254
+            {\"username\": \"$OCF_RESKEY_os_username\", \
255
+            \"password\": \"$OCF_RESKEY_os_password\"}, \
256
+            \"tenantName\": \"$OCF_RESKEY_os_tenant_name\"}}" \
257
+            -H "Content-type: application/json" \
258
+            $OCF_RESKEY_keystone_get_token_url | \
259
+            tr ',' '\n' | grep '"id":' \ | cut -d'"' -f4 | head --lines 1`
260
+        http_code=`curl --write-out %{http_code} --output /dev/null \
261
+            -sH "X-Auth-Token: $token" $OCF_RESKEY_url`
254 262
         rc=$?
255 263
         if [ $rc -ne 0 ] || [ $http_code -ne 200 ]; then
256
-            ocf_log err "Failed to connect to the OpenStack Nova API (nova-api): $rc and $http_code"
264
+            ocf_log err "Failed to connect to the OpenStack Nova API" \
265
+                "(nova-api): $rc and $http_code"
257 266
             return $OCF_NOT_RUNNING
258 267
         fi
259 268
     fi
@@ -272,10 +281,13 @@ nova_api_start() {
272 281
         return $OCF_SUCCESS
273 282
     fi
274 283
 
275
-    # run the actual nova-api daemon. Don't use ocf_run as we're sending the tool's output
276
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
277
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
278
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
284
+    # run the actual nova-api daemon. Don't use ocf_run as we're sending the
285
+    # tool's output straight to /dev/null anyway and using ocf_run would break
286
+    # stdout-redirection here.
287
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
288
+        --config-file=$OCF_RESKEY_config \
289
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
290
+        > $OCF_RESKEY_pid
279 291
 
280 292
     # Spin waiting for the server to come up.
281 293
     # Let the CRM/LRM time us out if required
@@ -328,15 +340,16 @@ nova_api_stop() {
328 340
         fi
329 341
         count=`expr $count + 1`
330 342
         sleep 1
331
-        ocf_log debug "OpenStack Nova API (nova-api) still hasn't stopped yet. Waiting ..."
343
+        ocf_log debug "OpenStack Nova API (nova-api) still hasn't stopped" \
344
+            "yet. Waiting ..."
332 345
     done
333 346
 
334 347
     nova_api_status
335 348
     rc=$?
336 349
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
337 350
         # SIGTERM didn't help either, try SIGKILL
338
-        ocf_log info "OpenStack Nova API (nova-api) failed to stop after ${shutdown_timeout}s \
339
-            using SIGTERM. Trying SIGKILL ..."
351
+        ocf_log info "OpenStack Nova API (nova-api) failed to stop after" \
352
+            "${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
340 353
         ocf_run kill -s KILL $pid
341 354
     fi
342 355
 

+ 33
- 16
ocf/nova-cert View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack Nova Cert (nova-cert)
5 5
 #
6
-# Description:  Manages an OpenStack Nova Cert (nova-cert) process as an HA resource
6
+# Description:  Manages an OpenStack Nova Cert (nova-cert) process as an HA
7
+#               resource
7 8
 #
8 9
 # Authors:      Sébastien Han
9
-# Mainly inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Glance API resource agent written by Martin Gerhard
11
+# Loschwitz from Hastexo: http://goo.gl/whLpr
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -227,7 +229,8 @@ nova_cert_status() {
227 229
     if [ $rc -eq 0 ]; then
228 230
         return $OCF_SUCCESS
229 231
     else
230
-        ocf_log info "Old PID file found, but OpenStack Nova Cert (nova-cert) is not running"
232
+        ocf_log info "Old PID file found, but OpenStack Nova Cert" \
233
+            "(nova-cert)is not running"
231 234
         return $OCF_NOT_RUNNING
232 235
     fi
233 236
 }
@@ -249,24 +252,34 @@ nova_cert_monitor() {
249 252
     fi
250 253
 
251 254
     # Check the connections according to the PID.
252
-    # We are sure to hit the cert process and not other nova process with the same connection behavior (for example nova-scheduler)
255
+    # We are sure to hit the cert process and not other nova process with the
256
+    # same connection behavior (for example nova-scheduler)
253 257
     if ocf_is_true "$OCF_RESKEY_zeromq"; then
254 258
         pid=`cat $OCF_RESKEY_pid`
255
-        cert_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
259
+        cert_db_check=`netstat -punt | \
260
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
261
+            grep -qs "ESTABLISHED"`
256 262
         rc_db=$?
257 263
         if [ $rc_db -ne 0 ]; then
258
-            ocf_log err "Nova Cert is not connected to the database server: $rc_db"
264
+            ocf_log err "Nova Cert is not connected to the database server:" \
265
+                "$rc_db"
259 266
             return $OCF_NOT_RUNNING
260 267
         fi
261 268
     else
262 269
         pid=`cat $OCF_RESKEY_pid`
263 270
         # check the connections according to the PID
264
-        cert_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -sq "ESTABLISHED"`
271
+        cert_db_check=`netstat -punt | \
272
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
273
+            grep -sq "ESTABLISHED"`
265 274
         rc_db=$?
266
-        cert_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -sq "ESTABLISHED"`
275
+        cert_amqp_check=`netstat -punt | \
276
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
277
+            grep -sq "ESTABLISHED"`
267 278
         rc_amqp=$?
268 279
         if [ $rc_amqp -ne 0 ] || [ $rc_db -ne 0 ]; then
269
-            ocf_log err "Nova Cert is not connected to the AMQP server and/or the database server: AMQP connection test returned $rc_amqp and database connection test returned $rc_db"
280
+            ocf_log err "Nova Cert is not connected to the AMQP server" \
281
+                "and/or the database server: AMQP connection test returned" \
282
+                "$rc_amqp and database connection test returned $rc_db"
270 283
             return $OCF_NOT_RUNNING
271 284
         fi
272 285
     fi
@@ -285,10 +298,13 @@ nova_cert_start() {
285 298
         return $OCF_SUCCESS
286 299
     fi
287 300
 
288
-    # run the actual nova-cert daemon. Don't use ocf_run as we're sending the tool's output
289
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
290
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
291
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
301
+    # run the actual nova-cert daemon. Don't use ocf_run as we're sending the
302
+    # tool's output straight to /dev/null anyway and using ocf_run would break
303
+    # stdout-redirection here.
304
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
305
+        --config-file=$OCF_RESKEY_config \
306
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
307
+        > $OCF_RESKEY_pid
292 308
 
293 309
     # Spin waiting for the server to come up.
294 310
     # Let the CRM/LRM time us out if required
@@ -341,15 +357,16 @@ nova_cert_stop() {
341 357
         fi
342 358
         count=`expr $count + 1`
343 359
         sleep 1
344
-        ocf_log debug "OpenStack Nova Cert (nova-cert) still hasn't stopped yet. Waiting ..."
360
+        ocf_log debug "OpenStack Nova Cert (nova-cert) still hasn't stopped" \
361
+            "yet. Waiting ..."
345 362
     done
346 363
 
347 364
     nova_cert_status
348 365
     rc=$?
349 366
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
350 367
         # SIGTERM didn't help either, try SIGKILL
351
-        ocf_log info "OpenStack Nova Cert (nova-cert) failed to stop after ${shutdown_timeout}s \
352
-            using SIGTERM. Trying SIGKILL ..."
368
+        ocf_log info "OpenStack Nova Cert (nova-cert) failed to stop after" \
369
+            "${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
353 370
         ocf_run kill -s KILL $pid
354 371
     fi
355 372
 

+ 47
- 22
ocf/nova-consoleauth View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack Nova ConsoleAuth (nova-consoleauth)
5 5
 #
6
-# Description:  Manages an OpenStack Nova ConsoleAuth (nova-consoleauth) process as an HA resource
6
+# Description:  Manages an OpenStack Nova ConsoleAuth (nova-consoleauth)
7
+#               process as an HA resource
7 8
 #
8 9
 # Authors:      Sébastien Han
9
-# Mainly inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Glance API resource agent written by Martin Gerhard
11
+# Loschwitz from Hastexo: http://goo.gl/whLpr
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -216,7 +218,8 @@ nova_consoleauth_status() {
216 218
     local rc
217 219
 
218 220
     if [ ! -f $OCF_RESKEY_pid ]; then
219
-        ocf_log info "OpenStack Nova Console Auth (nova-consoleauth) is not running"
221
+        ocf_log info "OpenStack Nova Console Auth (nova-consoleauth) is not" \
222
+            "running"
220 223
         return $OCF_NOT_RUNNING
221 224
     else
222 225
         pid=`cat $OCF_RESKEY_pid`
@@ -227,7 +230,8 @@ nova_consoleauth_status() {
227 230
     if [ $rc -eq 0 ]; then
228 231
         return $OCF_SUCCESS
229 232
     else
230
-        ocf_log info "Old PID file found, but OpenStack Nova Console Auth (nova-consoleauth) is not running"
233
+        ocf_log info "Old PID file found, but OpenStack Nova Console Auth" \
234
+            "(nova-consoleauth) is not running"
231 235
         return $OCF_NOT_RUNNING
232 236
     fi
233 237
 }
@@ -249,29 +253,41 @@ nova_consoleauth_monitor() {
249 253
     fi
250 254
 
251 255
     # Check the connections according to the PID.
252
-    # We are sure to hit the scheduler process and not other nova process with the same connection behavior (for example nova-scheduler)
256
+    # We are sure to hit the scheduler process and not other nova process with
257
+    # the same connection behavior (for example nova-scheduler)
253 258
     if ocf_is_true "$OCF_RESKEY_zeromq"; then
254 259
         pid=`cat $OCF_RESKEY_pid`
255
-        console_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
260
+        console_db_check=`netstat -punt | \
261
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
262
+            grep -qs "ESTABLISHED"`
256 263
         rc_db=$?
257 264
         if [ $rc_db -ne 0 ]; then
258
-            ocf_log err "Nova Console Auth is not connected to the database server: $rc_db"
265
+            ocf_log err "Nova Console Auth is not connected to the database" \
266
+                "server: $rc_db"
259 267
             return $OCF_NOT_RUNNING
260 268
         fi
261 269
     else
262 270
         pid=`cat $OCF_RESKEY_pid`
263 271
         # check the connections according to the PID
264
-        console_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
272
+        console_db_check=`netstat -punt | \
273
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
274
+            grep -qs "ESTABLISHED"`
265 275
         rc_db=$?
266
-        console_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | egrep -s "$pid" | grep -qs "ESTABLISHED"`
276
+        console_amqp_check=`netstat -punt | \
277
+            grep -s "$OCF_RESKEY_amqp_server_port" | egrep -s "$pid" | \
278
+            grep -qs "ESTABLISHED"`
267 279
         rc_amqp=$?
268 280
         if [ $rc_amqp -ne 0 ] || [ $rc_db -ne 0 ]; then
269
-            ocf_log err "Nova Console Auth is not connected to the AMQP server and/or the database server: AMQP connection test returned $rc_amqp and database connection test returned $rc_db"
281
+            ocf_log err "Nova Console Auth is not connected to the AMQP" \
282
+                "server and/or the database server: AMQP connection test" \
283
+                "returned $rc_amqp and database connection test returned" \
284
+                "$rc_db"
270 285
             return $OCF_NOT_RUNNING
271 286
         fi
272 287
     fi
273 288
 
274
-    ocf_log debug "OpenStack Nova Console Auth (nova-consoleauth) monitor succeeded"
289
+    ocf_log debug "OpenStack Nova Console Auth (nova-consoleauth) monitor" \
290
+        "succeeded"
275 291
     return $OCF_SUCCESS
276 292
 }
277 293
 
@@ -281,14 +297,18 @@ nova_consoleauth_start() {
281 297
     nova_consoleauth_status
282 298
     rc=$?
283 299
     if [ $rc -eq $OCF_SUCCESS ]; then
284
-        ocf_log info "OpenStack Nova ConsoleAuth (nova-consoleauth) already running"
300
+        ocf_log info "OpenStack Nova ConsoleAuth (nova-consoleauth) already" \
301
+            "running"
285 302
         return $OCF_SUCCESS
286 303
     fi
287 304
 
288
-    # run the actual nova-consoleauth daemon. Don't use ocf_run as we're sending the tool's output
289
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
290
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
291
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
305
+    # run the actual nova-consoleauth daemon. Don't use ocf_run as we're
306
+    # sending the tool's output straight to /dev/null anyway and using ocf_run
307
+    # would break stdout-redirection here.
308
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
309
+        --config-file=$OCF_RESKEY_config \
310
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
311
+        > $OCF_RESKEY_pid
292 312
 
293 313
     # Spin waiting for the server to come up.
294 314
     # Let the CRM/LRM time us out if required
@@ -297,7 +317,8 @@ nova_consoleauth_start() {
297 317
     rc=$?
298 318
     [ $rc -eq $OCF_SUCCESS ] && break
299 319
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
300
-        ocf_log err "OpenStack Nova ConsoleAuth (nova-consoleauth) start failed"
320
+        ocf_log err "OpenStack Nova ConsoleAuth (nova-consoleauth)" \
321
+            "start failed"
301 322
         exit $OCF_ERR_GENERIC
302 323
     fi
303 324
     sleep 1
@@ -314,7 +335,8 @@ nova_consoleauth_stop() {
314 335
     nova_consoleauth_status
315 336
     rc=$?
316 337
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
317
-        ocf_log info "OpenStack Nova ConsoleAuth (nova-consoleauth) already stopped"
338
+        ocf_log info "OpenStack Nova ConsoleAuth (nova-consoleauth) already" \
339
+            "stopped"
318 340
         return $OCF_SUCCESS
319 341
     fi
320 342
 
@@ -323,7 +345,8 @@ nova_consoleauth_stop() {
323 345
     ocf_run kill -s TERM $pid
324 346
     rc=$?
325 347
     if [ $rc -ne 0 ]; then
326
-        ocf_log err "OpenStack Nova ConsoleAuth (nova-consoleauth) couldn't be stopped"
348
+        ocf_log err "OpenStack Nova ConsoleAuth (nova-consoleauth) couldn't" \
349
+            "be stopped"
327 350
         exit $OCF_ERR_GENERIC
328 351
     fi
329 352
 
@@ -341,15 +364,17 @@ nova_consoleauth_stop() {
341 364
         fi
342 365
         count=`expr $count + 1`
343 366
         sleep 1
344
-        ocf_log debug "OpenStack Nova ConsoleAuth (nova-consoleauth) still hasn't stopped yet. Waiting ..."
367
+        ocf_log debug "OpenStack Nova ConsoleAuth (nova-consoleauth) still" \
368
+            "hasn't stopped yet. Waiting ..."
345 369
     done
346 370
 
347 371
     nova_consoleauth_status
348 372
     rc=$?
349 373
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
350 374
         # SIGTERM didn't help either, try SIGKILL
351
-        ocf_log info "OpenStack Nova ConsoleAuth (nova-consoleauth) failed to stop after ${shutdown_timeout}s \
352
-            using SIGTERM. Trying SIGKILL ..."
375
+        ocf_log info "OpenStack Nova ConsoleAuth (nova-consoleauth) failed" \
376
+            "to stop after ${shutdown_timeout}s using SIGTERM. Trying" \
377
+            "SIGKILL ..."
353 378
         ocf_run kill -s KILL $pid
354 379
     fi
355 380
 

+ 34
- 17
ocf/nova-network View File

@@ -3,11 +3,13 @@
3 3
 #
4 4
 # OpenStack Network Service (nova-network) (replaced by Neutron in Havana)
5 5
 #
6
-# Description:  Manages an OpenStack Network Service (nova-network) process as an HA resource
6
+# Description:  Manages an OpenStack Network Service (nova-network) process as
7
+#               an HA resource
7 8
 #
8 9
 # Authors: Sebastien Han & Emilien Macchi
9
-# Mainly inspired by the Nova Scheduler resource agent written by Sebastien Han : http://goo.gl/s8hOU
10
-# Which are also inspired by the resource agents written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Nova Scheduler resource agent written by Sebastien
11
+# Han: http://goo.gl/s8hOU Which are also inspired by the resource agents
12
+# written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
11 13
 #
12 14
 # Support:      openstack@lists.launchpad.net
13 15
 # License:      Apache Software License (ASL) 2.0
@@ -206,7 +208,8 @@ nova_network_status() {
206 208
     if [ $rc -eq 0 ]; then
207 209
         return $OCF_SUCCESS
208 210
     else
209
-        ocf_log info "Old PID file found, but OpenStack Nova Network (nova-network) is not running"
211
+        ocf_log info "Old PID file found, but OpenStack Nova Network" \
212
+            "(nova-network) is not running"
210 213
         return $OCF_NOT_RUNNING
211 214
     fi
212 215
 }
@@ -228,24 +231,34 @@ nova_network_monitor() {
228 231
     fi
229 232
 
230 233
     # Check the connections according to the PID.
231
-    # We are sure to hit the scheduler process and not other nova process with the same connection behavior (for example nova-cert)
234
+    # We are sure to hit the scheduler process and not other nova process with
235
+    # the same connection behavior (for example nova-cert)
232 236
     if ocf_is_true "$OCF_RESKEY_zeromq"; then
233 237
         pid=`cat $OCF_RESKEY_pid`
234
-        network_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
238
+        network_db_check=`netstat -punt | \
239
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
240
+            grep -qs "ESTABLISHED"`
235 241
         rc_db=$?
236 242
         if [ $rc_db -ne 0 ]; then
237
-            ocf_log err "Nova Network is not connected to the database server: $rc_db"
243
+            ocf_log err "Nova Network is not connected to the database" \
244
+                "server: $rc_db"
238 245
             return $OCF_NOT_RUNNING
239 246
         fi
240 247
     else
241 248
         pid=`cat $OCF_RESKEY_pid`
242 249
         # check the connections according to the PID
243
-        network_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
250
+        network_db_check=`netstat -punt | \
251
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
252
+            grep -qs "ESTABLISHED"`
244 253
         rc_db=$?
245
-        network_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
254
+        network_amqp_check=`netstat -punt | \
255
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
256
+            grep -qs "ESTABLISHED"`
246 257
         rc_amqp=$?
247 258
         if [ $rc_amqp -ne 0 ] || [ $rc_db -ne 0 ]; then
248
-            ocf_log err "Nova Network is not connected to the AMQP server and/or the database server: AMQP connection test returned $rc_amqp and database connection test returned $rc_db"
259
+            ocf_log err "Nova Network is not connected to the AMQP server" \
260
+                "and/or the database server: AMQP connection test returned" \
261
+                "$rc_amqp and database connection test returned $rc_db"
249 262
             return $OCF_NOT_RUNNING
250 263
         fi
251 264
     fi
@@ -264,10 +277,13 @@ nova_network_start() {
264 277
         return $OCF_SUCCESS
265 278
     fi
266 279
 
267
-    # run the actual nova-network daemon. Don't use ocf_run as we're sending the tool's output
268
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
269
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
270
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
280
+    # run the actual nova-network daemon. Don't use ocf_run as we're sending
281
+    # the tool's output straight to /dev/null anyway and using ocf_run would
282
+    # break stdout-redirection here.
283
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
284
+        --config-file=$OCF_RESKEY_config \
285
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
286
+        > $OCF_RESKEY_pid
271 287
 
272 288
     # Spin waiting for the server to come up.
273 289
     # Let the CRM/LRM time us out if required
@@ -321,15 +337,16 @@ nova_network_stop() {
321 337
         fi
322 338
         count=`expr $count + 1`
323 339
         sleep 1
324
-        ocf_log debug "OpenStack Nova Network (nova-network) still hasn't stopped yet. Waiting ..."
340
+        ocf_log debug "OpenStack Nova Network (nova-network) still hasn't" \
341
+            "stopped yet. Waiting ..."
325 342
     done
326 343
 
327 344
     nova_network_status
328 345
     rc=$?
329 346
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
330 347
         # SIGTERM didn't help either, try SIGKILL
331
-        ocf_log info "OpenStack Nova Network (nova-network) failed to stop after ${shutdown_timeout}s \
332
-            using SIGTERM. Trying SIGKILL ..."
348
+        ocf_log info "OpenStack Nova Network (nova-network) failed to stop" \
349
+            "after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
333 350
         ocf_run kill -s KILL $pid
334 351
     fi
335 352
 

+ 31
- 17
ocf/nova-novnc View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack Nova VNC Console (nova-novncproxy)
5 5
 #
6
-# Description:  Manages an OpenStack Nova VNC Console (nova-novncproxy) process as an HA resource
6
+# Description:  Manages an OpenStack Nova VNC Console (nova-novncproxy) process
7
+#               as an HA resource
7 8
 #
8 9
 # Authors:      Sébastien Han
9
-# Mainly inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Glance API resource agent written by Martin Gerhard
11
+# Loschwitz from Hastexo: http://goo.gl/whLpr
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -183,7 +185,8 @@ nova_vnc_console_status() {
183 185
     local rc
184 186
 
185 187
     if [ ! -f $OCF_RESKEY_pid ]; then
186
-        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) is not running"
188
+        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) is not" \
189
+            "running"
187 190
         return $OCF_NOT_RUNNING
188 191
     else
189 192
         pid=`cat $OCF_RESKEY_pid`
@@ -194,7 +197,8 @@ nova_vnc_console_status() {
194 197
     if [ $rc -eq 0 ]; then
195 198
         return $OCF_SUCCESS
196 199
     else
197
-        ocf_log info "Old PID file found, but OpenStack Nova VNC Console (nova-novncproxy) is not running"
200
+        ocf_log info "Old PID file found, but OpenStack Nova VNC Console" \
201
+            "(nova-novncproxy) is not running"
198 202
         return $OCF_NOT_RUNNING
199 203
     fi
200 204
 }
@@ -213,14 +217,17 @@ nova_vnc_console_monitor() {
213 217
 
214 218
     # Check whether we are supposed to monitor by logging into nova-novncproxy
215 219
     # and do it if that's the case.
216
-    vnc_list_check=`netstat -a | grep -s "$OCF_RESKEY_console_port" | grep -qs "LISTEN"`
220
+    vnc_list_check=`netstat -a | grep -s "$OCF_RESKEY_console_port" | \
221
+        grep -qs "LISTEN"`
217 222
     rc=$?
218 223
     if [ $rc -ne 0 ]; then
219
-        ocf_log err "Nova VNC Console doesn't seem to listen on his default port: $rc"
224
+        ocf_log err "Nova VNC Console doesn't seem to listen on his default" \
225
+            "port: $rc"
220 226
         return $OCF_NOT_RUNNING
221 227
     fi
222 228
 
223
-    ocf_log debug "OpenStack Nova VNC Console (nova-novncproxy) monitor succeeded"
229
+    ocf_log debug "OpenStack Nova VNC Console (nova-novncproxy) monitor" \
230
+        "succeeded"
224 231
     return $OCF_SUCCESS
225 232
 }
226 233
 
@@ -230,14 +237,18 @@ nova_vnc_console_start() {
230 237
     nova_vnc_console_status
231 238
     rc=$?
232 239
     if [ $rc -eq $OCF_SUCCESS ]; then
233
-        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) already running"
240
+        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) already" \
241
+            "running"
234 242
         return $OCF_SUCCESS
235 243
     fi
236 244
 
237
-    # run the actual nova-novncproxy daemon. Don't use ocf_run as we're sending the tool's output
238
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
239
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config --web /usr/share/novnc/ \
240
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
245
+    # run the actual nova-novncproxy daemon. Don't use ocf_run as we're sending
246
+    # the tool's output straight to /dev/null anyway and using ocf_run would
247
+    # break stdout-redirection here.
248
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
249
+        --config-file=$OCF_RESKEY_config --web /usr/share/novnc/ \
250
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
251
+        > $OCF_RESKEY_pid
241 252
 
242 253
     # Spin waiting for the server to come up.
243 254
     # Let the CRM/LRM time us out if required
@@ -263,7 +274,8 @@ nova_vnc_console_stop() {
263 274
     nova_vnc_console_status
264 275
     rc=$?
265 276
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
266
-        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) already stopped"
277
+        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) already" \
278
+            "stopped"
267 279
         return $OCF_SUCCESS
268 280
     fi
269 281
 
@@ -272,7 +284,8 @@ nova_vnc_console_stop() {
272 284
     ocf_run kill -s TERM $pid
273 285
     rc=$?
274 286
     if [ $rc -ne 0 ]; then
275
-        ocf_log err "OpenStack Nova VNC Console (nova-novncproxy) couldn't be stopped"
287
+        ocf_log err "OpenStack Nova VNC Console (nova-novncproxy) couldn't" \
288
+            "be stopped"
276 289
         exit $OCF_ERR_GENERIC
277 290
     fi
278 291
 
@@ -290,15 +303,16 @@ nova_vnc_console_stop() {
290 303
         fi
291 304
         count=`expr $count + 1`
292 305
         sleep 1
293
-        ocf_log debug "OpenStack Nova VNC Console (nova-novncproxy) still hasn't stopped yet. Waiting ..."
306
+        ocf_log debug "OpenStack Nova VNC Console (nova-novncproxy) still" \
307
+            "hasn't stopped yet. Waiting ..."
294 308
     done
295 309
 
296 310
     nova_vnc_console_status
297 311
     rc=$?
298 312
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
299 313
         # SIGTERM didn't help either, try SIGKILL
300
-        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) failed to stop after ${shutdown_timeout}s \
301
-            using SIGTERM. Trying SIGKILL ..."
314
+        ocf_log info "OpenStack Nova VNC Console (nova-novncproxy) failed to" \
315
+            "stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
302 316
         ocf_run kill -s KILL $pid
303 317
     fi
304 318
 

+ 39
- 19
ocf/nova-scheduler View File

@@ -3,10 +3,12 @@
3 3
 #
4 4
 # OpenStack Scheduler Service (nova-scheduler)
5 5
 #
6
-# Description:  Manages an OpenStack Scheduler Service (nova-scheduler) process as an HA resource
6
+# Description:  Manages an OpenStack Scheduler Service (nova-scheduler) process
7
+#               as an HA resource
7 8
 #
8 9
 # Authors:      Sébastien Han
9
-# Mainly inspired by the Glance API resource agent written by Martin Gerhard Loschwitz from Hastexo: http://goo.gl/whLpr
10
+# Mainly inspired by the Glance API resource agent written by Martin Gerhard
11
+# Loschwitz from Hastexo: http://goo.gl/whLpr
10 12
 #
11 13
 # Support:      openstack@lists.launchpad.net
12 14
 # License:      Apache Software License (ASL) 2.0
@@ -227,7 +229,8 @@ nova_scheduler_status() {
227 229
     if [ $rc -eq 0 ]; then
228 230
         return $OCF_SUCCESS
229 231
     else
230
-        ocf_log info "Old PID file found, but OpenStack Nova Scheduler (nova-scheduler) is not running"
232
+        ocf_log info "Old PID file found, but OpenStack Nova Scheduler" \
233
+            "(nova-scheduler) is not running"
231 234
         return $OCF_NOT_RUNNING
232 235
     fi
233 236
 }
@@ -249,23 +252,33 @@ nova_scheduler_monitor() {
249 252
     fi
250 253
 
251 254
     # Check the connections according to the PID.
252
-    # We are sure to hit the scheduler process and not other nova process with the same connection behavior (for example nova-cert)
255
+    # We are sure to hit the scheduler process and not other nova process with
256
+    # the same connection behavior (for example nova-cert)
253 257
     if ocf_is_true "$OCF_RESKEY_zeromq"; then
254 258
         pid=`cat $OCF_RESKEY_pid`
255
-        scheduler_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
259
+        scheduler_db_check=`netstat -punt | \
260
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
261
+            grep -qs "ESTABLISHED"`
256 262
         rc_db=$?
257 263
         if [ $rc_db -ne 0 ]; then
258
-            ocf_log err "Nova Scheduler is not connected to the database server: $rc_db"
264
+            ocf_log err "Nova Scheduler is not connected to the database" \
265
+                "server: $rc_db"
259 266
             return $OCF_NOT_RUNNING
260 267
         fi
261 268
     else
262 269
         pid=`cat $OCF_RESKEY_pid`
263
-        scheduler_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
270
+        scheduler_db_check=`netstat -punt | \
271
+            grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | \
272
+            grep -qs "ESTABLISHED"`
264 273
         rc_db=$?
265
-        scheduler_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
274
+        scheduler_amqp_check=`netstat -punt | \
275
+            grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | \
276
+            grep -qs "ESTABLISHED"`
266 277
         rc_amqp=$?
267 278
         if [ $rc_amqp -ne 0 ] || [ $rc_db -ne 0 ]; then
268
-            ocf_log err "Nova Scheduler is not connected to the AMQP server and/or the database server: AMQP connection test returned $rc_amqp and database connection test returned $rc_db"
279
+            ocf_log err "Nova Scheduler is not connected to the AMQP server" \
280
+                "and/or the database server: AMQP connection test returned" \
281
+                "$rc_amqp and database connection test returned $rc_db"
269 282
             return $OCF_NOT_RUNNING
270 283
         fi
271 284
     fi
@@ -280,14 +293,18 @@ nova_scheduler_start() {
280 293
     nova_scheduler_status
281 294
     rc=$?
282 295
     if [ $rc -eq $OCF_SUCCESS ]; then
283
-        ocf_log info "OpenStack Nova Scheduler (nova-scheduler) already running"
296
+        ocf_log info "OpenStack Nova Scheduler (nova-scheduler) already" \
297
+            "running"
284 298
         return $OCF_SUCCESS
285 299
     fi
286 300
 
287
-    # run the actual nova-scheduler daemon. Don't use ocf_run as we're sending the tool's output
288
-    # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
289
-    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
290
-        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
301
+    # run the actual nova-scheduler daemon. Don't use ocf_run as we're sending
302
+    # the tool's output straight to /dev/null anyway and using ocf_run would
303
+    # break stdout-redirection here.
304
+    su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} \
305
+        --config-file=$OCF_RESKEY_config \
306
+        $OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' \
307
+        > $OCF_RESKEY_pid
291 308
 
292 309
     # Spin waiting for the server to come up.
293 310
     while true; do
@@ -312,7 +329,8 @@ nova_scheduler_stop() {
312 329
     nova_scheduler_status
313 330
     rc=$?
314 331
     if [ $rc -eq $OCF_NOT_RUNNING ]; then
315
-        ocf_log info "OpenStack Nova Scheduler (nova-scheduler) already stopped"
332
+        ocf_log info "OpenStack Nova Scheduler (nova-scheduler) already" \
333
+            "stopped"
316 334
         return $OCF_SUCCESS
317 335
     fi
318 336
 
@@ -321,7 +339,8 @@ nova_scheduler_stop() {
321 339
     ocf_run kill -s TERM $pid
322 340
     rc=$?
323 341
     if [ $rc -ne 0 ]; then
324
-        ocf_log err "OpenStack Nova Scheduler (nova-scheduler) couldn't be stopped"
342
+        ocf_log err "OpenStack Nova Scheduler (nova-scheduler) couldn't be" \
343
+            "stopped"
325 344
         exit $OCF_ERR_GENERIC
326 345
     fi
327 346
 
@@ -339,15 +358,16 @@ nova_scheduler_stop() {
339 358
         fi
340 359
         count=`expr $count + 1`
341 360
         sleep 1
342
-        ocf_log debug "OpenStack Nova Scheduler (nova-scheduler) still hasn't stopped yet. Waiting ..."
361
+        ocf_log debug "OpenStack Nova Scheduler (nova-scheduler) still" \
362
+            "hasn't stopped yet. Waiting ..."
343 363
     done
344 364
 
345 365
     nova_scheduler_status
346 366
     rc=$?
347 367
     if [ $rc -ne $OCF_NOT_RUNNING ]; then
348 368
         # SIGTERM didn't help either, try SIGKILL
349
-        ocf_log info "OpenStack Nova Scheduler (nova-scheduler) failed to stop after ${shutdown_timeout}s \
350
-            using SIGTERM. Trying SIGKILL ..."
369
+        ocf_log info "OpenStack Nova Scheduler (nova-scheduler) failed to" \
370
+            "stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..."
351 371
         ocf_run kill -s KILL $pid
352 372
     fi
353 373
 

Loading…
Cancel
Save