[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH] Fixed scripts for use with rgmanager



Patch to fix common rgmanager scripts for use with pacemaker.
>From a656372b8873d8ec9afd97e84b3a6dc6460e4bb3 Mon Sep 17 00:00:00 2001
From: Chris Feist <cfeist redhat com>
Date: Wed, 6 Jul 2011 15:39:04 -0500
Subject: [PATCH] Fixed scripts for use with rgmanager

- Fixed the following scripts: fs, ip, apache, mysql, clusterfs,
  nfsclient, netfs, nfsserver, vm
---
 rgmanager/src/resources/apache.metadata            |    1 +
 rgmanager/src/resources/apache.sh                  |   26 ++++++++++++++-----
 rgmanager/src/resources/clusterfs.sh               |    1 +
 rgmanager/src/resources/fs.sh.in                   |    1 +
 rgmanager/src/resources/ip.sh                      |    1 +
 rgmanager/src/resources/mysql.metadata             |    1 +
 rgmanager/src/resources/mysql.sh                   |   21 ++++++++++++++++
 rgmanager/src/resources/netfs.sh                   |    1 +
 rgmanager/src/resources/nfsclient.sh               |    3 +-
 rgmanager/src/resources/nfsserver.sh               |    3 +-
 rgmanager/src/resources/utils/ra-skelet.sh         |    2 +-
 rgmanager/src/resources/vm.sh                      |    3 +-
 12 files changed, 53 insertions(+), 11 deletions(-)
 mode change 100644 => 100755 rgmanager/src/resources/apache.sh
 mode change 100644 => 100755 rgmanager/src/resources/clusterfs.sh
 mode change 100644 => 100755 rgmanager/src/resources/ip.sh
 mode change 100644 => 100755 rgmanager/src/resources/mysql.sh
 mode change 100644 => 100755 rgmanager/src/resources/netfs.sh
 mode change 100644 => 100755 rgmanager/src/resources/nfsclient.sh
 mode change 100644 => 100755 rgmanager/src/resources/nfsserver.sh
 mode change 100644 => 100755 rgmanager/src/resources/utils/httpd-parse-config.pl

diff --git a/rgmanager/src/resources/apache.metadata b/rgmanager/src/resources/apache.metadata
index 727d138..93d5fd8 100644
--- a/rgmanager/src/resources/apache.metadata
+++ b/rgmanager/src/resources/apache.metadata
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent version="rgmanager 2.0" name="apache">
     <version>1.0</version>
 
