Il giorno Mar 01 Giu 2010 11:33:39 CET, RaSca ha scritto:
[...]
I patched the script to do a nfsd restart, based upon what the RA
nfsserver do. In this way, things works, but seems a little bit ugly...
I'm going to do some tests and then post the patch.
The patch is attached. It works, even if the solution appears to me a
little bit ugly :-)
Some notes: there is a new parameter named nfs_init_script, which by
default is /etc/init.d/nfs-kernel-server.
This nfs_init_script is used by the RA to restart the nfs daemon on the
stop operation.
When the resource is migrated, the script removes the export with
exportfs -u and then restarts the nfsd daemon.
Note that if you have two exportfs resources on the same node, i.e.
share-a-exportfs and share-b-exportfs, and you force the migration of
only share-a-exportfs, then share-b-exportfs will fail: his monitor will
not see the nfsd for a while because this is being restarted by
share-a-exportfs. Then resource share-b-exportfs will be immediately
restarted, and share-a-exportfs will be activated on the other node.
Finally, the migration will be successfully completed.
If you have any kind of suggestion to make this look better, you're welcome.
Thanks,
--
RaSca
Mia Mamma Usa Linux: Niente รจ impossibile da capire, se lo spieghi bene!
[email protected]
http://www.miamammausalinux.org
--- exportfs 2010-06-01 16:55:59.000000000 +0200
+++ exportfs.patched 2010-06-01 16:59:43.000000000 +0200
@@ -9,6 +9,7 @@
# License: GNU General Public License v2 (GPLv2) and later
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat}
+: ${OCF_RESKEY_nfs_init_script="$NFSD_DEFAULT_INIT_SCRIPT"}
. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs
exportfs_meta_data() {
@@ -74,6 +75,17 @@
<content type="integer" />
</parameter>
+<parameter name="nfs_init_script" unique="0" required="0">
+<longdesc lang="en">
+The default init script shipped with the Linux distro.
+When the exportfs resource agent is stopped, it must also restart the nfsd process, so that every filesystem mountend by clients is unlocked.
+</longdesc>
+<shortdesc lang="en">
+Init script for nfs kernel server
+</shortdesc>
+<content type="string" default="${NFSD_DEFAULT_INIT_SCRIPT}" />
+</parameter>
+
</parameters>
<actions>
@@ -188,7 +200,16 @@
if [ $rc -eq 0 ]; then
ocf_log info "Un-exported file system"
- return $OCF_SUCCESS
+
+ ocf_log info "Restarting nfs daemon using ${OCF_RESKEY_nfs_init_script} ..."
+
+ ${OCF_RESKEY_nfs_init_script} restart
+ rc=$?
+
+ if [ $rc -eq 0 ]; then
+ ocf_log info "Restarted nfs daemon"
+ return $OCF_SUCCESS
+ fi
fi
ocf_log err "Failed to un-export file system"
@@ -238,6 +259,7 @@
RMTAB=/var/lib/nfs/rmtab
PIDF=${OCF_RESKEY_directory}/.exportfs_backup.pid
FS_RMTAB=${OCF_RESKEY_directory}/.rmtab
+NFSD_DEFAULT_INIT_SCRIPT=/etc/init.d/nfs-kernel-server
case $__OCF_ACTION in
meta-data) exportfs_meta_data
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems