Browse Source

Merge "Fix bashate E002 violations"

Jenkins 3 years ago
parent
commit
076ae60516
12 changed files with 300 additions and 266 deletions
  1. 107
    91
      ocf/NovaCompute
  2. 122
    104
      ocf/NovaEvacuate
  3. 1
    1
      ocf/glance-api
  4. 5
    5
      ocf/neutron-agent-dhcp
  5. 5
    5
      ocf/neutron-agent-l3
  6. 2
    2
      ocf/neutron-metadata-agent
  7. 2
    2
      ocf/neutron-server
  8. 14
    14
      ocf/nova-cert
  9. 14
    14
      ocf/nova-consoleauth
  10. 14
    14
      ocf/nova-network
  11. 1
    1
      ocf/nova-novnc
  12. 13
    13
      ocf/nova-scheduler

+ 107
- 91
ocf/NovaCompute View File

@@ -38,7 +38,7 @@
38 38
 #######################################################################
39 39
 
40 40
 meta_data() {
41
-	cat <<END
41
+    cat <<END
42 42
 <?xml version="1.0"?>
43 43
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
44 44
 <resource-agent name="NovaCompute" version="1.0">
@@ -156,12 +156,12 @@ END
156 156
 # don't exit on TERM, to test that lrmd makes sure that we do exit
157 157
 trap sigterm_handler TERM
158 158
 sigterm_handler() {
159
-	ocf_log info "They use TERM to bring us down. No such luck."
160
-	return
159
+    ocf_log info "They use TERM to bring us down. No such luck."
160
+    return
161 161
 }
162 162
 
163 163
 nova_usage() {
164
-	cat <<END
164
+    cat <<END
165 165
 usage: $0 {start|stop|monitor|validate-all|meta-data}
166 166
 
167 167
 Expects to have a fully populated OCF RA-compliant environment set.
@@ -175,32 +175,32 @@ nova_pid() {
175 175
 nova_start() {
176 176
     nova_monitor
177 177
     if [ $? = $OCF_SUCCESS ]; then
178
-	return $OCF_SUCCESS
178
+        return $OCF_SUCCESS
179 179
     fi
180 180
 
181 181
     state=$(attrd_updater -p -n evacuate -N ${NOVA_HOST} | sed -e 's/.*value=//' | tr -d '"' )
182 182
     if [ "x$state" = x ]; then
183
-	: no fencing to recover
183
+        : no fencing to recover
184 184
 
185 185
     elif [ "x$state" = xno ]; then
186
-	: 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
-	sleep ${OCF_RESKEY_evacuation_delay}
186
+        : 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
+        sleep ${OCF_RESKEY_evacuation_delay}
189 189
 
190
-	fence_compute ${fence_options} -o on -n ${NOVA_HOST}
191
-	attrd_updater -p -n evacuate -N ${NOVA_HOST} -D
190
+        fence_compute ${fence_options} -o on -n ${NOVA_HOST}
191
+        attrd_updater -p -n evacuate -N ${NOVA_HOST} -D
192 192
     else
193
-	ocf_log info "Waiting for pending evacuations from ${NOVA_HOST}"
194
-	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 '"' )
196
-	    sleep 5
197
-	done
193
+        ocf_log info "Waiting for pending evacuations from ${NOVA_HOST}"
194
+        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 '"' )
196
+            sleep 5
197
+        done
198 198
 
199
-	ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to complete"
200
-	sleep ${OCF_RESKEY_evacuation_delay}
199
+        ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to complete"
200
+        sleep ${OCF_RESKEY_evacuation_delay}
201 201
 
202
-	fence_compute ${fence_options} -o on -n ${NOVA_HOST}
203
-	attrd_updater -p -n evacuate -N ${NOVA_HOST} -D
202
+        fence_compute ${fence_options} -o on -n ${NOVA_HOST}
203
+        attrd_updater -p -n evacuate -N ${NOVA_HOST} -D
204 204
     fi
205 205
 
206 206
     export LIBGUESTFS_ATTACH_METHOD=appliance
@@ -209,8 +209,8 @@ nova_start() {
209 209
     rc=$OCF_NOT_RUNNING
210 210
     ocf_log info "Waiting for nova to start"
211 211
     while [ $rc != $OCF_SUCCESS ]; do
212
-	nova_monitor
213
-	rc=$?
212
+        nova_monitor
213
+        rc=$?
214 214
     done
215 215
 
216 216
     return $OCF_SUCCESS
@@ -219,12 +219,12 @@ nova_start() {
219 219
 nova_stop() {
220 220
     pid=$(nova_pid)
221 221
     if [ "x$pid" != x ]; then
222
-	su nova -c "kill -TERM $pid" -s /bin/bash
222
+        su nova -c "kill -TERM $pid" -s /bin/bash
223 223
     fi
224 224
 
225 225
     while [ "x$pid" != x ]; do
226
-	sleep 1
227
-	pid=$(nova_pid)
226
+        sleep 1
227
+        pid=$(nova_pid)
228 228
     done
229 229
 
230 230
     return $OCF_SUCCESS
@@ -233,16 +233,16 @@ nova_stop() {
233 233
 nova_monitor() {
234 234
     pid=$(nova_pid)
235 235
     if [ "x$pid" != x ]; then
236
-	## TEMPORARY disable call to fence_compute to avoid noise on first
237
-	## first startup due to nova-compute not being fast enough to populate
238
-	## the db and fence_compute checking if node exists and it's enabled
239
-	#state=$(fence_compute ${fence_options} -o status -n $NOVA_HOST | grep Status)
240
-	#if [ "x$state" = "xStatus: ON" ]; then
241
-	    return $OCF_SUCCESS
242
-	#else
243
-	#    ocf_exit_reason "Nova status: $state"
244
-	#    return $OCF_ERR_GENERIC
245
-	#fi
236
+        ## TEMPORARY disable call to fence_compute to avoid noise on first
237
+        ## first startup due to nova-compute not being fast enough to populate
238
+        ## the db and fence_compute checking if node exists and it's enabled
239
+        #state=$(fence_compute ${fence_options} -o status -n $NOVA_HOST | grep Status)
240
+        #if [ "x$state" = "xStatus: ON" ]; then
241
+            return $OCF_SUCCESS
242
+        #else
243
+        #    ocf_exit_reason "Nova status: $state"
244
+        #    return $OCF_ERR_GENERIC
245
+        #fi
246 246
     fi
247 247
 
248 248
     return $OCF_NOT_RUNNING
@@ -260,67 +260,68 @@ nova_validate() {
260 260
     check_binary nova-compute
261 261
 
262 262
     if [ ! -f /etc/nova/nova.conf ]; then
263
-	   ocf_exit_reason "/etc/nova/nova.conf not found"
264
-	   exit $OCF_ERR_CONFIGURED
263
+        ocf_exit_reason "/etc/nova/nova.conf not found"
264
+        exit $OCF_ERR_CONFIGURED
265 265
     fi
266 266
 
267 267
     if [ -z "${OCF_RESKEY_auth_url}" ]; then
268
-	   ocf_exit_reason "auth_url not configured"
269
-	   exit $OCF_ERR_CONFIGURED
268
+        ocf_exit_reason "auth_url not configured"
269
+        exit $OCF_ERR_CONFIGURED
270 270
     fi
271 271
 
272 272
     fence_options="${fence_options} -k ${OCF_RESKEY_auth_url}"
273 273
 
274 274
     if [ -z "${OCF_RESKEY_username}" ]; then
275
-	   ocf_exit_reason "username not configured"
276
-	   exit $OCF_ERR_CONFIGURED
275
+        ocf_exit_reason "username not configured"
276
+        exit $OCF_ERR_CONFIGURED
277 277
     fi
278 278
 
279 279
     fence_options="${fence_options} -l ${OCF_RESKEY_username}"
280 280
 
281 281
     if [ -z "${OCF_RESKEY_password}" ]; then
282
-	   ocf_exit_reason "password not configured"
283
-	   exit $OCF_ERR_CONFIGURED
282
+        ocf_exit_reason "password not configured"
283
+        exit $OCF_ERR_CONFIGURED
284 284
     fi
285 285
 
286 286
     fence_options="${fence_options} -p ${OCF_RESKEY_password}"
287 287
 
288 288
     if [ -z "${OCF_RESKEY_tenant_name}" ]; then
289
-	   ocf_exit_reason "tenant_name not configured"
290
-	   exit $OCF_ERR_CONFIGURED
289
+        ocf_exit_reason "tenant_name not configured"
290
+        exit $OCF_ERR_CONFIGURED
291 291
     fi
292 292
 
293 293
     fence_options="${fence_options} -t ${OCF_RESKEY_tenant_name}"
294 294
 
295 295
     if [ -n "${OCF_RESKEY_domain}" ]; then
296
-	fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
296
+        fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
297 297
     fi
298 298
 
299 299
     if [ -n "${OCF_RESKEY_region_name}" ]; then
300
-	fence_options="${fence_options} --region-name ${OCF_RESKEY_region_name}"
300
+        fence_options="${fence_options} --region-name ${OCF_RESKEY_region_name}"
301 301
     fi
302 302
 
303 303
     if [ -n "${OCF_RESKEY_insecure}" ]; then
304
-	if ocf_is_true "${OCF_RESKEY_insecure}"; then
305
-	    fence_options="${fence_options} --insecure"
306
-	fi
304
+        if ocf_is_true "${OCF_RESKEY_insecure}"; then
305
+            fence_options="${fence_options} --insecure"
306
+        fi
307 307
     fi
308 308
 
309 309
     if [ -n "${OCF_RESKEY_no_shared_storage}" ]; then
310
-	if ocf_is_true "${OCF_RESKEY_no_shared_storage}"; then
311
-	    fence_options="${fence_options} --no-shared-storage"
312
-	fi
310
+        if ocf_is_true "${OCF_RESKEY_no_shared_storage}"; then
311
+            fence_options="${fence_options} --no-shared-storage"
312
+        fi
313 313
     fi
314 314
 
315 315
     if [ -n "${OCF_RESKEY_endpoint_type}" ]; then
316
-	case ${OCF_RESKEY_endpoint_type} in
317
-	    adminURL|publicURL|internalURL) ;;
318
-	    *)
319
-		ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
320
-		exit $OCF_ERR_CONFIGURED
321
-	    ;;
322
-	esac
323
-	fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
316
+        case ${OCF_RESKEY_endpoint_type} in
317
+            adminURL|publicURL|internalURL)
318
+                ;;
319
+            *)
320
+                ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
321
+                exit $OCF_ERR_CONFIGURED
322
+                ;;
323
+        esac
324
+        fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
324 325
     fi
325 326
 
326 327
     # we take a chance here and hope that host is either not configured
@@ -328,54 +329,69 @@ nova_validate() {
328 329
 
329 330
     NOVA_HOST=$(crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null)
330 331
     if [ $? = 1 ]; then
331
-	if [ "x${OCF_RESKEY_domain}" != x ]; then
332
-	    NOVA_HOST=$(uname -n | awk -F. '{print $1}')
333
-	else
334
-	    NOVA_HOST=$(uname -n)
335
-	fi
332
+        if [ "x${OCF_RESKEY_domain}" != x ]; then
333
+            NOVA_HOST=$(uname -n | awk -F. '{print $1}')
334
+        else
335
+            NOVA_HOST=$(uname -n)
336
+        fi
336 337
     fi
337 338
 
338 339
     # We only need to check a configured value, calculated ones are fine
339 340
     crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null
340 341
     if [ $? = 0 ]; then
341
-	if [ "x${OCF_RESKEY_domain}" != x ]; then
342
-	    short_host=$(uname -n | awk -F. '{print $1}')
343
-	    if [ "x$NOVA_HOST" != "x${short_host}" ]; then
344
-		ocf_exit_reason "Invalid Nova host name, must be ${short_host} in order for instance recovery to function"
345
-		rc=$OCF_ERR_CONFIGURED
346
-	    fi
347
-
348
-	elif [ "x$NOVA_HOST" != "x$(uname -n)" ]; then
342
+        if [ "x${OCF_RESKEY_domain}" != x ]; then
343
+            short_host=$(uname -n | awk -F. '{print $1}')
344
+            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"
346
+                rc=$OCF_ERR_CONFIGURED
347
+            fi
348
+
349
+        elif [ "x$NOVA_HOST" != "x$(uname -n)" ]; then
349 350
             ocf_exit_reason "Invalid Nova host name, must be $(uname -n) in order for instance recovery to function"
350
-	    rc=$OCF_ERR_CONFIGURED
351
-	fi
351
+            rc=$OCF_ERR_CONFIGURED
352
+        fi
352 353
     fi
353 354
 
354 355
     if [ $rc != $OCF_SUCCESS ]; then
355
-	exit $rc
356
+        exit $rc
356 357
     fi
357 358
     return $rc
358 359
 }
359 360
 
360 361
 : ${OCF_RESKEY_evacuation_delay=120}
361 362
 case $__OCF_ACTION in
362
-meta-data)	meta_data
363
-		exit $OCF_SUCCESS
364
-		;;
365
-usage|help)	nova_usage
366
-		exit $OCF_SUCCESS
367
-		;;
363
+    meta-data)
364
+        meta_data
365
+        exit $OCF_SUCCESS
366
+        ;;
367
+    usage|help)
368
+        nova_usage
369
+        exit $OCF_SUCCESS
370
+        ;;
368 371
 esac
