Hi, On Sat, Jan 17, 2009 at 04:00:55AM -0500, David Sickmiller wrote: > Hi, > > I recently discovered that the Linux-HA's Filesystem OCF resource agent > doesn't work with GlusterFS. First, it needs "glusterfs" to be added to > the list of non-block-device filesystems. Second, it fails the > /proc/filesystems sanity check because it uses fuse. There may be > additional issues.
Can you please open a bugzilla for support to glusterfs. > Since I already have all my GlusterFS mount configurations stored in > /etc/fstab (with noauto), I find it annoying that these setting need to be > duplicated in cib.xml, CIB is replicated, /etc/fstab is not. I'd say it's better to keep the configuration in CIB. Sooner or later, your fstabs will start to drift away from each other. > and then the Filesystem agent needs to be modified > to specially handle GlusterFS. Thus, I copied Filesystem, ripped out most > of the code, and renamed it DumbFstabFilesystem. This version takes just > the mount point as a parameter, and it doesn't do much of its own sanity > checks other than making sure the mount point exists (which perhaps is > still superfluous). I'm pasting it here in case anyone else would find it > useful. I based it off the 2.1.3-3.el5.centos version. Thanks, but we should definitely be better of by supporting this fs in the Filesystem RA. Cheers, Dejan > -David > > #!/bin/sh > # > # Support: [email protected] > # License: GNU General Public License (GPL) > # > # DumbFstabFilesystem > # Description: Manages a filesystem, relying on /etc/fstab to be > properly configured. > # > # usage: ./DumbFstabFilesystem > {start|stop|status|monitor|validate-all|meta-data} > # > # OCF parameters are as below: > # OCF_RESKEY_directory > # > #OCF_RESKEY_directory : the mount point for the filesystem > # > # > # Put this filesystem in /etc/fstab. > # > > ####################################################################### > # Initialization: > > . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs > > ####################################################################### > HOSTOS=`uname` > > usage() { > cat <<-EOT > usage: $0 {start|stop|status|monitor|validate-all|meta-data} > EOT > } > > meta_data() { > cat <<END > <?xml version="1.0"?> > <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd"> > <resource-agent name="DumbFstabFilesystem"> > <version>1.0</version> > > <longdesc lang="en"> > Resource script for DumbFstabFilesystem. It manages a filesystem, relying > on /etc/fstab to be properly configured. > </longdesc> > <shortdesc lang="en">DumbFstabFilesystem resource agent</shortdesc> > > <parameters> > <parameter name="directory" required="1"> > <longdesc lang="en"> > The mount point for the filesystem. > </longdesc> > <shortdesc lang="en">mount point</shortdesc> > <content type="string" default="" /> > </parameter> > </parameters> > > <actions> > <action name="start" timeout="60" /> > <action name="stop" timeout="60" /> > <action name="notify" timeout="60" /> > <action name="monitor" depth="0" timeout="40" interval="20" > start-delay="10" /> > <action name="validate-all" timeout="5" /> > <action name="meta-data" timeout="5" /> > </actions> > </resource-agent> > END > } > > # Take advantage of /etc/mtab if present, use portable mount command > # otherwise. Normalize format to "dev mountpoint fstype". > list_mounts() { > if [ -f "/etc/mtab" -a -r "/etc/mtab" ]; then > cut -d' ' -f1,2,3 </etc/mtab > else > $MOUNT | cut -d' ' -f1,3,5 > fi > } > > # Lists all filesystems potentially mounted under a given path, > # excluding the path itself. > list_submounts() { > list_mounts | grep " $1/" | cut -d' ' -f2 | sort -r > } > > # > # START: Start up the filesystem > # > Filesystem_start() > { > # See if the device is already mounted. > if Filesystem_status >/dev/null 2>&1 ; then > ocf_log info "Filesystem $MOUNTPOINT is already mounted." > return $OCF_SUCCESS > fi > > # Check the filesystem & auto repair. # NOTE: Some filesystem types > don't need this step... Please modify > # accordingly > > if [ ! -d "$MOUNTPOINT" ] ; then > ocf_log err "Couldn't find directory [$MOUNTPOINT] to use as a > mount point" > exit $OCF_ERR_ARGS > fi > > # Mount the filesystem. > $MOUNT $MOUNTPOINT > > if [ $? -ne 0 ]; then > ocf_log err "Couldn't mount filesystem on $MOUNTPOINT" > return $OCF_ERR_GENERIC > fi > > return 0 > } > # end of Filesystem_start > > > # > # STOP: Unmount the filesystem > # > Filesystem_stop() > { > # See if the device is currently mounted > Filesystem_status >/dev/null 2>&1 > if [ $? -eq $OCF_NOT_RUNNING ]; then > # Already unmounted, wonderful. > rc=$OCF_SUCCESS > else > # For networked filesystems, we might want to add -f > > # Umount all sub-filesystems mounted under $MOUNTPOINT/ too. > for SUB in `list_submounts $MOUNTPOINT` $MOUNTPOINT; do > ocf_log info "Trying to unmount $MOUNTPOINT" > for sig in SIGTERM SIGTERM SIGTERM SIGKILL SIGKILL SIGKILL; do > if $UMOUNT $SUB ; then > rc=$OCF_SUCCESS > ocf_log info "unmounted $SUB successfully" > break > else > rc=$OCF_ERR_GENERIC > ocf_log err "Couldn't unmount $SUB; trying cleanup with > $sig" > # fuser returns a non-zero return code if none of the > # specified files is accessed or in case of a fatal > # error. > if [ "X${HOSTOS}" = "XOpenBSD" ];then > PIDS=`fstat | grep ${SUB} | awk '{print $3}'` > for PID in ${PIDS};do > kill -9 ${PID} > ocf_log info "Sent kill -9 to ${PID}" > done > else > if $FUSER -$sig -m -k $SUB ; then > ocf_log info "Some processes on $SUB were > signalled" > else > ocf_log info "No processes on $SUB were > signalled" > fi > fi > sleep 1 > fi > done > > if [ $rc -ne $OCF_SUCCESS ]; then > ocf_log err "Couldn't unmount $SUB, giving up!" > fi > done > fi > > return $rc > } > # end of Filesystem_stop > > # > # STATUS: is the filesystem mounted or not? > # > Filesystem_status() > { > if list_mounts | grep -q " $MOUNTPOINT " >/dev/null 2>&1; then > rc=$OCF_SUCCESS > msg="$MOUNTPOINT is mounted (running)" > else > rc=$OCF_NOT_RUNNING > msg="$MOUNTPOINT is unmounted (stopped)" > fi > > # Special case "monitor" to check whether the UUID cached and > # on-disk still match? > case "$OP" in > status) ocf_log info "$msg";; > esac > > return $rc > } > # end of Filesystem_status > > # > # VALIDATE_ALL: Are the instance parameters valid? > # FIXME!! The only part that's useful is the return code. > # This code always returns $OCF_SUCCESS (!) > # > Filesystem_validate_all() > { > if [ -n $MOUNTPOINT -a ! -d $MOUNTPOINT ]; then > ocf_log warn "Mountpoint $MOUNTPOINT does not exist" > fi > > return $OCF_SUCCESS > } > > # Check the arguments passed to this script > if [ $# -ne 1 ]; then > usage > exit $OCF_ERR_ARGS > fi > > # Check the OCF_RESKEY_ environment variables... > > OP=$1 > > # These operations do not require instance parameters > case $OP in > meta-data) meta_data > exit $OCF_SUCCESS > ;; > usage) usage > exit $OCF_SUCCESS > ;; > esac > > > # Normalize instance parameters: > > # It is possible that OCF_RESKEY_directory has one or even multiple > trailing "/". > # But the output of `mount` and /proc/mounts do not. > if [ -z "$OCF_RESKEY_directory" ]; then > ocf_log err "Please specify the directory" > exit $OCF_ERR_ARGS > else > MOUNTPOINT=$(echo $OCF_RESKEY_directory | sed 's/\/*$//') > : ${MOUNTPOINT:=/} > # At this stage, $MOUNTPOINT does not contain trailing "/" unless it is > "/" > # TODO: / mounted via Filesystem sounds dangerous. On stop, we'll > # kill the whole system. Is that a good idea? > fi > # Check to make sure the utilites are found > if [ "X${HOSTOS}" != "XOpenBSD" ];then > check_binary $FUSER > fi > check_binary $MOUNT > check_binary $UMOUNT > > if [ "$OP" != "monitor" ]; then > ocf_log info "Running $OP on $MOUNTPOINT" > fi > > # These operations do not require the clone checking + OCFS2 > # initialization. > case $OP in > status|monitor) Filesystem_status > exit $? > ;; > validate-all) Filesystem_validate_all > exit $? > ;; > stop) Filesystem_stop > exit $? > ;; > start) Filesystem_start > ;; > notify) exit $OCF_SUCCESS > ;; > *) usage > exit $OCF_ERR_UNIMPLEMENTED > ;; > esac > exit $? > _______________________________________________ > Linux-HA mailing list > [email protected] > http://lists.linux-ha.org/mailman/listinfo/linux-ha > See also: http://linux-ha.org/ReportingProblems _______________________________________________ Linux-HA mailing list [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha See also: http://linux-ha.org/ReportingProblems
