a3470f
From 281f33b36d3ac39869c313e5c6ba4909ae2d74e0 Mon Sep 17 00:00:00 2001
a3470f
From: Anoop C S <anoopcs@redhat.com>
a3470f
Date: Wed, 25 Oct 2017 12:21:12 +0530
a3470f
Subject: [PATCH 096/128] extras/hooks: Honour all input arguments to scripts
a3470f
a3470f
Some of the hook scripts were not honouring the arguments with which
a3470f
they are invoked during various volume operations. So make sure that
a3470f
we consider everything while parsing the command line arguments to
a3470f
avoid following warnings:
a3470f
a3470f
. . .
a3470f
ame: unrecognized option '--first=no'
a3470f
ame: unrecognized option '--version=1'
a3470f
ame: unrecognized option '--volume-op=start'
a3470f
. . .
a3470f
a3470f
> Change-Id: I5b08e5e7f32908c8509e97098a042096b507783e
a3470f
> BUG: 1503983
a3470f
> Upstream: https://review.gluster.org/#/c/18569/
a3470f
a3470f
Change-Id: I5b08e5e7f32908c8509e97098a042096b507783e
a3470f
BUG: 1444820
a3470f
Signed-off-by: Anoop C S <anoopcs@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/124642
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
a3470f
---
a3470f
 extras/hook-scripts/start/post/S29CTDBsetup.sh   | 32 ++++++++++++++++++------
a3470f
 extras/hook-scripts/start/post/S30samba-start.sh | 18 ++++++++++++-
a3470f
 extras/hook-scripts/stop/pre/S29CTDB-teardown.sh | 18 +++++++------
a3470f
 extras/hook-scripts/stop/pre/S30samba-stop.sh    | 30 +++++++++++++---------
a3470f
 4 files changed, 70 insertions(+), 28 deletions(-)
a3470f
a3470f
diff --git a/extras/hook-scripts/start/post/S29CTDBsetup.sh b/extras/hook-scripts/start/post/S29CTDBsetup.sh
a3470f
index 330ce74..54a4c0c 100755
a3470f
--- a/extras/hook-scripts/start/post/S29CTDBsetup.sh
a3470f
+++ b/extras/hook-scripts/start/post/S29CTDBsetup.sh
a3470f
@@ -9,10 +9,14 @@ CTDB_MNT=/gluster/lock
a3470f
 # Make sure ping-timeout is not default for CTDB volume
a3470f
 PING_TIMEOUT_SECS=10
a3470f
 PROGNAME="ctdb"
a3470f
-OPTSPEC="volname:"
a3470f
+OPTSPEC="volname:,gd-workdir:,version:,volume-op:,first:"
a3470f
 HOSTNAME=`hostname`
a3470f
 MNTOPTS="_netdev,transport=tcp,xlator-option=*client*.ping-timeout=${PING_TIMEOUT_SECS}"
a3470f
 VOL=
a3470f
+GLUSTERD_WORKDIR=
a3470f
+VERSION=
a3470f
+VOLUME_OP=
a3470f
+FIRST=
a3470f
 # $META is the volume that will be used by CTDB as a shared filesystem.
a3470f
 # It is not desirable to use this volume for storing 'data' as well.
a3470f
 # META is set to 'all' (viz. a keyword and hence not a legal volume name)
a3470f
@@ -29,13 +33,27 @@ function parse_args () {
a3470f
                 --volname)
a3470f
                     shift
a3470f
                     VOL=$1
a3470f
-                ;;
a3470f
-
a3470f
+                    ;;
a3470f
+                --gd-workdir)
a3470f
+                    shift
a3470f
+                    GLUSTERD_WORKDIR=$1
a3470f
+                    ;;
a3470f
+                --version)
a3470f
+                    shift
a3470f
+                    VERSION=$1
a3470f
+                    ;;
a3470f
+                --volume-op)
a3470f
+                    shift
a3470f
+                    VOLUME_OP=$1
a3470f
+                    ;;
a3470f
+                --first)
a3470f
+                    shift
a3470f
+                    FIRST=$1
a3470f
+                    ;;
a3470f
                 *)
a3470f
-                     shift
a3470f
-                     break
a3470f
-                ;;
a3470f
-
a3470f
+                    shift
a3470f
+                    break
a3470f
+                    ;;
a3470f
             esac
a3470f
 
a3470f
             shift
a3470f
diff --git a/extras/hook-scripts/start/post/S30samba-start.sh b/extras/hook-scripts/start/post/S30samba-start.sh
a3470f
index d6b94e6..a448dbd 100755
a3470f
--- a/extras/hook-scripts/start/post/S30samba-start.sh
a3470f
+++ b/extras/hook-scripts/start/post/S30samba-start.sh
a3470f
@@ -21,12 +21,15 @@
a3470f
 #volume.
a3470f
 
a3470f
 PROGNAME="Ssamba-start"
