Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > e536fc0c6270ec1d92a0fd41bb1f8360 > files > 55

rgmanager-2.0.52-28.el5_8.2.src.rpm

From 805e0bae5db683fb33ec2e3c14b12c6380885494 Mon Sep 17 00:00:00 2001
From: Lon Hohberger <lhh@redhat.com>
Date: Tue, 4 May 2010 17:54:15 -0400
Subject: [PATCH] resource-agents: Add status_program attribute

Fix previous patch which contained an incorrect default.

Resolves: bz583788

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/src/resources/vm.sh |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
index d2932dd..c8be516 100755
--- a/rgmanager/src/resources/vm.sh
+++ b/rgmanager/src/resources/vm.sh
@@ -213,6 +213,20 @@ meta_data()
             <content type="string" default="0"/>
         </parameter>
 
+        <parameter name="status_program" reconfig="1">
+            <longdesc lang="en">
+	    	Ordinarily, only the presence/health of a virtual machine
+		is checked.  If specified, the status_program value is
+		executed during a depth 10 check.  The intent of this 
+		program is to ascertain the status of critical services
+		within a virtual machine.
+            </longdesc>
+            <shortdesc lang="en">
+	    	Additional status check program
+            </shortdesc>
+            <content type="string" default=""/>
+        </parameter>
+
 	<parameter name="hypervisor">
             <shortdesc lang="en">
 		Hypervisor
@@ -255,6 +269,10 @@ meta_data()
         <action name="status" timeout="10" interval="30"/>
         <action name="monitor" timeout="10" interval="30"/>
 
+	<!-- depth 10 calls the status_program -->
+        <action name="status" depth="10" timeout="10" interval="300"/>
+        <action name="monitor" depth="10" timeout="10" interval="300"/>
+
 	<!-- reconfigure - reconfigure with new OCF parameters.
 	     NOT OCF COMPATIBLE AT ALL -->
 	<action name="reconfig" timeout="10"/>
@@ -543,7 +561,11 @@ virsh_status()
 		return 0
 	fi
 
-	return 1
+	if [ "$state" = "shut off" ]; then
+		return $OCF_NOT_RUNNING
+	fi
+
+	return $OCF_ERR_GENERIC
 }
 
 
@@ -923,6 +945,15 @@ case $1 in
 		validate_all || exit $OCF_ERR_ARGS
 		echo -n "Virtual machine $OCF_RESKEY_name is "
 		do_status
+		rv=$?
+		if [ $rv -ne 0 ]; then
+			exit $rv
+		fi
+		[ -z "$OCF_RESKEY_status_program" ] && exit 0
+		[ -z "$OCF_CHECK_LEVEL" ] && exit 0
+		[ $OCF_CHECK_LEVEL -lt 10 ] && exit 0
+
+		bash -c "$OCF_RESKEY_status_program" &> /dev/null
 		exit $?
 		;;
 	migrate)
-- 
1.6.2.5