|
|
3604df |
From 0f9d6d107b045a1d73d8b1e6c5b974e54559de94 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
Date: Mon, 28 Nov 2016 19:18:51 +0530
|
|
|
3604df |
Subject: [PATCH 221/227] ganesha/scripts : avoid incrementing Export Id value
|
|
|
3604df |
for already exported volumes
|
|
|
3604df |
|
|
|
3604df |
Currently a volume will unexport when it stops and reexport it during volume start
|
|
|
3604df |
using hook script. And also it increments the value for export id for each reexport.
|
|
|
3604df |
Since a hook script is called from every node parallely which may led inconsistency
|
|
|
3604df |
for export id value.
|
|
|
3604df |
|
|
|
3604df |
Upstream reference
|
|
|
3604df |
>Change-Id: Ib9f19a3172b2ade29a3b4edc908b3267c68c0b20
|
|
|
3604df |
>BUG: 1399186
|
|
|
3604df |
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/15948
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: soumya k <skoduri@redhat.com>
|
|
|
3604df |
>Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
|
|
|
3604df |
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I2167aca1216af371c9626cd19de72446b6304303
|
|
|
3604df |
BUG: 1398257
|
|
|
3604df |
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/92001
|
|
|
3604df |
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
extras/hook-scripts/start/post/S31ganesha-start.sh | 42 ++++++----------------
|
|
|
3604df |
1 file changed, 10 insertions(+), 32 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/extras/hook-scripts/start/post/S31ganesha-start.sh b/extras/hook-scripts/start/post/S31ganesha-start.sh
|
|
|
3604df |
index 1bbeeab..0e98ec2 100755
|
|
|
3604df |
--- a/extras/hook-scripts/start/post/S31ganesha-start.sh
|
|
|
3604df |
+++ b/extras/hook-scripts/start/post/S31ganesha-start.sh
|
|
|
3604df |
@@ -60,45 +60,15 @@ echo " SecType = \"sys\";"
|
|
|
3604df |
echo "}"
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
-#This function keeps track of export IDs and increments it with every new entry
|
|
|
3604df |
-#Also it adds the export dynamically by sending dbus signals
|
|
|
3604df |
+#It adds the export dynamically by sending dbus signals
|
|
|
3604df |
function export_add()
|
|
|
3604df |
{
|
|
|
3604df |
- count=`ls -l $GANESHA_DIR/exports/*.conf | wc -l`
|
|
|
3604df |
- if [ "$count" = "1" ] ;
|
|
|
3604df |
- then
|
|
|
3604df |
- EXPORT_ID=2
|
|
|
3604df |
- else
|
|
|
3604df |
- #if [ -s /var/lib/ganesha/export_removed ];
|
|
|
3604df |
- # then
|
|
|
3604df |
- # EXPORT_ID=`head -1 /var/lib/ganesha/export_removed`
|
|
|
3604df |
- # sed -i -e "1d" /var/lib/ganesha/export_removed
|
|
|
3604df |
- # else
|
|
|
3604df |
-
|
|
|
3604df |
- EXPORT_ID=`cat $GANESHA_DIR/.export_added`
|
|
|
3604df |
- EXPORT_ID=EXPORT_ID+1
|
|
|
3604df |
- #fi
|
|
|
3604df |
- fi
|
|
|
3604df |
- echo $EXPORT_ID > $GANESHA_DIR/.export_added
|
|
|
3604df |
- sed -i s/Export_Id.*/"Export_Id=$EXPORT_ID;"/ \
|
|
|
3604df |
-$GANESHA_DIR/exports/export.$VOL.conf
|
|
|
3604df |
- echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF1
|
|
|
3604df |
-
|
|
|
3604df |
dbus-send --print-reply --system --dest=org.ganesha.nfsd \
|
|
|
3604df |
/org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.AddExport \
|
|
|
3604df |
string:$GANESHA_DIR/exports/export.$VOL.conf string:"EXPORT(Export_Id=$EXPORT_ID)"
|
|
|
3604df |
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
-function start_ganesha()
|
|
|
3604df |
-{
|
|
|
3604df |
- #Remove export entry from nfs-ganesha.conf
|
|
|
3604df |
- sed -i /$VOL.conf/d $CONF1
|
|
|
3604df |
- #Create a new export entry
|
|
|
3604df |
- export_add $VOL
|
|
|
3604df |
-
|
|
|
3604df |
-}
|
|
|
3604df |
-
|
|
|
3604df |
# based on src/scripts/ganeshactl/Ganesha/export_mgr.py
|
|
|
3604df |
function is_exported()
|
|
|
3604df |
{
|
|
|
3604df |
@@ -133,9 +103,17 @@ if ganesha_enabled ${VOL} && ! is_exported ${VOL}
|
|
|
3604df |
then
|
|
|
3604df |
if [ ! -e ${GANESHA_DIR}/exports/export.${VOL}.conf ]
|
|
|
3604df |
then
|
|
|
3604df |
+ #Remove export entry from nfs-ganesha.conf
|
|
|
3604df |
+ sed -i /$VOL.conf/d $CONF1
|
|
|
3604df |
write_conf ${VOL} > ${GANESHA_DIR}/exports/export.${VOL}.conf
|
|
|
3604df |
+ EXPORT_ID=`cat $GANESHA_DIR/.export_added`
|
|
|
3604df |
+ EXPORT_ID=EXPORT_ID+1
|
|
|
3604df |
+ echo $EXPORT_ID > $GANESHA_DIR/.export_added
|
|
|
3604df |
+ sed -i s/Export_Id.*/"Export_Id=$EXPORT_ID;"/ \
|
|
|
3604df |
+ $GANESHA_DIR/exports/export.$VOL.conf
|
|
|
3604df |
+ echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF1
|
|
|
3604df |
fi
|
|
|
3604df |
- start_ganesha ${VOL}
|
|
|
3604df |
+ export_add $VOL
|
|
|
3604df |
fi
|
|
|
3604df |
|
|
|
3604df |
exit 0
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|