Whamcloud - gitweb
LU-10866 pacemaker: Support additional mount options 36/31836/3
authorJeremy Filizetti <jeremy.filizetti@gmail.com>
Fri, 30 Mar 2018 11:28:03 +0000 (07:28 -0400)
committerOleg Drokin <green@whamcloud.com>
Thu, 10 Jan 2019 06:17:51 +0000 (06:17 +0000)
Add support for additional mount options for pacemaker resources.
Logging is also added for the output of the mount and umount commands.

Signed-off-by: Jeremy Filizetti <jeremy.filizetti@gmail.com>
Change-Id: Ideca8e37b12015b9f455634c85295137e00b97fd
Reviewed-on: https://review.whamcloud.com/31836
Reviewed-by: Nathaniel Clark <nclark@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Joe Grund <jgrund@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/conf/resource/Lustre

index cafb07b..fc251fe 100755 (executable)
@@ -22,6 +22,7 @@
 #               OCF parameters are as follows:
 #               OCF_RESKEY_target - the device or ZFS volume to mount/umount
 #               OCF_RESKEY_mountpoint - the mountpoint to use
+#               OCF_RESKEY_mountoptions - any mount options to use
 #######################################################################
 # Initialization:
 
@@ -76,6 +77,14 @@ The mount point where the Lustre target will be mounted.
 <content type="string" default="" />
 </parameter>
 
+<parameter name="mountoptions" unique="1" required="0">
+<longdesc lang="en">
+Any additional mount options for the Lustre target. (eg: "-o skpath=/path/to/keys")
+</longdesc>
+<shortdesc lang="en">Mount options for Lustre target</shortdesc>
+<content type="string" default="" />
+</parameter>
+
 </parameters>
 
 <actions>
@@ -121,11 +130,15 @@ lustre_mount () {
     if ! lustre_is_mounted; then
        ocf_log info "Starting to mount $OCF_RESKEY_target"
 
-       if mount -t lustre $OCF_RESKEY_target $OCF_RESKEY_mountpoint ; then
+       output=$(mount -t lustre $OCF_RESKEY_mountoptions $OCF_RESKEY_target $OCF_RESKEY_mountpoint 2>&1)
+       rc=$?
+       if [ $rc -eq 0 ]; then
            ocf_log info "$OCF_RESKEY_target mounted successfully"
+           [ -n "$output" ] && ocf_log info "$output"
            return $OCF_SUCCESS
        fi
-       ocf_log err "$OCF_RESKEY_volume mount failed"
+       ocf_log err "$OCF_RESKEY_target mount failed, rc=$rc"
+       ocf_log err "$output"
        return $OCF_ERR_GENERIC
     fi
     return $OCF_SUCCESS
@@ -135,11 +148,15 @@ lustre_umount () {
     if lustre_is_mounted; then
        ocf_log info "Starting to unmount $OCF_RESKEY_target"
 
-       if umount $OCF_RESKEY_mountpoint; then
+       output=$(umount $OCF_RESKEY_mountpoint 2>&1)
+       rc=$?
+       if [ $rc -eq 0 ]; then
            ocf_log info "$OCF_RESKEY_target unmounted successfully"
+           [ -n "$output" ] && ocf_log info "$output"
            return $OCF_SUCCESS
        fi
-       ocf_log err "$OCF_RESKEY_target unmount failed"
+       ocf_log err "$OCF_RESKEY_target unmount failed, rc=$rc"
+       ocf_log err "$output"
        return $OCF_ERR_GENERIC
     fi
     return $OCF_SUCCESS