All of lore.kernel.org
 help / color / mirror / Atom feed
From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager/src/resources fs.sh ip.sh nf ...
Date: 19 Apr 2007 17:53:07 -0000	[thread overview]
Message-ID: <20070419175307.22597.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh at sourceware.org	2007-04-19 18:53:05

Modified files:
	rgmanager/src/resources: fs.sh ip.sh nfsclient.sh vm.sh 

Log message:
	Cleanups to make the resource agents behave better (return OCF_NOT_RUNNING, for example)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/fs.sh.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/ip.sh.diff?cvsroot=cluster&r1=1.23&r2=1.24
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/nfsclient.sh.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/vm.sh.diff?cvsroot=cluster&r1=1.3&r2=1.4

--- cluster/rgmanager/src/resources/fs.sh	2007/04/05 15:08:20	1.21
+++ cluster/rgmanager/src/resources/fs.sh	2007/04/19 17:53:05	1.22
@@ -527,7 +527,7 @@
 	if [ -z "$dev" ]; then
 		ocf_log err \
 			"fs (isMounted): Could not match $1 with a real device"
-		return $FAIL
+		return $OCF_ERR_ARGS
 	fi
 	mp=$2
 	
@@ -939,7 +939,7 @@
 		;;
 	$NO)		# not mounted, continue
 		;;
-	$FAIL)
+	*)
 		return $FAIL
 		;;
 	esac
@@ -1149,9 +1149,6 @@
 			umount_failed=
 			done=$YES
 			;;
-		$FAIL)
-			return $FAIL
-			;;
 		$YES)
 			sync; sync; sync
 			ocf_log info "unmounting $mp"
@@ -1236,6 +1233,19 @@
 	;;
 status|monitor)
   	isMounted ${OCF_RESKEY_device} ${OCF_RESKEY_mountpoint}
+	case $? in
+	$NO)
+		ocf_log info "fs:${OCF_RESKEY_name}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}"
+		exit $OCF_NOT_RUNNING
+		;;
+	$YES)
+		;;
+	*)
+		ocf_log err "fs:${OCF_RESKEY_name}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}"
+		exit $OCF_ERR_GENERIC
+		;;
+	esac
+		
  	if [ $? -ne $YES ]; then
 		ocf_log err "fs:${OCF_RESKEY_name}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}"
 		exit $OCF_ERR_GENERIC
--- cluster/rgmanager/src/resources/ip.sh	2007/04/05 15:08:20	1.23
+++ cluster/rgmanager/src/resources/ip.sh	2007/04/19 17:53:05	1.24
@@ -915,7 +915,7 @@
 	;;
 status|monitor)
 	ip_op ${OCF_RESKEY_family} status ${OCF_RESKEY_address}
-	[ $? -ne 0 ] && exit $OCF_ERR_GENERIC
+	[ $? -ne 0 ] && exit $OCF_NOT_RUNNING
 	
 	check_interface_up ${OCF_RESKEY_family} ${OCF_RESKEY_address}
 	exit $?
--- cluster/rgmanager/src/resources/nfsclient.sh	2007/04/05 15:08:20	1.15
+++ cluster/rgmanager/src/resources/nfsclient.sh	2007/04/19 17:53:05	1.16
@@ -83,6 +83,15 @@
             <content type="string"/>
         </parameter>
 
+        <parameter name="svcname" inherit="service%name">
+            <longdesc lang="en">
+            </longdesc>
+            <shortdesc lang="en">
+            </shortdesc>
+            <content type="string"/>
+        </parameter>
+
+
         <parameter name="fsid" inherit="fsid">
             <longdesc lang="en">
 	    	File system ID inherited from the parent nfsexport/
@@ -323,7 +332,8 @@
 
 	rv=$? 
 	if [ $rv -ne 0 ]; then
-		ocf_log err "nfsclient:$OCF_RESKEY_name is missing!"
+		ocf_log info "nfsclient:$OCF_RESKEY_name is not running!"
+		exit $OCF_NOT_RUNNING
 	fi
 	;;
 
--- cluster/rgmanager/src/resources/vm.sh	2007/04/05 15:08:20	1.3
+++ cluster/rgmanager/src/resources/vm.sh	2007/04/19 17:53:05	1.4
@@ -22,6 +22,8 @@
 
 export PATH
 
+. $(dirname $0)/ocf-shellfuncs || exit 1
+
 #
 # Virtual Machine start/stop script (requires the xm command)
 #
@@ -346,8 +348,28 @@
 #
 status()
 {
-	xm list $OCF_RESKEY_name &> /dev/null
-	return $?
+	declare line
+
+	line=$(virsh domstate $OCF_RESKEY_name)
+	if [ "$line" = "" ]; then
+		return $OCF_NOT_RUNNING
+	fi
+
+	if [ "$line" = "blocked" ]; then
+		return $OCF_SUCCESS
+	elif [ "$line" = "running" ]; then
+		return $OCF_SUCCESS
+	elif [ "$line" = "in shutdown" ]; then
+		return $OCF_SUCCESS
+	elif [ "$line" = "shut off" ]; then
+		return $OCF_NOT_RUNNING
+	fi
+
+	#
+	# Crashed or paused
+	#
+
+	return $OCF_ERR_GENERIC
 }
 
 



                 reply	other threads:[~2007-04-19 17:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070419175307.22597.qmail@sourceware.org \
    --to=lhh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.