[Cluster-devel] cluster/rgmanager/src/resources xenvm.sh

lhh at sourceware.org lhh at sourceware.org
Mon Oct 16 20:59:53 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	lhh at sourceware.org	2006-10-16 20:59:53

Modified files:
	rgmanager/src/resources: xenvm.sh 

Log message:
	Updated xenvm resource agent

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/xenvm.sh.diff?cvsroot=cluster&r1=1.3&r2=1.4

--- cluster/rgmanager/src/resources/xenvm.sh	2006/07/19 18:43:32	1.3
+++ cluster/rgmanager/src/resources/xenvm.sh	2006/10/16 20:59:53	1.4
@@ -102,9 +102,9 @@
             <content type="integer"/>
         </parameter>
 
-	<parameter name="bootloader" required="1">
+	<parameter name="bootloader">
 	    <longdesc lang="en">
-		Root disk for the Xen VM (as presented to the VM)
+		Boot loader that can start the Xen VM from physical image
 	    </longdesc>
 	    <shortdesc lang="en">
 		Boot loader that can start the Xen VM from physical image
@@ -112,6 +112,18 @@
             <content type="string"/>
         </parameter>
 
+	<parameter name="path">
+	    <longdesc lang="en">
+	    	Path specification 'xm create' will search for the specified
+		VM configuration file
+	    </longdesc>
+	    <shortdesc lang="en">
+	    	Path to Xen configuration files
+	    </shortdesc>
+            <content type="string"/>
+        </parameter>
+
+
 	<parameter name="rootdisk_physical" unique="1">
 	    <longdesc lang="en">
 		root disk for the Xen VM.  (physical, on the host)
@@ -168,7 +180,7 @@
 
     <actions>
         <action name="start" timeout="20"/>
-        <action name="stop" timeout="240"/>
+        <action name="stop" timeout="120"/>
 	
 	<!-- No-ops.  Groups are abstract resource types.  -->
         <action name="status" timeout="10" interval="30m"/>
@@ -196,28 +208,6 @@
 }
 
 
-#
-# Find a list of possible IP addresses to try.
-#
-xen_host_ips()
-{
-	declare xen_ips=$(ip -f inet -o addr list | grep 'xen-br[0-9]\+[^:]' | awk '{print $4}')
-	declare tmp1=""
-	declare i
-
-	for i in $xen_ips; do
-                i=${i/\/*/}
-		if [ -z "$tmp1" ]; then
-			tmp1="$i"
-		else
-			tmp1="$i,$tmp1"
-		fi
-	done
-
-	echo $tmp1
-}
-
-
 build_xen_cmdline()
 {
 	#
@@ -228,7 +218,6 @@
 	declare cmdline="restart=\"never\""
 	declare varp val temp
 
-
 	#
 	# Transliterate the OCF_RESKEY_* to something the xm
 	# command can recognize.
@@ -261,12 +250,21 @@
 			;;
 		rootdisk_virtual)
 			;;
+		name)	# Do nothing with name; add it later
+			;;
+		path)
+			cmdline="$cmdline --path=\"$val\""
+			;;
 		*)
 			cmdline="$cmdline $varp=\"$val\""
 			;;
 		esac
 	done
 
+	if [ -n "$OCF_RESKEY_name" ]; then
+		cmdline="$OCF_RESKEY_name $cmdline"
+	fi
+
 	echo $cmdline
 }
 
@@ -282,13 +280,9 @@
 	#
 	declare cmdline
 
-	if [ -f "/etc/xen/xmdefconfig" ]; then
-		cmdline="`build_xen_cmdline`"
-	else
-		cmdline="`build_xen_cmdline` /dev/null"
-	fi
+	cmdline="`build_xen_cmdline`"
 
-	echo $cmdline
+	echo "# Xen Command Line: $cmdline"
 
 	eval xm create $cmdline
 	return $?
@@ -301,7 +295,7 @@
 #
 stop()
 {
-	declare -i timeout=120
+	declare -i timeout=60
 	declare -i ret=1
 	declare st
 
@@ -309,7 +303,7 @@
 		echo xm $op $OCF_RESKEY_name ...
 		xm $op $OCF_RESKEY_name
 
-		timeout=120
+		timeout=60
 		while [ $timeout -gt 0 ]; do
 			sleep 5
 			((timeout -= 5))
@@ -362,45 +356,11 @@
 verify_all()
 {
 	declare errors=0
-	declare tmp1, tmp2
-
-	if [ -z "$OCF_RESKEY_kernel" ]; then
-		echo "Required parameter OCF_RESKEY_kernel is not present"
-		((errors++))
-	elif ! [ -f "$OCF_RESKEY_kernel" ]; then
-		echo "$OCF_RESKEY_kernel (OCF_RESKEY_kernel) is not valid"
-		((errors++))
-	fi
-
-	tmp1=`echo $OCF_RESKEY_swapdisk | cut -f1 -d,`
-	tmp2=`echo $OCF_RESKEY_swapdisk | cut -f2 -d,`
-		
-	if [ -z "$tmp2" ]; then
-		echo "Swapdisk option malformed"
-		((errors++))
-	fi
-
-	if ! [ -b "$tmp1" ]; then
-		echo "Specified swapdisk device $tmp1 is not a block device"
-		((errors++))
-	fi
 
-	if [ -z "$OCF_RESKEY_rootdisk" ]; then
-		echo "Required parameter OCF_RESKEY_rootdisk is not present"
+	if [ -n "$OCF_RESKEY_bootloader" ] && \
+	   ! [ -x "$OCF_RESKEY_bootloader" ]; then
+		echo "$OCF_RESKEY_bootloader is not executable"
 		((errors++))
-	else
-		tmp1=`echo $OCF_RESKEY_rootdisk | cut -f1 -d,`
-		tmp2=`echo $OCF_RESKEY_rootdisk | cut -f2 -d,`
-		
-		if [ -z "$tmp2" ]; then
-			echo "Rootdisk option malformed"
-			((errors++))
-		fi
-
-		if ! [ -b "$tmp1" ]; then
-			echo "Specified rootdisk device $tmp1 is not a block device"
-			((errors++))
-		fi
 	fi
 }
 




More information about the Cluster-devel mailing list