a3470f
-OPTSPEC="volname:,gd-workdir:"
a3470f
+OPTSPEC="volname:,gd-workdir:,version:,volume-op:,first:"
a3470f
 VOL=
a3470f
 CONFIGFILE=
a3470f
 LOGFILEBASE=
a3470f
 PIDDIR=
a3470f
 GLUSTERD_WORKDIR=
a3470f
+VERSION=
a3470f
+VOLUME_OP=
a3470f
+FIRST=
a3470f
 
a3470f
 function parse_args () {
a3470f
         ARGS=$(getopt -l $OPTSPEC  -name $PROGNAME "$@")
a3470f
@@ -42,11 +45,24 @@ function parse_args () {
a3470f
                     shift
a3470f
                     GLUSTERD_WORKDIR=$1
a3470f
                     ;;
a3470f
+                --version)
a3470f
+                    shift
a3470f
+                    VERSION=$1
a3470f
+                    ;;
a3470f
+                --volume-op)
a3470f
+                    shift
a3470f
+                    VOLUME_OP=$1
a3470f
+                    ;;
a3470f
+                --first)
a3470f
+                    shift
a3470f
+                    FIRST=$1
a3470f
+                    ;;
a3470f
                 *)
a3470f
                     shift
a3470f
                     break
a3470f
                     ;;
a3470f
             esac
a3470f
+
a3470f
             shift
a3470f
         done
a3470f
 }
a3470f
diff --git a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
a3470f
index e9116c8..12f49da 100755
a3470f
--- a/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
a3470f
+++ b/extras/hook-scripts/stop/pre/S29CTDB-teardown.sh
a3470f
@@ -2,8 +2,9 @@
a3470f
 
a3470f
 CTDB_MNT=/gluster/lock
a3470f
 PROGNAME="ctdb"
a3470f
-OPTSPEC="volname:"
a3470f
+OPTSPEC="volname:,last:"
a3470f
 VOL=
a3470f
+LAST=
a3470f
 # $META is the volume that will be used by CTDB as a shared filesystem.
a3470f
 # It is not desirable to use this volume for storing 'data' as well.
a3470f
 # META is set to 'all' (viz. a keyword and hence not a legal volume name)
a3470f
@@ -20,15 +21,16 @@ function parse_args () {
a3470f
                 --volname)
a3470f
                     shift
a3470f
                     VOL=$1
a3470f
-                ;;
a3470f
-
a3470f
+                    ;;
a3470f
+                --last)
a3470f
+                    shift
a3470f
+                    LAST=$1
a3470f
+                    ;;
a3470f
                 *)
a3470f
-                     shift
a3470f
-                     break
a3470f
-                ;;
a3470f
-
a3470f
+                    shift
a3470f
+                    break
a3470f
+                    ;;
a3470f
             esac
a3470f
-
a3470f
             shift
a3470f
         done
a3470f
 }
a3470f
diff --git a/extras/hook-scripts/stop/pre/S30samba-stop.sh b/extras/hook-scripts/stop/pre/S30samba-stop.sh
a3470f
index 6e542da..a5c8dd5 100755
a3470f
--- a/extras/hook-scripts/stop/pre/S30samba-stop.sh
a3470f
+++ b/extras/hook-scripts/stop/pre/S30samba-stop.sh
a3470f
@@ -16,27 +16,33 @@
a3470f
 #event by removing the volume related entries(if any) in smb.conf file.
a3470f
 
a3470f
 PROGNAME="Ssamba-stop"
a3470f
-OPTSPEC="volname:"
a3470f
+OPTSPEC="volname:,last:"
a3470f
 VOL=
a3470f
 CONFIGFILE=
a3470f
 PIDDIR=
a3470f
+LAST=
a3470f
 
a3470f
 function parse_args () {
a3470f
         ARGS=$(getopt -l $OPTSPEC  -name $PROGNAME "$@")
a3470f
         eval set -- "$ARGS"
a3470f
 
a3470f
         while true; do
a3470f
-        case $1 in
a3470f
-        --volname)
a3470f
-         shift
a3470f
-         VOL=$1
a3470f
-         ;;
a3470f
-        *)
a3470f
-         shift
a3470f
-         break
a3470f
-         ;;
a3470f
-        esac
a3470f
-        shift
a3470f
+            case $1 in
a3470f
+                --volname)
a3470f
+                    shift
a3470f
+                    VOL=$1
a3470f
+                    ;;
a3470f
+                --last)
a3470f
+                    shift
a3470f
+                    LAST=$1
a3470f
+                    ;;
a3470f
+                *)
a3470f
+                    shift
a3470f
+                    break
a3470f
+                    ;;
a3470f
+            esac
a3470f
+
a3470f
+            shift
a3470f
         done
a3470f
 }
a3470f
 
a3470f
-- 
a3470f
1.8.3.1
a3470f