369 372
 
370 373
 case $__OCF_ACTION in
371
-start)		nova_validate; nova_start;;
372
-stop)		nova_stop;;
373
-monitor)	nova_validate; nova_monitor;;
374
-notify)		nova_notify;;
375
-validate-all)	exit $OCF_SUCCESS;;
376
-*)		nova_usage
377
-		exit $OCF_ERR_UNIMPLEMENTED
378
-		;;
374
+    start)
375
+        nova_validate
376
+        nova_start
377
+        ;;
378
+    stop)
379
+        nova_stop
380
+        ;;
381
+    monitor)
382
+        nova_validate
383
+        nova_monitor
384
+        ;;
385
+    notify)
386
+        nova_notify
387
+        ;;
388
+    validate-all)
389
+        exit $OCF_SUCCESS
390
+        ;;
391
+    *)
392
+        nova_usage
393
+        exit $OCF_ERR_UNIMPLEMENTED
394
+        ;;
379 395
 esac
380 396
 rc=$?
381 397
 ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"

+ 122
- 104
ocf/NovaEvacuate View File

@@ -38,7 +38,7 @@
38 38
 #######################################################################
39 39
 
40 40
 meta_data() {
41
-	cat <<END
41
+    cat <<END
42 42
 <?xml version="1.0"?>
43 43
 <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
44 44
 <resource-agent name="NovaEvacuate" version="1.0">
@@ -144,12 +144,12 @@ END
144 144
 # don't exit on TERM, to test that lrmd makes sure that we do exit
145 145
 trap sigterm_handler TERM
146 146
 sigterm_handler() {
147
-	ocf_log info "They use TERM to bring us down. No such luck."
148
-	return
147
+    ocf_log info "They use TERM to bring us down. No such luck."
148
+    return
149 149
 }
150 150
 
151 151
 evacuate_usage() {
152
-	cat <<END
152
+    cat <<END
153 153
 usage: $0 {start|stop|monitor|validate-all|meta-data}
154 154
 
155 155
 Expects to have a fully populated OCF RA-compliant environment set.
@@ -171,71 +171,75 @@ update_evacuation() {
171 171
     attrd_updater -p -n evacuate -Q -N ${1} -U ${2}
172 172
     arc=$?
173 173
     if [ ${arc} != 0 ]; then
174
-	ocf_log warn "Can not set evacuation state of ${1} to ${2}: ${arc}"
174
+        ocf_log warn "Can not set evacuation state of ${1} to ${2}: ${arc}"
175 175
     fi
176 176
     return ${arc}
177 177
 }
178 178
 
179 179
 handle_evacuations() {
180 180
     while [ $# -gt 0 ]; do
181
-	node=$1
182
-	state=$2
183
-	shift; shift;
184
-	need_evacuate=0
185
-
186
-	case $state in
187
-	    "") ;;
188
-	    no)  ocf_log debug "$node is either fine or already handled";;
189
-	    yes) need_evacuate=1;;
190
-	    *@*)
191
-		where=$(echo $state | awk -F@ '{print $1}')
192
-		when=$(echo $state | awk -F@ '{print $2}')
193
-		now=$(date +%s)
194
-
195
-		if [ $(($now - $when)) -gt 60 ]; then
196
-		    ocf_log info "Processing partial evacuation of $node by $where at $when"
197
-		    need_evacuate=1
198
-		else
199
-		    # Give some time for any in-flight evacuations to either complete or fail
200
-		    # Nova won't react well if there are two overlapping requests
201
-		    ocf_log info "Deferring processing partial evacuation of $node by $where at $when"
202
-		fi
203
-		;;
204
-	esac
205
-
206
-	if [ $need_evacuate = 1 ]; then
207
-	    found=0
208
-	    ocf_log notice "Initiating evacuation of $node"
209
-
210
-	    for known in $(fence_compute ${fence_options} -o list | tr -d ','); do
211
-		if [ ${known} = ${node} ]; then
212
-		    found=1
213
-		    break
214
-		fi
215
-	    done
216
-
217
-	    if [ $found = 0 ]; then
218
-		ocf_log info "Nova does not know about ${node}"
219
-		# Dont mark as no because perhaps nova is unavailable right now
220
-		continue
221
-	    fi
222
-
223
-	    update_evacuation ${node} "$(uname -n)@$(date +%s)"
224
-	    if [ $? != 0 ]; then
225
-		return $OCF_SUCCESS
226
-	    fi
227
-
228
-	    fence_compute ${fence_options} -o off -n $node
229
-	    rc=$?
230
-
231
-	    if [ $rc = 0 ]; then
232
-		update_evacuation ${node} no
233
-		ocf_log notice "Completed evacuation of $node"
234
-	    else
235
-		ocf_log warn "Evacuation of $node failed: $rc"
236
-		update_evacuation ${node} yes
237
-	    fi
238
-	fi
181
+        node=$1
182
+        state=$2
183
+        shift; shift;
184
+        need_evacuate=0
185
+
186
+        case $state in
187
+            "")
188
+                ;;
189
+            no)
190
+                ocf_log debug "$node is either fine or already handled"
191
+                ;;
192
+            yes) need_evacuate=1
193
+                ;;
194
+            *@*)
195
+                where=$(echo $state | awk -F@ '{print $1}')
196
+                when=$(echo $state | awk -F@ '{print $2}')
197
+                now=$(date +%s)
198
+
199
+                if [ $(($now - $when)) -gt 60 ]; then
200
+                    ocf_log info "Processing partial evacuation of $node by $where at $when"
201
+                    need_evacuate=1
202
+                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"
206
+                fi
207
+                ;;
208
+        esac
209
+
210
+        if [ $need_evacuate = 1 ]; then
211
+            found=0
212
+            ocf_log notice "Initiating evacuation of $node"
213
+
214
+            for known in $(fence_compute ${fence_options} -o list | tr -d ','); do
215
+                if [ ${known} = ${node} ]; then
216
+                    found=1
217
+                    break
218
+                fi
219
+            done
220
+
221
+            if [ $found = 0 ]; then
222
+                ocf_log info "Nova does not know about ${node}"
223
+                # Dont mark as no because perhaps nova is unavailable right now
224
+                continue
225
+            fi
226
+
227
+            update_evacuation ${node} "$(uname -n)@$(date +%s)"
228
+            if [ $? != 0 ]; then
229
+                return $OCF_SUCCESS
230
+            fi
231
+
232
+            fence_compute ${fence_options} -o off -n $node
233
+            rc=$?
234
+
235
+            if [ $rc = 0 ]; then
236
+                update_evacuation ${node} no
237
+                ocf_log notice "Completed evacuation of $node"
238
+            else
239
+                ocf_log warn "Evacuation of $node failed: $rc"
240
+                update_evacuation ${node} yes
241
+            fi
242
+        fi
239 243
     done
