OK, unique now ="1".

Clone mode is disabled because it is disabled in the nfsserver RA,
which I used as a template.

I have removed the bit disabling clone mode, is there anything else to
do for supporting clone mode? I assume that cloning just means the
resource can be started on more than one node at once, so the RA does
not really need anything special...

An updated patch is attached.

On Thu, Mar 25, 2010 at 10:28 AM, Florian Haas <[email protected]> wrote:
> On 03/25/2010 03:08 PM, Ben Timby wrote:
>> Wait a sec. I just noticed the unique="0" on the fsid parameter, does
>> that enforce uniqueness within the cluster? If so, should I enable
>> that for that parameter?
>
> Yes, you should.
>
> And btw: what's the reason for specifically disallowing clone mode?
> Wouldn't it be conceivable to export from multiple nodes in parallel,
> provided there is a cluster file system underneath?
>
> Cheers,
> Florian
>
>
> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
>
>
diff -r 61cf8556ad31 heartbeat/exportfs
--- a/heartbeat/exportfs	Wed Mar 24 20:10:42 2010 +0100
+++ b/heartbeat/exportfs	Thu Mar 25 10:39:47 2010 -0400
@@ -46,7 +46,7 @@
 <content type="string" default="" />
 </parameter>
 
-<parameter name="dir" unique="0" required="1">
+<parameter name="directory" unique="0" required="1">
 <longdesc lang="en">
 The directory which you wish to export using NFS.
 </longdesc>
@@ -56,6 +56,17 @@
 <content type="string" default="" />
 </parameter>
 
+<parameter name="fsid" unique="0" required="1">
+<longdesc lang="en">
+The fsid option to pass to exportfs. This should be a unique positive integer, avoid 0 unless you understand it's special status.
+This value will override any fsid provided via the options parameter.
+</longdesc>
+<shortdesc lang="en">
+Unique fsid within cluster.
+</shortdesc>
+<content type="string" default="" />
+</parameter>
+
 </parameters>
 
 <actions>
@@ -97,19 +108,19 @@
 
 backup_rmtab ()
 {
-	grep ${OCF_RESKEY_dir} /var/lib/nfs/rmtab > ${OCF_RESKEY_dir}/.rmtab
+	grep ${OCF_RESKEY_directory} /var/lib/nfs/rmtab > ${OCF_RESKEY_directory}/.rmtab
 }
 
 clean_rmtab ()
 {
-	REMOVE=`echo ${OCF_RESKEY_dir} | sed 's/\//\\\\\//g'`
+	REMOVE=`echo ${OCF_RESKEY_directory} | sed 's/\//\\\\\//g'`
 	sed -i -e /${REMOVE}/d /var/lib/nfs/rmtab
 }
 
 exportfs_monitor ()
 {
 	fn=`/bin/mktemp`
-	grep "${OCF_RESKEY_dir}" /var/lib/nfs/etab > $fn 2>&1
+	grep "${OCF_RESKEY_directory}" /var/lib/nfs/etab > $fn 2>&1
 	rc=$?
 
 #Adapt grep status code to OCF return code
@@ -134,26 +145,23 @@
 		OPTIONS="${OCF_RESKEY_options}"
 		OPTPREFIX=','
 	fi
-	#generate fsid if none provided...
-	if [ ! `echo ${OPTIONS} | grep fsid` ]; then
-		if [ -f ${OCF_RESKEY_dir}/.fsid ]; then
-			FSID=`cat ${OCF_RESKEY_dir}/.fsid`
-		else
-			FSID=$RANDOM
-		fi
-		echo $FSID > ${OCF_RESKEY_dir}/.fsid
-		OPTIONS="${OPTIONS}${OPTPREFIX}fsid=${FSID}"
+	if [ `echo ${OPTIONS} | grep fsid` ]; then
+		#replace fsid provided in options list with one provided in fsid param.
+		OPTIONS=`echo ${OPTIONS} | sed 's/fsid=[0-9]\+/fsid=${OCF_RESKEY_fsid}/g'`
+	else
+		#tack the fsid option onto our options list.
+		OPTIONS="${OPTIONS}${OPTPREFIX}fsid=${OCF_RESKEY_fsid}"
 	fi
 	OPTIONS="-o ${OPTIONS}"
 
 	fn=`/bin/mktemp`
-	exportfs ${OPTIONS} ${OCF_RESKEY_clientspec}:${OCF_RESKEY_dir} > $fn 2>&1
+	exportfs ${OPTIONS} ${OCF_RESKEY_clientspec}:${OCF_RESKEY_directory} > $fn 2>&1
 	rc=$?
 
 	#restore saved rmtab backup from other server:
-	if [ -f ${OCF_RESKEY_dir}/.rmtab ]; then
-		cat ${OCF_RESKEY_dir}/.rmtab >> /var/lib/nfs/rmtab
-		rm -f ${OCF_RESKEY_dir}/.rmtab
+	if [ -f ${OCF_RESKEY_directory}/.rmtab ]; then
+		cat ${OCF_RESKEY_directory}/.rmtab >> /var/lib/nfs/rmtab
+		rm -f ${OCF_RESKEY_directory}/.rmtab
 	fi
 
 	/bin/sh $0 backup &
@@ -174,12 +182,12 @@
 	ocf_log info "Un-exporting file system ..."
 
 	fn=`/bin/mktemp`
-	exportfs -u ${OCF_RESKEY_clientspec}:${OCF_RESKEY_dir} > $fn 2>&1
+	exportfs -u ${OCF_RESKEY_clientspec}:${OCF_RESKEY_directory} > $fn 2>&1
 	rc=$?
 
-	if [ -f ${OCF_RESKEY_dir}/.exportfs_backup.pid ]; then
-		kill `cat ${OCF_RESKEY_dir}/.exportfs_backup.pid`
-		rm ${OCF_RESKEY_dir}/.exportfs_backup.pid
+	if [ -f ${OCF_RESKEY_directory}/.exportfs_backup.pid ]; then
+		kill `cat ${OCF_RESKEY_directory}/.exportfs_backup.pid`
+		rm ${OCF_RESKEY_directory}/.exportfs_backup.pid
 	fi
 
 	backup_rmtab
@@ -198,7 +206,7 @@
 
 exportfs_backup ()
 {
-	echo $$ > ${OCF_RESKEY_dir}/.exportfs_backup.pid
+	echo $$ > ${OCF_RESKEY_directory}/.exportfs_backup.pid
 	while [ 1 ]; do
 		backup_rmtab
 		sleep 2
@@ -207,7 +215,7 @@
 
 exportfs_validate ()
 {
-	if [ -d $OCF_RESKEY_dir ]; then
+	if [ -d $OCF_RESKEY_directory ]; then
 		return $OCF_SUCCESS
 	else
 		exit $OCF_ERR_ARGS
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to