summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
authorJiffin Tony Thottan <jthottan@redhat.com>2017-06-30 17:11:46 +0530
committerKaleb KEITHLEY <kkeithle@redhat.com>2017-07-17 11:41:00 +0000
commit4c410a46ef58512ba751db8750910a6d09ec3696 (patch)
treeded526b909699e493f6d9d371fb8c4e9295859ca /extras
parentcc8bf4bb291870e3d98d25f1e2d08856be889d8d (diff)
systemd/glusterfssharedstorage : remove dependency for var-run-gluster-shared_storage
Currently the script used by glusterfssharedstorage have dependency over var-run-gluster-shared_storage. But this service will be present only if node has rebooted. Also in reboot scenario , there is a chance that this service can be executed before creating var-run-gluster-shared_storage. In that case glusterfssharedstorage will get succeed even without mounting the shared storage Also the type of glusterfssharedstorage changed to "forking" so that it can be active(instead of dead) after the successful start. Change-Id: I1c02cc64946e534d845aa7ec7b72644bbe4d26f9 BUG: 1452527 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: https://review.gluster.org/17658 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'extras')
-rwxr-xr-xextras/mount-shared-storage.sh43
-rw-r--r--extras/systemd/glusterfssharedstorage.service.in1
2 files changed, 22 insertions, 22 deletions
diff --git a/extras/mount-shared-storage.sh b/extras/mount-shared-storage.sh
index 038a59aaabf..3645a0f42fd 100755
--- a/extras/mount-shared-storage.sh
+++ b/extras/mount-shared-storage.sh
@@ -4,34 +4,33 @@
#try to mount the shared storage if it fails
#TODO : Do it for other glusterfs clients in /etc/fstab
-ms="var-run-gluster-shared_storage.mount"
volume="gluster_shared_storage"
-failed=$(systemctl --failed | grep -c $ms)
-if [ $failed -eq 1 ]
+mp="/var/run/gluster/shared_storage"
+#check if there is fstab entry for shared storage
+gfc=$(sed -e 's/#.$//' </etc/fstab | grep -c $volume)
+if [ $gfc -eq 0 ]
then
- if systemctl restart $ms
- then
- #Restart worked just wait for sometime to make it reflect
- sleep 5
- else
- #Restart failed, no point in further continuing
- exit 1
- fi
+ exit 0
fi
-# If we've reached this point, there wasn't a failed mountpoint
-# BUT we need to check for whether this haven't been called before the attempts
-# to the filesystem mounts, thus we need to check whether there is a glusterfs
-# in fstab and aren't mountedmount
+#check whether shared storage is mounted
+#if it is mounted then mount has inode value 1
+inode=$(ls -id $mp | awk '{print $1}')
-#In the logs I've seen ~4-5secs between the initial mount/start and the unmount
+if [ $inode -eq 1 ]
+then
+ exit 0
+fi
-gfc=$(sed -e 's/#.$//' </etc/fstab | grep -c $volume)
-gfm=$(grep -i $volume /proc/mounts | wc -l)
+mount -t glusterfs localhost:/$volume $mp
+#wait for few seconds
+sleep 5
-if [ $gfm -lt $gfc ]
+#recheck mount got succeed
+inode=$(ls -id $mp | awk '{print $1}')
+if [ $inode -eq 1 ]
then
- exit 1
+ exit 0
+else
+ exit 1
fi
-
-exit 0
diff --git a/extras/systemd/glusterfssharedstorage.service.in b/extras/systemd/glusterfssharedstorage.service.in
index 3bceba84215..723ff49afb7 100644
--- a/extras/systemd/glusterfssharedstorage.service.in
+++ b/extras/systemd/glusterfssharedstorage.service.in
@@ -3,6 +3,7 @@ Description=Mount glusterfs sharedstorage
Requires=glusterd.service remote-fs-pre.target local-fs.target
[Service]
+Type=forking
ExecStart=@GLUSTERFS_LIBEXECDIR@/mount-shared-storage.sh
Restart=on-failure
RestartSec=3