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