common-ha: add node create new node dirs in shared storage

When adding a node to the ganesha HA cluster, create the directory
tree in shared storage for the added node and create sets of symlinks
to match what is/was created for the other nodes.  I.e. in a four
node cluster the new node needs a set of links to the four existing
nodes:
 /run/gluster/shared/nfs-ganesha/$new/nfs/{ganesha,statd}/$e1 -> e1
 /run/gluster/shared/nfs-ganesha/$new/nfs/{ganesha,statd}/$e2 -> e2
 /run/gluster/shared/nfs-ganesha/$new/nfs/{ganesha,statd}/$e3 -> e3
 /run/gluster/shared/nfs-ganesha/$new/nfs/{ganesha,statd}/$e4 -> e4
and all the existing nodes need links added for the new node:
 /run/gluster/shared/nfs-ganesha/$e1/nfs/{ganesha,statd}/$new -> new
 /run/gluster/shared/nfs-ganesha/$e2/nfs/{ganesha,statd}/$new -> new
 /run/gluster/shared/nfs-ganesha/$e3/nfs/{ganesha,statd}/$new -> new
 /run/gluster/shared/nfs-ganesha/$e5/nfs/{ganesha,statd}/$new -> new

Likewise when deleting, remove the dir and symlinks.

original change http://review.gluster.org/16036

BUG: 1400613
Change-Id: I52839046745728d06ab5a07f38081c032093bff6
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/16216
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: soumya k <skoduri@redhat.com>
This commit is contained in:
Kaleb S. KEITHLEY 2016-12-20 10:48:45 -05:00 committed by Kaleb KEITHLEY
parent 96fb356240
commit bc74dc62bb

View File

@ -733,7 +733,6 @@ setup_state_volume()
dirname=${1}${dname}
fi
if [ ! -d ${mnt}/nfs-ganesha/tickle_dir ]; then
mkdir ${mnt}/nfs-ganesha/tickle_dir
fi
@ -796,9 +795,6 @@ addnode_state_volume()
dirname=${newnode}${dname}
fi
if [ ! -d ${mnt}/nfs-ganesha/tickle_dir ]; then
mkdir ${mnt}/nfs-ganesha/tickle_dir
fi
if [ ! -d ${mnt}/nfs-ganesha/${dirname} ]; then
mkdir ${mnt}/nfs-ganesha/${dirname}
fi
@ -831,11 +827,14 @@ addnode_state_volume()
fi
for server in ${HA_SERVERS} ; do
ln -s ${mnt}/nfs-ganesha/${server}/nfs/ganesha ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/${server}
ln -s ${mnt}/nfs-ganesha/${server}/nfs/statd ${mnt}/nfs-ganesha/${dirname}/nfs/statd/${server}
ln -s ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha ${mnt}/nfs-ganesha/${server}/nfs/ganesha/${dirname}
ln -s ${mnt}/nfs-ganesha/${dirname}/nfs/statd ${mnt}/nfs-ganesha/${server}/nfs/statd/${dirname}
if [[ ${server} != ${dirname} ]]; then
ln -s ${mnt}/nfs-ganesha/${server}/nfs/ganesha ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/${server}
ln -s ${mnt}/nfs-ganesha/${server}/nfs/statd ${mnt}/nfs-ganesha/${dirname}/nfs/statd/${server}
ln -s ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha ${mnt}/nfs-ganesha/${server}/nfs/ganesha/${dirname}
ln -s ${mnt}/nfs-ganesha/${dirname}/nfs/statd ${mnt}/nfs-ganesha/${server}/nfs/statd/${dirname}
fi
done
}
@ -1061,8 +1060,9 @@ $HA_CONFDIR/ganesha-ha.conf
addnode_state_volume ${node}
HA_SERVERS="${HA_SERVERS} ${node}"
# addnode_create_resources() already appended ${node} to
# HA_SERVERS, so only need to increment HA_NUM_SERVERS
# and set quorum policy
HA_NUM_SERVERS=$(expr ${HA_NUM_SERVERS} + 1)
set_quorum_policy ${HA_NUM_SERVERS}
;;