diff --git a/rgmanager/src/resources/apache.sh b/rgmanager/src/resources/apache.sh
old mode 100644
new mode 100755
index 2ec0d4d..f0da4b0
--- a/rgmanager/src/resources/apache.sh
+++ b/rgmanager/src/resources/apache.sh
@@ -161,6 +161,11 @@ EOT
 
 start()
 {
+	if status; then
+		ocf_log info "Starting Service $OCF_RESOURCE_INSTANCE > Already running"
+		return $OCF_SUCCESS
+	fi
+
 	declare ip_addresses
 
 	clog_service_start $CLOG_INIT	
@@ -226,13 +231,20 @@ status()
 	clog_service_status $CLOG_INIT
 
 	status_check_pid "$APACHE_pid_file"
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$APACHE_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
+	case $? in
+		$OCF_NOT_RUNNING)
+			clog_service_status $CLOG_FAILED "$APAHCE_pid_file"
+			return $OCF_NOT_RUNNING
+			;;
+		0)
+			clog_service_status $CLOG_SUCCEED
+			exit 0
+			;;
+		*)
+			clog_service_status $CLOG_FAILED "$APACHE_pid_file"
+			return $OCF_ERR_GENERIC
+			;;
+	esac
 }
 
 if [ "$1" != "meta-data" ]; then
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
old mode 100644
new mode 100755
index af40f08..d052ffe
--- a/rgmanager/src/resources/clusterfs.sh
+++ b/rgmanager/src/resources/clusterfs.sh
@@ -27,6 +27,7 @@ do_metadata()
 {
 	cat <<EOT
 <?xml version="1.0" ?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent name="clusterfs" version="rgmanager 2.0">
     <version>1.0</version>
 
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
index 3e1cc15..c43c177 100644
--- a/rgmanager/src/resources/fs.sh.in
+++ b/rgmanager/src/resources/fs.sh.in
@@ -28,6 +28,7 @@ do_metadata()
 {
 	cat <<EOT
 <?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent name="fs" version="rgmanager 2.0">
     <version>1.0</version>
 
diff --git a/rgmanager/src/resources/ip.sh b/rgmanager/src/resources/ip.sh
old mode 100644
new mode 100755
index 04d5230..8686f02
--- a/rgmanager/src/resources/ip.sh
+++ b/rgmanager/src/resources/ip.sh
@@ -42,6 +42,7 @@ meta_data()
 {
     cat <<EOT
 <?xml version="1.0" ?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent version="rgmanager 2.0" name="ip">
     <version>1.0</version>
 
diff --git a/rgmanager/src/resources/mysql.metadata b/rgmanager/src/resources/mysql.metadata
index 4fa383b..d3ade15 100644
--- a/rgmanager/src/resources/mysql.metadata
+++ b/rgmanager/src/resources/mysql.metadata
@@ -1,4 +1,5 @@
 <?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent version="rgmanager 2.0" name="mysql">
     <version>1.0</version>
 
diff --git a/rgmanager/src/resources/mysql.sh b/rgmanager/src/resources/mysql.sh
old mode 100644
new mode 100755
index e410cd3..5195bc5
--- a/rgmanager/src/resources/mysql.sh
+++ b/rgmanager/src/resources/mysql.sh
@@ -68,6 +68,11 @@ verify_all()
 
 start()
 {
+        if status; then
+                ocf_log info "Starting Service $OCF_RESOURCE_INSTANCE > Already running"
+                return $OCF_SUCCESS
+        fi
+
 	clog_service_start $CLOG_INIT
 
 	create_pid_directory
@@ -148,6 +153,22 @@ status()
 	clog_service_status $CLOG_INIT
 
 	status_check_pid "$MYSQL_pid_file"
+	case $? in
+		$OCF_NOT_RUNNING)
+		clog_service_status $CLOG_FAILED "$MYSL_pid_file"
+		return $OCF_NOT_RUNNING
+		;;
+	0)
+		clog_service_status $CLOG_SUCCEED
+		exit 0
+		;;
+	*)
+		clog_service_status $CLOG_FAILED "$MYSL_pid_file"
+		return $OCF_ERR_GENERIC
+		;;
+	esac
+
+		
 	if [ $? -ne 0 ]; then
 		clog_service_status $CLOG_FAILED "$MYSQL_pid_file"
 		return $OCF_ERR_GENERIC
diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
old mode 100644
new mode 100755
index 52cefc4..f881917
--- a/rgmanager/src/resources/netfs.sh
+++ b/rgmanager/src/resources/netfs.sh
@@ -28,6 +28,7 @@ do_metadata()
 {
 	cat <<EOT
 <?xml version="1.0" ?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent name="netfs" version="rgmanager 2.0">
     <version>1.0</version>
 
diff --git a/rgmanager/src/resources/nfsclient.sh b/rgmanager/src/resources/nfsclient.sh
old mode 100644
new mode 100755
index 940c14f..c37d87e
--- a/rgmanager/src/resources/nfsclient.sh
+++ b/rgmanager/src/resources/nfsclient.sh
@@ -33,6 +33,7 @@ meta_data()
 {
 	cat <<EOT
 <?xml version="1.0" ?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent version="rgmanager 2.0" name="nfsclient">
     <version>1.0</version>
 
@@ -424,7 +425,7 @@ status|monitor)
 	fi
 
 	ocf_log err "nfsclient:$OCF_RESKEY_name is missing!"
-	exit 1
+	exit $OCF_NOT_RUNNING
 	;;
 
 recover)
diff --git a/rgmanager/src/resources/nfsserver.sh b/rgmanager/src/resources/nfsserver.sh
old mode 100644
new mode 100755
index f7b6b7a..e2161dc
--- a/rgmanager/src/resources/nfsserver.sh
+++ b/rgmanager/src/resources/nfsserver.sh
@@ -40,6 +40,7 @@ meta_data()
 {
 	cat <<EOT
 <?xml version="1.0" ?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent name="nfsserver" version="rgmanager 2.0">
     <version>1.0</version>
 
@@ -200,7 +201,7 @@ nfs_daemons()
 			ocf_log debug "NFS daemons are running"
 			return 0
 		fi
-		return 1
+		return $OCF_NOT_RUNNING
 		;;
 	esac
 }
diff --git a/rgmanager/src/resources/utils/httpd-parse-config.pl b/rgmanager/src/resources/utils/httpd-parse-config.pl
old mode 100644
new mode 100755
diff --git a/rgmanager/src/resources/utils/ra-skelet.sh b/rgmanager/src/resources/utils/ra-skelet.sh
index a80aac8..d88a033 100644
--- a/rgmanager/src/resources/utils/ra-skelet.sh
+++ b/rgmanager/src/resources/utils/ra-skelet.sh
@@ -29,7 +29,7 @@ status_check_pid()
 
 	if [ ! -e "$pid_file" ]; then
 		clog_check_file_exist $CLOG_FAILED "$pid_file"
-		return $OCF_ERR_GENERIC
+		return $OCF_NOT_RUNNING
 	fi
 
 	read pid < "$pid_file"
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index 100e349..d2303fe 100644
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -35,6 +35,7 @@ meta_data()
 {
     cat <<EOT
 <?xml version="1.0"?>
+<!DOCTYPE resource-agent SYSTEM "ra-api-1-modified.dtd">
 <resource-agent version="rgmanager 2.0" name="vm">
     <version>1.0</version>
 
@@ -566,7 +567,7 @@ xm_status()
 		return 0
 	fi
 	echo "not running"
-	return 1
+	return $OCF_NOT_RUNNING
 }
 
 
-- 
1.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]