Blob Blame History Raw
From d80f5af26ee4bcc244d40a3587904a89cf1c5bd1 Mon Sep 17 00:00:00 2001
From: Avra Sengupta <asengupt@redhat.com>
Date: Wed, 17 Jun 2015 15:00:23 +0530
Subject: [PATCH 105/129] gluster/shared_storage: Add/Remove shared storage from /etc/fstab during enable/disable

While creating/deleting shared storage volume, add/remove the shared storage
entry from /etc/fstab, so as to ensure availability of the shared storage,
even after a node reboot

>Reviewed-on: http://review.gluster.org/11272/
Change-Id: Ib9edc8fd02c74a677062ca53ffd10be997b056c6
BUG: 1231223
Signed-off-by: Avra Sengupta <asengupt@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/51101
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
---
 .../set/post/S32gluster_enable_shared_storage.sh   |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh b/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
index 28fa0e5..68bc44d 100755
--- a/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
+++ b/extras/hook-scripts/set/post/S32gluster_enable_shared_storage.sh
@@ -80,6 +80,8 @@ done
 if [ "$option" == "disable" ]; then
     # Unmount the volume on all the nodes
     umount /var/run/gluster/shared_storage
+    cat /etc/fstab  | grep -v "gluster_shared_storage /var/run/gluster/shared_storage/" > /var/run/gluster/fstab.tmp
+    mv /var/run/gluster/fstab.tmp /etc/fstab
 fi
 
 if [ "$is_originator" == 1 ]; then
@@ -121,4 +123,7 @@ if [ "$option" == "enable" ]; then
     umount /var/run/gluster/shared_storage
     mkdir -p /var/run/gluster/shared_storage
     $mount_cmd
+    cp /etc/fstab /var/run/gluster/fstab.tmp
+    echo "$local_node_hostname:/gluster_shared_storage /var/run/gluster/shared_storage/ glusterfs defaults        0 0" >> /var/run/gluster/fstab.tmp
+    mv /var/run/gluster/fstab.tmp /etc/fstab
 fi
-- 
1.7.1