[rabbitmq-discuss] [PATCH 03 of 10] OCF resource agent: correctly behave on start and stop

Florian Haas florian.haas at linbit.com
Tue May 11 18:09:40 BST 2010


# HG changeset patch
# User Florian Haas <florian.haas at linbit.com>
# Date 1273593042 -7200
# Node ID 62ca42a0d9e9ee39a7c4348795693c1a71af269b
# Parent  756422c2ee0871e255ffae831d1fbddc9a2d7fb5
OCF resource agent: correctly behave on start and stop

Stopping a stopped resource must return without error. Likewise,
starting a started resource must return without error. Check for
status before blindly invoking start and stop.

diff -r 756422c2ee08 -r 62ca42a0d9e9 packaging/common/rabbitmq-server.ocf
--- a/packaging/common/rabbitmq-server.ocf	Tue May 11 17:47:48 2010 +0200
+++ b/packaging/common/rabbitmq-server.ocf	Tue May 11 17:50:42 2010 +0200
@@ -259,6 +259,11 @@
 rabbit_start() {
     local rc
 
+    if rabbit_status; then
+	ocf_log info "Resource already running."
+	return $OCF_SUCCESS
+    fi
+
     export_vars
 
     $RABBITMQ_MULTI start_all 1 > ${RABBITMQ_LOG_BASE}/startup_log 2> ${RABBITMQ_LOG_BASE}/startup_err &
@@ -290,6 +295,12 @@
 
 rabbit_stop() {
     local rc
+
+    if ! rabbit_status; then
+	ocf_log info "Resource not running."
+	return $OCF_SUCCESS
+    fi
+
     $RABBITMQ_MULTI stop_all &
     rc=$?
 





More information about the rabbitmq-discuss mailing list