diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2015-04-21 11:10:18 -0400 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-05-01 07:42:52 -0700 |
commit | 265fb714b0ef7ebfa9296ff0571502b7eb49eee5 (patch) | |
tree | 28d1deb4acf626f73e4c6ea7bc1cf03a1e1eb949 /extras/ganesha/ocf | |
parent | 539bbfad68939601c8666d16d7bc51e89321ebef (diff) |
common-ha: ganesha-ha.sh delete-node implementation
omnibus patch consisting of:
+ completed implemenation of delete-node (BZ 1213934 (master 1213933))
+ teardown leaves /var/lib/nfs symlink (BZ 1213927 (master 1210712))
+ setup copy config, teardown clean /etc/cluster (BZ 1214888 (master 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: I66e947538769c3c531cfdb89854997130ca5c05b
BUG: 1213934
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/10318
Tested-by: NetBSD Build System
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'extras/ganesha/ocf')
-rw-r--r-- | extras/ganesha/ocf/ganesha_grace | 3 | ||||
-rw-r--r-- | extras/ganesha/ocf/ganesha_nfsd | 63 |
2 files changed, 18 insertions, 48 deletions
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. <shortdesc lang="en">Manages the user-space nfs-ganesha NFS server</shortdesc> <parameters> -<parameter name="ha_vol_name"> -<longdesc lang="en">HA State Volume Name</longdesc> -<shortdesc lang="en">HA_State Volume Name</shortdesc> -<content type="string" default="" /> -</parameter> - <parameter name="ha_vol_mnt"> <longdesc lang="en">HA State Volume Mount Point</longdesc> <shortdesc lang="en">HA_State Volume Mount Point</shortdesc> <content type="string" default="" /> </parameter> - -<parameter name="ha_vol_server"> -<longdesc lang="en">HA State Volume Server</longdesc> -<shortdesc lang="en">HA_State Volume Server</shortdesc> -<content type="string" default="" /> -</parameter> </parameters> <actions> @@ -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 |