Hello

I suggest to add a parameter which decides executing fsck
as user's policy in Filesystem RA.

Because, current RA dose not check ext3 because executing fsck depends on
filesystem.
But ext3 sometimes is broken and remounted read-only although it has journal, so
I want to decide myself executing fsck before mount to operate more safely.

This new parameter has three mode "auto","force" and "no".
Default is "auto" which do the same thing as before.
"force" and "no" mean what they say.

Regards,
Takatoshi MATSUO
diff -r 7b25263a3fdc heartbeat/Filesystem
--- a/heartbeat/Filesystem      Sun May 16 13:49:37 2010 +0200
+++ b/heartbeat/Filesystem      Wed May 26 11:40:05 2010 +0900
@@ -16,6 +16,7 @@
 #              OCF_RESKEY_fstype
 #              OCF_RESKEY_options
 #              OCF_RESKEY_statusfile_prefix
+#              OCF_RESKEY_run_fsck
 #
 #OCF_RESKEY_device    : name of block device for the filesystem. e.g. 
/dev/sda1, /dev/md0
 #                      Or a -U or -L option for mount, or an NFS mount 
specification
@@ -23,6 +24,7 @@
 #OCF_RESKEY_fstype    : optional name of the filesystem type. e.g. ext2
 #OCF_RESKEY_options   : options to be given to the mount command via -o
 #OCF_RESKEY_statusfile_prefix : the prefix used for a status file for 
monitoring
+#OCF_RESKEY_run_fsck  : fsck execution mode: auto(default)/force/no
 #
 #
 # This assumes you want to manage a filesystem on a shared (SCSI) bus,
@@ -151,6 +153,18 @@
 <content type="string" default="$DFLT_STATUSDIR" />
 </parameter>
 
+<parameter name="run_fsck">
+<longdesc lang="en">
+Specify how to decide whether to run fsck or not.
+
+"auto"  : decide to run fsck depending on the fstype(default)
+"force" : always run fsck regardless of the fstype
+"no"    : do not run fsck ever.
+</longdesc>
+<shortdesc lang="en">run_fsck</shortdesc>
+<content type="string" default="auto" />
+</parameter>
+
 </parameters>
 
 <actions>
@@ -379,6 +393,25 @@
        fi
 }
 
+is_fsck_needed() {
+       case $OCF_RESKEY_run_fsck in
+           force) true;;
+           no)    false;;
+           ""|auto)
+               case $FSTYPE in
+                   
ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre)
+                       false;;
+                   *)
+                       true;;
+               esac;;
+           *)
+               ocf_log warn "Invalid parameter value for fsck: 
'$OCF_RESKEY_run_fsck'; 'auto' is used."
+               OCF_RESKEY_run_fsck="auto"
+               is_fsck_needed;;
+       esac
+}
+
+
 #
 # START: Start up the filesystem
 #
@@ -430,12 +463,7 @@
                        exit $OCF_ERR_INSTALLED
                fi
 
-               if
-                 case $FSTYPE in
-                   
ext3|reiserfs|reiser4|nss|xfs|jfs|vfat|fat|nfs|cifs|smbfs|ocfs2|gfs2|none|lustre)
   false;;
-                   *)                                                          
        true;;
-                 esac
-               then
+               if is_fsck_needed; then
                        ocf_log info  "Starting filesystem check on $DEVICE"
                        if [ -z "$FSTYPE" ]; then
                                $FSCK -p $DEVICE
_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker

Reply via email to