240 244
 
241 245
     return $OCF_SUCCESS
@@ -243,7 +247,7 @@ handle_evacuations() {
243 247
 
244 248
 evacuate_monitor() {
245 249
     if [ ! -f "$statefile" ]; then
246
-	return $OCF_NOT_RUNNING
250
+        return $OCF_NOT_RUNNING
247 251
     fi
248 252
 
249 253
     handle_evacuations $(
@@ -266,72 +270,73 @@ evacuate_validate() {
266 270
     state_dir=$(dirname $statefile)
267 271
     touch "$state_dir/$$"
268 272
     if [ $? != 0 ]; then
269
-	ocf_exit_reason "Invalid state directory: $state_dir"
270
-	return $OCF_ERR_ARGS
273
+        ocf_exit_reason "Invalid state directory: $state_dir"
274
+        return $OCF_ERR_ARGS
271 275
     fi
272 276
     rm -f "$state_dir/$$"
273 277
 
274 278
     if [ -z "${OCF_RESKEY_auth_url}" ]; then
275
-	   ocf_exit_reason "auth_url not configured"
276
-	   exit $OCF_ERR_CONFIGURED
279
+        ocf_exit_reason "auth_url not configured"
280
+        exit $OCF_ERR_CONFIGURED
277 281
     fi
278 282
 
279 283
     fence_options="${fence_options} -k ${OCF_RESKEY_auth_url}"
280 284
 
281 285
     if [ -z "${OCF_RESKEY_username}" ]; then
282
-	   ocf_exit_reason "username not configured"
283
-	   exit $OCF_ERR_CONFIGURED
286
+        ocf_exit_reason "username not configured"
287
+        exit $OCF_ERR_CONFIGURED
284 288
     fi
285 289
 
286 290
     fence_options="${fence_options} -l ${OCF_RESKEY_username}"
287 291
 
288 292
     if [ -z "${OCF_RESKEY_password}" ]; then
289
-	   ocf_exit_reason "password not configured"
290
-	   exit $OCF_ERR_CONFIGURED
293
+        ocf_exit_reason "password not configured"
294
+        exit $OCF_ERR_CONFIGURED
291 295
     fi
292 296
 
293 297
     fence_options="${fence_options} -p ${OCF_RESKEY_password}"
294 298
 
295 299
     if [ -z "${OCF_RESKEY_tenant_name}" ]; then
296
-	   ocf_exit_reason "tenant_name not configured"
297
-	   exit $OCF_ERR_CONFIGURED
300
+        ocf_exit_reason "tenant_name not configured"
301
+        exit $OCF_ERR_CONFIGURED
298 302
     fi
299 303
 
300 304
     fence_options="${fence_options} -t ${OCF_RESKEY_tenant_name}"
301 305
 
302 306
     if [ -n "${OCF_RESKEY_domain}" ]; then
303
-	fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
307
+        fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
304 308
     fi
305 309
 
306 310
     if [ -n "${OCF_RESKEY_region_name}" ]; then
307
-	fence_options="${fence_options} --region-name ${OCF_RESKEY_region_name}"
311
+        fence_options="${fence_options} --region-name ${OCF_RESKEY_region_name}"
308 312
     fi
309 313
 
310 314
     if [ -n "${OCF_RESKEY_insecure}" ]; then
311
-	if ocf_is_true "${OCF_RESKEY_insecure}"; then
312
-	    fence_options="${fence_options} --insecure"
313
-	fi
315
+        if ocf_is_true "${OCF_RESKEY_insecure}"; then
316
+            fence_options="${fence_options} --insecure"
317
+        fi
314 318
     fi
315 319
 
316 320
     if [ -n "${OCF_RESKEY_no_shared_storage}" ]; then
317
-	if ocf_is_true "${OCF_RESKEY_no_shared_storage}"; then
318
-	    fence_options="${fence_options} --no-shared-storage"
319
-	fi
321
+        if ocf_is_true "${OCF_RESKEY_no_shared_storage}"; then
322
+            fence_options="${fence_options} --no-shared-storage"
323
+        fi
320 324
     fi
321 325
 
322 326
     if [ -n "${OCF_RESKEY_endpoint_type}" ]; then
323
-	case ${OCF_RESKEY_endpoint_type} in
324
-	    adminURL|publicURL|internalURL) ;;
325
-	    *)
326
-		ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
327
-		exit $OCF_ERR_CONFIGURED
328
-	    ;;
329
-	esac
330
-	fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
327
+        case ${OCF_RESKEY_endpoint_type} in
328
+            adminURL|publicURL|internalURL)
329
+                ;;
330
+            *)
331
+                ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type} not valid. Use adminURL or publicURL or internalURL"
332
+                exit $OCF_ERR_CONFIGURED
333
+                ;;
334
+        esac
335
+        fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
331 336
     fi
