/usr/share/cluster/clusterfs.sh is in resource-agents 1:3.9.2-5ubuntu4.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | #!/bin/bash
#
# Cluster File System mount/umount/fsck/etc. agent
#
# Copyright (C) 2000 Mission Critical Linux
# Copyright (C) 2002-2011 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
. $(dirname $0)/utils/fs-lib.sh
do_metadata()
{
cat <<EOT
<?xml version="1.0" ?>
<resource-agent name="clusterfs" version="rgmanager 2.0">
<version>1.0</version>
<longdesc lang="en">
This defines a cluster file system mount (i.e. GFS)
</longdesc>
<shortdesc lang="en">
Defines a cluster file system mount.
</shortdesc>
<parameters>
<parameter name="name" primary="1">
<longdesc lang="en">
Symbolic name for this file system.
</longdesc>
<shortdesc lang="en">
File System Name
</shortdesc>
<content type="string"/>
</parameter>
<parameter name="mountpoint" unique="1" required="1">
<longdesc lang="en">
Path in file system heirarchy to mount this file system.
</longdesc>
<shortdesc lang="en">
Mount Point
</shortdesc>
<content type="string"/>
</parameter>
<parameter name="device" unique="1" required="1">
<longdesc lang="en">
Block device, file system label, or UUID of file system.
</longdesc>
<shortdesc lang="en">
Device or Label
</shortdesc>
<content type="string"/>
</parameter>
<parameter name="fstype">
<longdesc lang="en">
File system type. If not specified, mount(8) will attempt to
determine the file system type.
</longdesc>
<shortdesc lang="en">
File system type
</shortdesc>
<content type="string"/>
</parameter>
<parameter name="force_unmount">
<longdesc lang="en">
If set, the cluster will kill all processes using
this file system when the resource group is
stopped. Otherwise, the unmount will fail, and
the resource group will be restarted.
</longdesc>
<shortdesc lang="en">
Force Unmount
</shortdesc>
<content type="boolean"/>
</parameter>
<parameter name="options">
<longdesc lang="en">
If set, the file system will be checked (even if
it is a journalled file system). This option is
ignored for non-journalled file systems such as
ext2.
</longdesc>
<shortdesc lang="en">
Mount Options
</shortdesc>
<content type="string"/>
</parameter>
<parameter name="self_fence">
<longdesc lang="en">
If set and unmounting the file system fails, the node will
immediately reboot. Generally, this is used in conjunction
with force-unmount support, but it is not required.
</longdesc>
<shortdesc lang="en">
Seppuku Unmount
</shortdesc>
<content type="boolean"/>
</parameter>
<parameter name="fsid">
<longdesc lang="en">
File system ID for NFS exports. This can be overridden
in individual nfsclient entries.
</longdesc>
<shortdesc lang="en">
NFS File system ID
</shortdesc>
<content type="string"/>
</parameter>
<parameter name="nfslock" inherit="service%nfslock">
<longdesc lang="en">
If set, the node will try to kill lockd and issue
reclaims across all remaining network interface cards.
This happens always, regardless of unmounting failed.
</longdesc>
<shortdesc lang="en">
Enable NFS lock workarounds
</shortdesc>
<content type="boolean"/>
</parameter>
</parameters>
<actions>
<action name="start" timeout="900"/>
<action name="stop" timeout="30"/>
<!-- Recovery isn't possible; we don't know if resources are using
the file system. -->
<!-- Checks to see if it's mounted in the right place -->
<action name="status" interval="1m" timeout="10"/>
<action name="monitor" interval="1m" timeout="10"/>
<!-- Checks to see if we can read from the mountpoint -->
<action name="status" depth="10" timeout="30" interval="5m"/>
<action name="monitor" depth="10" timeout="30" interval="5m"/>
<!-- Checks to see if we can write to the mountpoint (if !ROFS) -->
<action name="status" depth="20" timeout="30" interval="10m"/>
<action name="monitor" depth="20" timeout="30" interval="10m"/>
<action name="meta-data" timeout="5"/>
<action name="validate-all" timeout="5"/>
</actions>
<special tag="rgmanager">
<child type="fs" start="1" stop="3"/>
<child type="clusterfs" start="1" stop="3"/>
<child type="nfsexport" start="3" stop="1"/>
</special>
</resource-agent>
EOT
}
verify_fstype()
{
# Auto detect?
[ -z "$OCF_RESKEY_fstype" ] && return $OCF_SUCCESS
case $OCF_RESKEY_fstype in
gfs|gfs2)
return $OCF_SUCCESS
;;
*)
ocf_log err "File system type $OCF_RESKEY_fstype not supported"
return $OCF_ERR_ARGS
;;
esac
}
verify_options()
{
declare -i ret=$OCF_SUCCESS
#
# From mount(8)
#
for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do
case $o in
async|atime|auto|defaults|dev|exec|_netdev|noatime)
continue
;;
noauto|nodev|noexec|nosuid|nouser|ro|rw|suid|sync)
continue
;;
dirsync|user|users)
continue
;;
esac
case $OCF_RESKEY_fstype in
gfs)
case $o in
lockproto=*|locktable=*|hostdata=*)
continue;
;;
localcaching|localflocks|ignore_local_fs)
continue;
;;
num_glockd|acl|suiddir)
continue
;;
esac
;;
gfs2)
# XXX
continue
;;
esac
ocf_log err "Option $o not supported for $OCF_RESKEY_fstype"
ret=$OCF_ERR_ARGS
done
return $ret
}
do_verify()
{
verify_name || return $OCF_ERR_ARGS
verify_fstype || return $OCF_ERR_ARGS
verify_device || return $OCF_ERR_ARGS
verify_mountpoint || return $OCF_ERR_ARGS
verify_options || return $OCF_ERR_ARGS
}
do_pre_unmount() {
#
# Check the rgmanager-supplied reference count if one exists.
# If the reference count is <= 1, we can safely proceed
#
if [ -n "$OCF_RESKEY_RGMANAGER_meta_refcnt" ]; then
refs=$OCF_RESKEY_RGMANAGER_meta_refcnt
if [ $refs -gt 0 ]; then
ocf_log debug "Not unmounting $OCF_RESOURCE_INSTANCE - still in use by $refs other service(s)"
return 2
fi
fi
if [ -z "$force_umount" ]; then
ocf_log debug "Not umounting $dev (clustered file system)"
return 2
fi
#
# Always do this hackery on clustered file systems.
#
if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
[ "$OCF_RESKEY_nfslock" = "1" ]; then
ocf_log warning "Dropping node-wide NFS locks"
mkdir -p $mp/.clumanager/statd
pkill -KILL -x lockd
# Copy out the notify list; our
# IPs are already torn down
if notify_list_store $mp/.clumanager/statd; then
notify_list_broadcast $mp/.clumanager/statd
fi
fi
# Always invalidate buffers on clusterfs resources
clubufflush -f $dev
return 0
}
main $*
|