From d28a99d6f20650e5d78accb1e16bd3721a2b6d02 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Tue, 14 Apr 2015 08:17:10 -0400 Subject: common-ha: delete-node implementation omnibus patch consisting of: + completed implemenation of delete-node (BZ 1212823) + teardown leaves /var/lib/nfs symlink (BZ 1210712) + setup copy config, teardown clean /etc/cluster (BZ 1212823) setup for copy config, teardown clean /etc/cluster: 1. on one (primary) node in the cluster, run: `ssh-keygen -f /var/lib/glusterd/nfs/secret.pem` Press Enter twice to avoid passphrase. 2. deploy the pubkey ~root/.ssh/authorized keys on _all_ nodes, run: `ssh-copy-id -i /var/lib/glusterd/nfs/secret.pem.pub root@$node` 3. copy the keys to _all_ nodes in the cluster, run: `scp /var/lib/glusterd/nfs/secret.* $node:/var/lib/glusterd/nfs/` N.B. this allows setup, teardown, etc., to be run on any node Change-Id: I9fcd3a57073ead24cd2d0ef0ee7a67c524f3d4b0 BUG: 1213933 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/10234 Reviewed-by: Niels de Vos Reviewed-by: soumya k Tested-by: Gluster Build System --- extras/ganesha/ocf/ganesha_grace | 3 ++ extras/ganesha/ocf/ganesha_nfsd | 63 ++++++++++------------------------------ 2 files changed, 18 insertions(+), 48 deletions(-) (limited to 'extras/ganesha/ocf') diff --git a/extras/ganesha/ocf/ganesha_grace b/extras/ganesha/ocf/ganesha_grace index 397b0abdeab..dceaccf5e77 100644 --- a/extras/ganesha/ocf/ganesha_grace +++ b/extras/ganesha/ocf/ganesha_grace @@ -135,6 +135,9 @@ ganesha_grace_stop() ganesha_grace_monitor() { # logger "ganesha_grace_monitor()" + if [ ! -d /var/run/ganesha ]; then + mkdir -p /var/run/ganesha + fi pcs status | grep dead_ip-1 | sort > /var/run/ganesha/pcs_status return $OCF_SUCCESS } diff --git a/extras/ganesha/ocf/ganesha_nfsd b/extras/ganesha/ocf/ganesha_nfsd index 2c0b32c7817..d69b9f4ad47 100644 --- a/extras/ganesha/ocf/ganesha_nfsd +++ b/extras/ganesha/ocf/ganesha_nfsd @@ -51,23 +51,11 @@ resource agent for nfs-ganesha. Manages the user-space nfs-ganesha NFS server - -HA State Volume Name -HA_State Volume Name - - - HA State Volume Mount Point HA_State Volume Mount Point - - -HA State Volume Server -HA_State Volume Server - - @@ -106,34 +94,16 @@ ganesha_nfsd_start() ganesha_nfsd_stop() { - local mounted="" - local mntptinuse="" - local instance_host="" - local short_host="" - local resource_prefix=${OCF_RESOURCE_INSTANCE:0:9} + local short_host=$(hostname -s) + local long_host="" - if [ "X${resource_prefix}X" = "Xnfs_startX" ]; then + if [ "X${OCF_RESOURCE_INSTANCE:0:9}X" = "Xnfs_startX" ]; then - mounted=$(mount | grep $OCF_RESKEY_ha_vol_name) - mntptinuse=$(mount | grep -o $OCF_RESKEY_ha_vol_mnt) - short_host=$(hostname -s) + # if this is any nfs_start, go ahead. worst case we + # find the link already exists and do nothing long_host=$(hostname) - if [[ ! ${mounted} ]]; then - - if [ -d $OCF_RESKEY_ha_vol_mnt ]; then - if [[ ${mntptinuse} ]]; then - return $OCF_ERR_GENERIC - fi - else - mkdir ${mntpt} - fi - - mount -t glusterfs $OCF_RESKEY_ha_vol_server:$OCF_RESKEY_ha_vol_name $OCF_RESKEY_ha_vol_mnt - if [ $? -ne 0 ]; then - logger "warning: mount -t glusterfs $OCF_RESKEY_ha_vol_server:$OCF_RESKEY_ha_vol_name $OCF_RESKEY_ha_vol_mnt failed" - fi - + if [ -d /var/lib/nfs ]; then mv /var/lib/nfs /var/lib/nfs.backup ln -s $OCF_RESKEY_ha_vol_mnt/${long_host}/nfs /var/lib/nfs if [ $? -ne 0 ]; then @@ -141,20 +111,17 @@ ganesha_nfsd_stop() fi fi - - service nfs-ganesha start - if [ $? -ne 0 ]; then - logger "warning: service nfs-ganesha start failed" - fi else - umount $OCF_RESKEY_ha_vol_mnt - if [ $? -ne 0 ]; then - logger "warning: umount $OCF_RESKEY_ha_vol_mnt failed" - fi - service nfs-ganesha stop - if [ $? -ne 0 ]; then - logger "warning: service nfs-ganesha stop failed" + # if this is a clone resource or is specific to this node + # remove the symlink and restore /var/lib/nfs + + if [ "X${OCF_RESOURCE_INSTANCE}X" = "Xnfs_stopX" ] || + [ "X${OCF_RESOURCE_INSTANCE}X" = "Xnfs_stop-${short_host}X" ]; then + if [ -L /var/lib/nfs -a -d /var/lib/nfs.backup ]; then + rm -f /var/lib/nfs + mv /var/lib/nfs.backup /var/lib/nfs + fi fi fi -- cgit