332 337
 
333 338
     if [ $rc != $OCF_SUCCESS ]; then
334
-	exit $rc
339
+        exit $rc
335 340
     fi
336 341
     return $rc
337 342
 }
@@ -339,19 +344,32 @@ evacuate_validate() {
339 344
 statefile="${HA_RSCTMP}/${OCF_RESOURCE_INSTANCE}.active"
340 345
 
341 346
 case $__OCF_ACTION in
342
-start)		evacuate_validate; evacuate_start;;
343
-stop)		evacuate_stop;;
344
-monitor)	evacuate_validate; evacuate_monitor;;
345
-meta-data)	meta_data
346
-		exit $OCF_SUCCESS
347
-		;;
348
-usage|help)	evacuate_usage
349
-		exit $OCF_SUCCESS
350
-		;;
351
-validate-all)	exit $OCF_SUCCESS;;
352
-*)		evacuate_usage
353
-		exit $OCF_ERR_UNIMPLEMENTED
354
-		;;
347
+    start)
348
+        evacuate_validate
349
+        evacuate_start
350
+        ;;
351
+    stop)
352
+        evacuate_stop
353
+        ;;
354
+    monitor)
355
+        evacuate_validate
356
+        evacuate_monitor
357
+        ;;
358
+    meta-data)
359
+        meta_data
360
+        exit $OCF_SUCCESS
361
+        ;;
362
+    usage|help)
363
+        evacuate_usage
364
+        exit $OCF_SUCCESS
365
+        ;;
366
+    validate-all)
367
+        exit $OCF_SUCCESS
368
+        ;;
369
+    *)
370
+        evacuate_usage
371
+        exit $OCF_ERR_UNIMPLEMENTED
372
+        ;;
355 373
 esac
