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