ctdb-scripts: Add config options for use by clustered NFS
authorJose A. Rivera <jarrpa@samba.org>
Fri, 29 Apr 2016 02:18:05 +0000 (21:18 -0500)
committerMartin Schwenke <martins@samba.org>
Fri, 13 May 2016 21:37:25 +0000 (23:37 +0200)
Add CTDB_NFS_STATE_FS_TYPE and CTDB_NFS_STATE_MNT config options, show use in
nfs-ganesha-callout. Since the callout script is only an example, we
officially don't have default values for these.

Signed-off-by: Jose A. Rivera <jarrpa@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/config/events.d/60.nfs
ctdb/doc/ctdbd.conf.5.xml
ctdb/doc/examples/nfs-ganesha-callout

index c25b73e0cd311febbcba48bbd4b0755e42633f95..57cfbffa2e95e051ed43ca6fb5cc1f563063ca6e 100755 (executable)
@@ -21,6 +21,14 @@ export CTDB_NFS_CALLOUT
 # If the callout wants to use this then it must create it
 export CTDB_NFS_CALLOUT_STATE_DIR="${service_state_dir}/callout-state"
 
+# Export, if set, for use by clustered NFS callouts
+if [ -n "$CTDB_NFS_STATE_FS_TYPE" ] ; then
+    export CTDB_NFS_STATE_FS_TYPE
+fi
+if [ -n "$CTDB_NFS_STATE_MNT" ] ; then
+    export CTDB_NFS_STATE_MNT
+fi
+
 nfs_callout_cache="${service_state_dir}/nfs_callout_cache"
 nfs_callout_cache_callout="${nfs_callout_cache}/CTDB_NFS_CALLOUT"
 nfs_callout_cache_ops="${nfs_callout_cache}/ops"
index a364c9f0fc17f712277963ffbc80e8d1bd8eeb45..f69f705c6e10ce7b22cc5185079c1029b930dd94 100644 (file)
@@ -1061,19 +1061,6 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
 
       <variablelist>
 
-       <varlistentry>
-         <term>CTDB_CLUSTER_FILESYSTEM_TYPE=gpfs</term>
-         <listitem>
-           <para>
-             The type of cluster filesystem to use with NFS-ganesha.
-             Currently only "gpfs" is supported.
-           </para>
-           <para>
-             Default is "gpfs".
-           </para>
-         </listitem>
-       </varlistentry>
-
        <varlistentry>
          <term>CTDB_MANAGES_NFS=yes|no</term>
          <listitem>
@@ -1148,6 +1135,26 @@ CTDB_PER_IP_ROUTING_TABLE_ID_HIGH=9000
          </listitem>
        </varlistentry>
 
+       <varlistentry>
+         <term>CTDB_NFS_STATE_FS_TYPE=<parameter>TYPE</parameter></term>
+         <listitem>
+           <para>
+             The type of filesystem used for a clustered NFS' shared
+             state. No default.
+           </para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
+         <term>CTDB_NFS_STATE_MNT=<parameter>DIR</parameter></term>
+         <listitem>
+           <para>
+             The directory where a clustered NFS' shared state will be
+             located. No default.
+           </para>
+         </listitem>
+       </varlistentry>
+
       </variablelist>
 
     </refsect2>
index 80bba898f179bf0102f1b2e14e99b9c02e047eab..06d08ad00e3ae7e37bde09464852659b25ccc6f7 100755 (executable)
 # Exit on 1st error
 set -e
 
+# Filesystem type and mount point for the (typically clustered)
+# volume that will contain the NFS-Ganesha state.
+state_fs="${CTDB_NFS_STATE_FS_TYPE:-gpfs}"
+state_dir="${CTDB_NFS_STATE_MNT}" # No sane default.
+
 # To change the following, edit the default values below.  Do not set
 # these - they aren't configuration variables, just hooks for testing.
 nfs_exports_file="${CTDB_NFS_EXPORTS_FILE:-/etc/ganesha/ganesha.conf}"
@@ -46,10 +51,6 @@ nfs_service="${CTDB_NFS_SERVICE:-nfs-ganesha}"
 ganesha_rec_subdir=${CTDB_GANESHA_REC_SUBDIR:-.ganesha}
 procfs=${PROCFS_PATH:-/proc}
 
-if [ -z "$CTDB_CLUSTER_FILESYSTEM_TYPE" ] ; then
-    CTDB_CLUSTER_FILESYSTEM_TYPE="gpfs"
-fi
-
 
 ##################################################
 
@@ -151,12 +152,12 @@ check_ln ()
 # Return 'active' if the shared filesystem is accessible.
 get_cluster_fs_state ()
 {
-    case $CTDB_CLUSTER_FILESYSTEM_TYPE in
+    case $state_fs in
         gpfs)
             /usr/lpp/mmfs/bin/mmgetstate | awk 'NR == 4 { print $3 }'
             ;;
         *)
-            echo "File system $CTDB_CLUSTER_FILESYSTEM_TYPE not supported"
+            echo "File system $state_fs not supported"
             exit 1
             ;;
    esac
@@ -164,9 +165,9 @@ get_cluster_fs_state ()
 
 create_ganesha_recdirs ()
 {
-    _mounts=$(mount -t $CTDB_CLUSTER_FILESYSTEM_TYPE)
+    _mounts=$(mount -t $state_fs)
     if [ -z "$_mounts" ]; then
-      echo "startup $CTDB_CLUSTER_FILESYSTEM_TYPE not ready"
+      echo "startup $state_fs not ready"
       exit 0
     fi
     _mntpt=$(echo "$_mounts" | sort | awk 'NR == 1 {print $3}')