356 374
 rc=$?
357 375
 ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"

+ 1
- 1
ocf/glance-api View File

@@ -238,7 +238,7 @@ glance_api_monitor() {
238 238
     # Monitor the RA by retrieving the image list
239 239
     if [ -n "$OCF_RESKEY_os_username" ] && [ -n "$OCF_RESKEY_os_password" ] \
240 240
     && [ -n "$OCF_RESKEY_os_tenant_name" ] && [ -n "$OCF_RESKEY_os_auth_url" ]; then
241
-	    ocf_run -q $OCF_RESKEY_client_binary \
241
+        ocf_run -q $OCF_RESKEY_client_binary \
242 242
         --os_username "$OCF_RESKEY_os_username" \
243 243
         --os_password "$OCF_RESKEY_os_password" \
244 244
         --os_tenant_name "$OCF_RESKEY_os_tenant_name" \

+ 5
- 5
ocf/neutron-agent-dhcp View File

@@ -219,10 +219,10 @@ neutron_dhcp_agent_monitor() {
219 219
         # check the connections according to the PID
220 220
         network_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
221 221
         rc=$?
222
-	    if [ $rc -ne 0 ]; then
223
-	        ocf_log err "Neutron DHCP Server is not connected to the AMQP server : $rc"
224
-	        return $OCF_NOT_RUNNING
225
-	    fi
222
+        if [ $rc -ne 0 ]; then
223
+            ocf_log err "Neutron DHCP Server is not connected to the AMQP server : $rc"
224
+            return $OCF_NOT_RUNNING
225
+        fi
226 226
 
227 227
     ocf_log debug "OpenStack DHCP Server (neutron-dhcp-agent) monitor succeeded"
228 228
     return $OCF_SUCCESS
@@ -242,7 +242,7 @@ neutron_dhcp_agent_start() {
242 242
     # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
243 243
     su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
244 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
245
+       /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
246 246
 
247 247
     # Spin waiting for the server to come up.
248 248
     # Let the CRM/LRM time us out if required

+ 5
- 5
ocf/neutron-agent-l3 View File

@@ -221,10 +221,10 @@ neutron_l3_agent_monitor() {
221 221
         # check the connections according to the PID
222 222
         network_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
223 223
         rc=$?
224
-	    if [ $rc -ne 0 ]; then
225
-	        ocf_log err "Neutron L3 Server is not connected to the Neutron server: $rc"
226
-	        return $OCF_NOT_RUNNING
227
-	    fi
224
+        if [ $rc -ne 0 ]; then
225
+            ocf_log err "Neutron L3 Server is not connected to the Neutron server: $rc"
226
+            return $OCF_NOT_RUNNING
227
+        fi
228 228
 
229 229
     ocf_log debug "OpenStack L3 Server (neutron-l3-agent) monitor succeeded"
230 230
     return $OCF_SUCCESS
@@ -244,7 +244,7 @@ neutron_l3_agent_start() {
244 244
     # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
245 245
     su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
246 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
247
+       /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
248 248
 
249 249
     # Spin waiting for the server to come up.
250 250
     # Let the CRM/LRM time us out if required

+ 2
- 2
ocf/neutron-metadata-agent View File

@@ -232,8 +232,8 @@ neutron_metadata_agent_start() {
232 232
     # Don't use ocf_run as we're sending the tool's output
233 233
     # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
234 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
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
237 237
 
238 238
     # Spin waiting for the server to come up.
239 239
     # Let the CRM/LRM time us out if required

+ 2
- 2
ocf/neutron-server View File

@@ -285,8 +285,8 @@ neutron_server_start() {
285 285
     # Don't use ocf_run as we're sending the tool's output
286 286
     # straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
287 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
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
290 290
 
291 291
     # Spin waiting for the server to come up.
292 292
     # Let the CRM/LRM time us out if required

+ 14
- 14
ocf/nova-cert View File

@@ -250,26 +250,26 @@ nova_cert_monitor() {
250 250
 
251 251
     # Check the connections according to the PID.
252 252
     # We are sure to hit the cert process and not other nova process with the same connection behavior (for example nova-scheduler)
253
-	if ocf_is_true "$OCF_RESKEY_zeromq"; then
254
-	    pid=`cat $OCF_RESKEY_pid`
255
-		cert_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
256
-		rc_db=$?
257
-		if [ $rc_db -ne 0 ]; then
258
-		    ocf_log err "Nova Cert is not connected to the database server: $rc_db"
259
-		    return $OCF_NOT_RUNNING
260
-		fi
261
-	else
253
+    if ocf_is_true "$OCF_RESKEY_zeromq"; then
254
+        pid=`cat $OCF_RESKEY_pid`
255
+        cert_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
256
+        rc_db=$?
257
+        if [ $rc_db -ne 0 ]; then
258
+            ocf_log err "Nova Cert is not connected to the database server: $rc_db"
259
+            return $OCF_NOT_RUNNING
260
+        fi
261
+    else
262 262
         pid=`cat $OCF_RESKEY_pid`
263 263
         # check the connections according to the PID
264 264
         cert_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -sq "ESTABLISHED"`
265 265
         rc_db=$?
266 266
         cert_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -sq "ESTABLISHED"`
267 267
         rc_amqp=$?
268
-	    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"
270
-		    return $OCF_NOT_RUNNING
271
-		fi
272
-	fi
268
+        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"
270
+            return $OCF_NOT_RUNNING
271
+        fi
272
+    fi
273 273
 
274 274
     ocf_log debug "OpenStack Nova Cert (nova-cert) monitor succeeded"
275 275
     return $OCF_SUCCESS

+ 14
- 14
ocf/nova-consoleauth View File

@@ -250,26 +250,26 @@ nova_consoleauth_monitor() {
250 250
 
251 251
     # Check the connections according to the PID.
252 252
     # We are sure to hit the scheduler process and not other nova process with the same connection behavior (for example nova-scheduler)
253
-	if ocf_is_true "$OCF_RESKEY_zeromq"; then
254
-		pid=`cat $OCF_RESKEY_pid`
255
-		console_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
256
-		rc_db=$?
257
-		if [ $rc_db -ne 0 ]; then
258
-		    ocf_log err "Nova Console Auth is not connected to the database server: $rc_db"
259
-		    return $OCF_NOT_RUNNING
260
-		fi
261
-	else
253
+    if ocf_is_true "$OCF_RESKEY_zeromq"; then
254
+        pid=`cat $OCF_RESKEY_pid`
255
+        console_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
256
+        rc_db=$?
257
+        if [ $rc_db -ne 0 ]; then
258
+            ocf_log err "Nova Console Auth is not connected to the database server: $rc_db"
259
+            return $OCF_NOT_RUNNING
260
+        fi
261
+    else
262 262
         pid=`cat $OCF_RESKEY_pid`
263 263
         # check the connections according to the PID
264 264
         console_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
265 265
         rc_db=$?
266 266
         console_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | egrep -s "$pid" | grep -qs "ESTABLISHED"`
267 267
         rc_amqp=$?
268
-	    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"
270
-		    return $OCF_NOT_RUNNING
271
-		fi
272
-	fi
268
+        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"
270
+            return $OCF_NOT_RUNNING
271
+        fi
272
+    fi
273 273
 
274 274
     ocf_log debug "OpenStack Nova Console Auth (nova-consoleauth) monitor succeeded"
275 275
     return $OCF_SUCCESS

+ 14
- 14
ocf/nova-network View File

@@ -229,26 +229,26 @@ nova_network_monitor() {
229 229
 
230 230
     # Check the connections according to the PID.
231 231
     # We are sure to hit the scheduler process and not other nova process with the same connection behavior (for example nova-cert)
232
-	if ocf_is_true "$OCF_RESKEY_zeromq"; then
233
-	    pid=`cat $OCF_RESKEY_pid`
234
-	    network_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
235
-	    rc_db=$?
236
-	    if [ $rc_db -ne 0 ]; then
237
-	        ocf_log err "Nova Network is not connected to the database server: $rc_db"
238
-	        return $OCF_NOT_RUNNING
239
-	    fi
240
-	else
232
+    if ocf_is_true "$OCF_RESKEY_zeromq"; then
233
+        pid=`cat $OCF_RESKEY_pid`
234
+        network_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
235
+        rc_db=$?
236
+        if [ $rc_db -ne 0 ]; then
237
+            ocf_log err "Nova Network is not connected to the database server: $rc_db"
238
+            return $OCF_NOT_RUNNING
239
+        fi
240
+    else
241 241
         pid=`cat $OCF_RESKEY_pid`
242 242
         # check the connections according to the PID
243 243
         network_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
244 244
         rc_db=$?
245 245
         network_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
246 246
         rc_amqp=$?
247
-	    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"
249
-	        return $OCF_NOT_RUNNING
250
-	    fi
251
-	fi
247
+        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"
249
+            return $OCF_NOT_RUNNING
250
+        fi
251
+    fi
252 252
 
253 253
     ocf_log debug "OpenStack Nova Network (nova-network) monitor succeeded"
254 254
     return $OCF_SUCCESS

+ 1
- 1
ocf/nova-novnc View File

@@ -213,7 +213,7 @@ nova_vnc_console_monitor() {
213 213
 
214 214
     # Check whether we are supposed to monitor by logging into nova-novncproxy
215 215
     # and do it if that's the case.
216
-	vnc_list_check=`netstat -a | grep -s "$OCF_RESKEY_console_port" | grep -qs "LISTEN"`
216
+    vnc_list_check=`netstat -a | grep -s "$OCF_RESKEY_console_port" | grep -qs "LISTEN"`
217 217
     rc=$?
218 218
     if [ $rc -ne 0 ]; then
219 219
         ocf_log err "Nova VNC Console doesn't seem to listen on his default port: $rc"

+ 13
- 13
ocf/nova-scheduler View File

@@ -251,24 +251,24 @@ nova_scheduler_monitor() {
251 251
     # Check the connections according to the PID.
252 252
     # We are sure to hit the scheduler process and not other nova process with the same connection behavior (for example nova-cert)
253 253
     if ocf_is_true "$OCF_RESKEY_zeromq"; then
254
-	    pid=`cat $OCF_RESKEY_pid`
255
-	    scheduler_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
256
-	    rc_db=$?
257
-	    if [ $rc_db -ne 0 ]; then
258
-	        ocf_log err "Nova Scheduler is not connected to the database server: $rc_db"
259
-	        return $OCF_NOT_RUNNING
260
-	    fi
261
-	else
254
+        pid=`cat $OCF_RESKEY_pid`
255
+        scheduler_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
256
+        rc_db=$?
257
+        if [ $rc_db -ne 0 ]; then
258
+            ocf_log err "Nova Scheduler is not connected to the database server: $rc_db"
259
+            return $OCF_NOT_RUNNING
260
+        fi
261
+    else
262 262
         pid=`cat $OCF_RESKEY_pid`
263 263
         scheduler_db_check=`netstat -punt | grep -s "$OCF_RESKEY_database_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
264 264
         rc_db=$?
265 265
         scheduler_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
266 266
         rc_amqp=$?
267
-	    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"
269
-	        return $OCF_NOT_RUNNING
270
-	    fi
271
-	fi
267
+        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"
269
+            return $OCF_NOT_RUNNING
270
+        fi
271
+    fi
272 272
 
273 273
     ocf_log debug "OpenStack Nova Scheduler (nova-scheduler) monitor succeeded"
274 274
     return $OCF_SUCCESS

Loading…
Cancel
Save