From b29c3ec63fa6520bcf169581d0dac6602fed2993 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Mon, 14 Nov 2016 11:24:33 -0500 Subject: common-ha: remove /etc/corosync/corosync.conf in teardown/cleanup In newer versions of corosync we observe that after tearing down an existing HA cluster, when trying to set up a new cluster, `pcs cluster start --all` will fail if corosync believes the nodes are already in the cluster based on the presence of, and the contents of /etc/corosync/corosync.conf So we summarily delete it. (An alternative/work-around is to use `pcs cluster start --force --all`) Change-Id: I225f4e35e3b605e860ec4f9537c40ed94ac68625 BUG: 1394883 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/15845 Smoke: Gluster Build System Reviewed-by: soumya k CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System --- extras/ganesha/scripts/ganesha-ha.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'extras') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index 8b55abbc6c5..44458d5da00 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -416,12 +416,13 @@ teardown_cluster() cleanup_ganesha_config () { - rm -rf ${HA_CONFDIR}/exports/*.conf - rm -rf ${HA_CONFDIR}/.export_added - rm -rf /etc/cluster/cluster.conf* - rm -rf /var/lib/pacemaker/cib/* - sed -r -i -e '/^%include[[:space:]]+".+\.conf"$/d' ${GANESHA_CONF} - rm -rf ${HA_VOL_MNT}/nfs-ganesha + rm -rf ${HA_CONFDIR}/exports/*.conf + rm -rf ${HA_CONFDIR}/.export_added + rm -rf /etc/cluster/cluster.conf* + rm -rf /var/lib/pacemaker/cib/* + rm -f /etc/corosync/corosync.conf + sed -r -i -e '/^%include[[:space:]]+".+\.conf"$/d' ${GANESHA_CONF} + rm -rf ${HA_VOL_MNT}/nfs-ganesha } do_create_virt_ip_constraints() @@ -889,6 +890,8 @@ main() teardown_resources ${HA_SERVERS} teardown_cluster ${HA_NAME} + + cleanup_ganesha_config ${HA_CONFDIR} ;; cleanup | --cleanup) -- cgit From 16e45f014409a7a625a7638b99f6a56a49bee004 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Fri, 11 Nov 2016 08:19:03 -0500 Subject: common-ha: nfs-grace-monitor timed out unknown error messages grace_mon_monitor() occasionally returns OCF_ERR_GENERIC, but it ought to return OCF_NOT_RUNNING instead. Change-Id: I3d550e33cc3d0a8dce4333ced72db19b3b2f4f2e BUG: 1394226 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/15833 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: jiffin tony Thottan --- extras/ganesha/ocf/ganesha_grace | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'extras') diff --git a/extras/ganesha/ocf/ganesha_grace b/extras/ganesha/ocf/ganesha_grace index 84202df9aa2..cb6dcc4e867 100644 --- a/extras/ganesha/ocf/ganesha_grace +++ b/extras/ganesha/ocf/ganesha_grace @@ -164,7 +164,6 @@ ganesha_grace_notify() ganesha_grace_monitor() { - local rc=${OCF_ERR_GENERIC} local host=$(hostname -s) ocf_log debug "monitor" @@ -187,10 +186,10 @@ ganesha_grace_monitor() fi if [[ "${attr}" = *"value=1" ]]; then - rc=${OCF_SUCCESS} + return ${OCF_SUCCESS} fi - return ${rc} + return ${OCF_NOT_RUNNING} } ganesha_grace_validate() -- cgit From 131790335f5cbc406a2043b49c06f604a7656649 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Fri, 18 Nov 2016 13:07:50 -0500 Subject: common-ha: add cluster HA status to --status output for gdeploy gdeploy desires a one-liner "health" assessment. If all the VIP and port block/unblock RAs are located on their prefered nodes and 'Started', then the cluster is deemed to be good (healthy). N.B. status originally only checked the "online" nodes obtained from `pcs status` but we really want to consider all the configured nodes, whether they are online or not. Also one `pcs status` is enough. master http://review.gluster.org/15882 master bug 1395648 release-3.9 http://review.gluster.org/15991 release-3.9 bug 1395649 Change-Id: Id0e0380b6982e23763edeb0488843b5363e370b8 BUG: 1395652 Signed-off-by: Kaleb S. KEITHLEY Reviewed-by: Arthy Loganathan Reviewed-by: soumya k Reviewed-on: http://review.gluster.org/15992 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- extras/ganesha/scripts/ganesha-ha.sh | 89 ++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 30 deletions(-) (limited to 'extras') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index 44458d5da00..b222a38ab04 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2015 Red Hat Inc. All Rights Reserved +# Copyright 2015-2016 Red Hat Inc. All Rights Reserved # # Pacemaker+Corosync High Availability for NFS-Ganesha # @@ -74,13 +74,14 @@ GANESHA_CONF=${CONFFILE:-/etc/ganesha/ganesha.conf} usage() { - echo "Usage : add|delete|status" - echo "Add-node : ganesha-ha.sh --add \ + echo "Usage : add|delete|refresh-config|status" + echo "Add-node : ganesha-ha.sh --add \ " - echo "Delete-node: ganesha-ha.sh --delete \ + echo "Delete-node: ganesha-ha.sh --delete \ " - echo "Refresh-config : ganesha-ha.sh --refresh-config \ - " + echo "Refresh-config : ganesha-ha.sh --refresh-config \ +" + echo "Status : ganesha-ha.sh --status " } determine_service_manager () { @@ -139,7 +140,7 @@ determine_servers() local tmp_ifs=${IFS} local ha_servers="" - if [[ "X${cmd}X" != "XsetupX" ]]; then + if [ "X${cmd}X" != "XsetupX" -a "X${cmd}X" != "XstatusX" ]; then ha_servers=$(pcs status | grep "Online:" | grep -o '\[.*\]' | sed -e 's/\[//' | sed -e 's/\]//') IFS=$' ' for server in ${ha_servers} ; do @@ -810,25 +811,57 @@ setup_state_volume() status() { - local regex_str="^ ${1}"; shift - local status_file=$(mktemp) + local scratch=$(mktemp) + local regex_str="^${1}-cluster_ip-1" + local healthy=0 + local index=1 + local nodes - while [[ ${1} ]]; do + # change tabs to spaces, strip leading spaces + pcs status | sed -e "s/\t/ /g" -e "s/^[ ]*//" > ${scratch} + + nodes[0]=${1}; shift - regex_str="${regex_str}|^ ${1}" + # make a regex of the configured nodes + # and initalize the nodes array for later + while [[ ${1} ]]; do + regex_str="${regex_str}|^${1}-cluster_ip-1" + nodes[${index}]=${1} + ((index++)) shift done - pcs status | egrep "^Online:" > ${status_file} + # print the nodes that are expected to be online + grep -E "^Online:" ${scratch} - echo >> ${status_file} + echo - pcs status | egrep "${regex_str}" | sed -e "s/\t/ /" | cut -d ' ' -f 2,4 >> ${status_file} + # print the VIPs and which node they are on + grep -E "${regex_str}" < ${scratch} | cut -d ' ' -f 1,4 - cat ${status_file} + echo + + # check if the VIP RAs are on the expected nodes + for n in ${nodes[*]}; do + + grep -E -x "${n}-cluster_ip-1 \(ocf::heartbeat:IPaddr\): Started ${n}" > /dev/null 2>&1 ${scratch} + result=$? + ((healthy+=${result})) + done - rm -f ${status_file} + grep -E "\):\ Stopped|FAILED" > /dev/null 2>&1 ${scratch} + result=$? + + if [ ${result} -eq 0 ]; then + echo "Cluster HA Status: BAD" + elif [ ${healthy} -eq 0 ]; then + echo "Cluster HA Status: HEALTHY" + else + echo "Cluster HA Status: FAILOVER" + fi + + rm -f ${scratch} } @@ -840,20 +873,16 @@ main() usage exit 0 fi - if [[ ${cmd} != *status ]]; then - HA_CONFDIR=${1%/}; shift - local ha_conf=${HA_CONFDIR}/ganesha-ha.conf - local node="" - local vip="" - - # ignore any comment lines - cfgline=$(grep ^HA_NAME= ${ha_conf}) - eval $(echo ${cfgline} | grep -F HA_NAME=) - cfgline=$(grep ^HA_VOL_SERVER= ${ha_conf}) - eval $(echo ${cfgline} | grep -F HA_VOL_SERVER=) - cfgline=$(grep ^HA_CLUSTER_NODES= ${ha_conf}) - eval $(echo ${cfgline} | grep -F HA_CLUSTER_NODES=) - fi + HA_CONFDIR=${1%/}; shift + local ha_conf=${HA_CONFDIR}/ganesha-ha.conf + local node="" + local vip="" + + # ignore any comment lines + cfgline=$(grep ^HA_NAME= ${ha_conf}) + eval $(echo ${cfgline} | grep -F HA_NAME=) + cfgline=$(grep ^HA_CLUSTER_NODES= ${ha_conf}) + eval $(echo ${cfgline} | grep -F HA_CLUSTER_NODES=) case "${cmd}" in -- cgit From 377c3a00e2137c98fa4ffe52460dc17c8f2f8606 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Thu, 1 Dec 2016 09:40:33 -0500 Subject: common-ha: IPaddr RA is not stopped when pacemaker quorum is lost Ken Gaillot writes: The other is pacemaker's no-quorum-policy cluster property. The default (which has not changed) is "stop" (stop all resources). Other values are "ignore" (act as if quorum was not lost), "freeze" (continue running existing resources but don't recover resources from unseen nodes) or "suicide" (shut down). But on my four node cluster % pcs property show no-quorum-policy Cluster Properties: % i.e. shows nothing. But: % pcs property list --all Cluster Properties: ... no-quorum-policy: stop ... % Seems to think it knows about it. and then % pcs property set no-quorum-policy=stop % pcs property show no-quorum-policy Cluster Properties: no-quorum-policy: stop % Which looks rather inconsistent. So we will try explicitly setting it to "stop" when there are three or more nodes. master bug 1400237 master patch http://review.gluster.org/#/c/15981/ release-3.9 bug 1400527 release-3.9 patch http://review.gluster.org/15996 Change-Id: I47fc7ee84fcd6ad52ccb776913511978a8d517b4 BUG: 1400573 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/15997 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System --- extras/ganesha/scripts/ganesha-ha.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'extras') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index b222a38ab04..c0d0aa69078 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -167,6 +167,8 @@ setup_cluster() local num_servers=${2} local servers=${3} local unclean="" + local quorum_policy="stop" + logger "setting up cluster ${name} with the following ${servers}" @@ -199,10 +201,11 @@ setup_cluster() sleep 1 if [ ${num_servers} -lt 3 ]; then - pcs property set no-quorum-policy=ignore - if [ $? -ne 0 ]; then - logger "warning: pcs property set no-quorum-policy=ignore failed" - fi + quorum_policy="ignore" + fi + pcs property set no-quorum-policy=${quorum_policy} + if [ $? -ne 0 ]; then + logger "warning: pcs property set no-quorum-policy=${quorum_policy} failed" fi pcs property set stonith-enabled=false -- cgit From beace6aed3ef27e1e55a420d606ecdfbd56b32b2 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Fri, 28 Oct 2016 17:37:39 +0530 Subject: ganesha/scripts : use export id for dbus signals Currently for add export and update export parameter passed for executing those signal is "PATH". This is based on assumption that volume name and PATH will always be same. But it is wrong for subdir exports. The only reliable parameter in export configuration file is "Export_Id". Upstream reference : >Change-Id: Ic63ff44ac7736e14502034b74beaae27292eddf9 >BUG: 1389746 >Signed-off-by: Jiffin Tony Thottan >Reviewed-on: http://review.gluster.org/15751 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: soumya k >Reviewed-by: Kaleb KEITHLEY Change-Id: Ic63ff44ac7736e14502034b74beaae27292eddf9 BUG: 1399635 Signed-off-by: Jiffin Tony Thottan Reviewed-on: http://review.gluster.org/15970 Smoke: Gluster Build System Reviewed-by: soumya k CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Kaleb KEITHLEY --- extras/ganesha/scripts/ganesha-ha.sh | 6 +++--- extras/hook-scripts/start/post/S31ganesha-start.sh | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'extras') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index c0d0aa69078..1d7027cc10a 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -265,7 +265,7 @@ ${tganesha_vol_conf} while [[ ${3} ]]; do current_host=`echo ${3} | cut -d "." -f 1` if [ ${short_host} != ${current_host} ]; then - removed_id=$(ssh -oPasswordAuthentication=no \ + removed_id=$(ssh -oPasswordAuthentication=no \ -oStrictHostKeyChecking=no -i ${SECRET_PEM} root@${current_host} \ "cat $HA_CONFDIR/exports/export.$VOL.conf |\ grep Export_Id | awk -F\"[=,;]\" '{print \$2}' | tr -d '[[:space:]]'") @@ -295,7 +295,7 @@ ${current_host}:${HA_CONFDIR}/exports/export.$VOL.conf "dbus-send --print-reply --system --dest=org.ganesha.nfsd \ /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.AddExport \ string:$HA_CONFDIR/exports/export.$VOL.conf \ -string:\"EXPORT(Path=/$VOL)\" 2>&1") +string:\"EXPORT(Path=/$removed_id)\" 2>&1") ret=$? logger <<< "${output}" if [ ${ret} -ne 0 ]; then @@ -329,7 +329,7 @@ uint16:$removed_id 2>&1) output=$(dbus-send --print-reply --system --dest=org.ganesha.nfsd \ /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.AddExport \ string:$HA_CONFDIR/exports/export.$VOL.conf \ -string:"EXPORT(Path=/$VOL)" 2>&1) +string:"EXPORT(Path=/$removed_id)" 2>&1) ret=$? logger <<< "${output}" if [ ${ret} -ne 0 ] ; then diff --git a/extras/hook-scripts/start/post/S31ganesha-start.sh b/extras/hook-scripts/start/post/S31ganesha-start.sh index b85c789b9ed..d0b5101f0ea 100755 --- a/extras/hook-scripts/start/post/S31ganesha-start.sh +++ b/extras/hook-scripts/start/post/S31ganesha-start.sh @@ -61,6 +61,7 @@ echo "}" } #This function keeps track of export IDs and increments it with every new entry +#Also it adds the export dynamically by sending dbus signals function export_add() { count=`ls -l $GANESHA_DIR/exports/*.conf | wc -l` @@ -79,17 +80,13 @@ function export_add() #fi fi echo $EXPORT_ID > $GANESHA_DIR/.export_added - sed -i s/Export_Id.*/"Export_Id= $EXPORT_ID ;"/ \ + sed -i s/Export_Id.*/"Export_Id=$EXPORT_ID;"/ \ $GANESHA_DIR/exports/export.$VOL.conf echo "%include \"$GANESHA_DIR/exports/export.$VOL.conf\"" >> $CONF1 -} -#This function adds a new export dynamically by sending dbus signals -function dynamic_export_add() -{ dbus-send --print-reply --system --dest=org.ganesha.nfsd \ /org/ganesha/nfsd/ExportMgr org.ganesha.nfsd.exportmgr.AddExport \ -string:$GANESHA_DIR/exports/export.$VOL.conf string:"EXPORT(Path=/$VOL)" +string:$GANESHA_DIR/exports/export.$VOL.conf string:"EXPORT(Export_Id=$EXPORT_ID)" } @@ -99,7 +96,6 @@ function start_ganesha() sed -i /$VOL.conf/d $CONF1 #Create a new export entry export_add $VOL - dynamic_export_add $VOL } -- cgit From d0d7a618fab67f3b0a6ad3f15d5fecc784341a0f Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 1 Dec 2016 17:28:40 +0530 Subject: extras: Include shard and full-data-heal in virt group Backport of: http://review.gluster.org/15995 Change-Id: Ibcfe069e2cc10cc1913ba5c9ca724b7dd3f8b147 BUG: 1375849 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/16120 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Pranith Kumar Karampuri --- extras/group-virt.example | 2 ++ 1 file changed, 2 insertions(+) (limited to 'extras') diff --git a/extras/group-virt.example b/extras/group-virt.example index b699c9e98e2..4fe3760be2c 100644 --- a/extras/group-virt.example +++ b/extras/group-virt.example @@ -6,3 +6,5 @@ cluster.eager-lock=enable network.remote-dio=enable cluster.quorum-type=auto cluster.server-quorum-type=server +features.shard=on +cluster.data-self-heal-algorithm=full -- cgit From 846737955b7a42a79327f6c9076248eb1fd97b4d Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Thu, 15 Dec 2016 06:22:02 -0500 Subject: common-ha: explicitly set udpu transport for corosync On RHEL7 corosync uses udpu (udp unicast) by default. On RHEL6 the default is (now) udp multi-cast. In network environments that don't support udp multi-cast this causes the ever growing lists of [TOTEM ] Retransmit errors. Always specifying --transport udpu is thus a no-op on RHEL7. Using the same transport on both RHEL6 and RHEL7 may (or may not give similar behavior and performance--it's hard to say. It remains a mystery why things have always worked on RHEL6 prior to now. Further investigation is required to uncover why this is the case. main http://review.gluster.org/16122 main BZ 1404410 release-3.9 http://review.gluster.org/16139/ release-3.9 BZ 1405002 Change-Id: I4d0de97fe4425c47f249beaaf51aeca3e91731fa BUG: 1405004 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/16140 Reviewed-by: soumya k Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- extras/ganesha/scripts/ganesha-ha.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index 1d7027cc10a..ae3ba8d7b36 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -174,7 +174,7 @@ setup_cluster() pcs cluster auth ${servers} # pcs cluster setup --name ${name} ${servers} - pcs cluster setup ${RHEL6_PCS_CNAME_OPTION} ${name} ${servers} + pcs cluster setup ${RHEL6_PCS_CNAME_OPTION} ${name} --transport udpu ${servers} if [ $? -ne 0 ]; then logger "pcs cluster setup ${RHEL6_PCS_CNAME_OPTION} ${name} ${servers} failed" exit 1; -- cgit From bcff9a195c3d7ab8ce87a4add448643aa5ee1a4e Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Fri, 16 Dec 2016 13:24:57 -0500 Subject: 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. master BZ: 1400613 master http://review.gluster.org/#/c/16036/ release-3.9 BZ: 1405576 release-3.9 http://review.gluster.org/16170 Change-Id: Id2f78f70946f29c3503e1e6db141b66cb431e0ea BUG: 1405577 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/16171 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- extras/ganesha/scripts/ganesha-ha.sh | 92 +++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-) (limited to 'extras') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index ae3ba8d7b36..00fe1a76958 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -812,6 +812,93 @@ setup_state_volume() } +addnode_state_volume() +{ + local newnode=${1}; shift + local mnt=${HA_VOL_MNT} + local longname="" + local dname="" + local dirname="" + + longname=$(hostname) + dname=${longname#$(hostname -s)} + + if [[ ${newnode} == *${dname} ]]; then + dirname=${newnode} + else + dirname=${newnode}${dname} + fi + + if [ ! -d ${mnt}/nfs-ganesha/${dirname} ]; then + mkdir ${mnt}/nfs-ganesha/${dirname} + fi + if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs ]; then + mkdir ${mnt}/nfs-ganesha/${dirname}/nfs + fi + if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha ]; then + mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha + fi + if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd ]; then + mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd + fi + if [ ! -e ${mnt}/nfs-ganesha/${dirname}/nfs/state ]; then + touch ${mnt}/nfs-ganesha/${dirname}/nfs/state + fi + if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4recov ]; then + mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4recov + fi + if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4old ]; then + mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/ganesha/v4old + fi + if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm ]; then + mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm + fi + if [ ! -d ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm.bak ]; then + mkdir ${mnt}/nfs-ganesha/${dirname}/nfs/statd/sm.bak + fi + if [ ! -e ${mnt}/nfs-ganesha/${dirname}/nfs/statd/state ]; then + touch ${mnt}/nfs-ganesha/${dirname}/nfs/statd/state + 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} + done + +} + + +delnode_state_volume() +{ + local delnode=${1}; shift + local mnt=${HA_VOL_MNT} + local longname="" + local dname="" + local dirname="" + + longname=$(hostname) + dname=${longname#$(hostname -s)} + + if [[ ${delnode} == *${dname} ]]; then + dirname=${delnode} + else + dirname=${delnode}${dname} + fi + + rm -rf ${mnt}/nfs-ganesha/${dirname} + + for server in ${HA_SERVERS} ; do + if [[ "${server}" != "${dirname}" ]]; then + rm -f ${mnt}/nfs-ganesha/${server}/nfs/ganesha/${dirname} + rm -f ${mnt}/nfs-ganesha/${server}/nfs/statd/${dirname} + fi + done +} + + status() { local scratch=$(mktemp) @@ -962,6 +1049,9 @@ main() sed -i s/HA_CLUSTER_NODES.*/"HA_CLUSTER_NODES=\"$NEW_NODES\""/ \ $HA_CONFDIR/ganesha-ha.conf + + addnode_state_volume ${node} + HA_SERVERS="${HA_SERVERS} ${node}" setup_copy_config ${HA_SERVERS} @@ -985,7 +1075,7 @@ $HA_CONFDIR/ganesha-ha.conf setup_copy_config ${HA_SERVERS} - rm -rf ${HA_VOL_MNT}/nfs-ganesha/${node} + delnode_state_volume ${node} determine_service_manager -- cgit From 12190c0338dea6bbfafb7bf7693ce4ee547b5954 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Tue, 20 Dec 2016 11:06:34 -0500 Subject: 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 original change release-3.9 http://review.gluster.org/16170 original change release-3.8 http://review.gluster.org/16171 master change http://review.gluster.org/16216 master BZ 1400613 release-3.9 change http://review.gluster.org/16217 release-3.9 BZ 1405576 Change-Id: I52839046745728d06ab5a07f38081c032093bff6 BUG: 1405577 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/16218 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- extras/ganesha/scripts/ganesha-ha.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'extras') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index 00fe1a76958..ac8c91f194e 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -861,11 +861,13 @@ 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} + 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} + 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 } @@ -1052,8 +1054,6 @@ $HA_CONFDIR/ganesha-ha.conf addnode_state_volume ${node} - HA_SERVERS="${HA_SERVERS} ${node}" - setup_copy_config ${HA_SERVERS} ;; -- cgit From d513f41ef8089a9df2fe1240dd9f1952b9a41767 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Wed, 23 Nov 2016 16:04:26 +0530 Subject: glusterd/ganesha : handle volume reset properly for ganesha options The "gluster volume reset" should first unexport the volume and then delete export configuration file. Also reset option is not applicable for ganesha.enable if volume value is "all". This patch also changes the name of create_export_config into manange_export_config Upstream reference : >Change-Id: Ie81a49e7d3e39a88bca9fbae5002bfda5cab34af >BUG: 1397795 >Signed-off-by: Jiffin Tony Thottan >Reviewed-on: http://review.gluster.org/15914 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: soumya k >Reviewed-by: Kaleb KEITHLEY >Signed-off-by: Jiffin Tony Thottan Change-Id: Ie81a49e7d3e39a88bca9fbae5002bfda5cab34af BUG: 1405951 Signed-off-by: Jiffin Tony Thottan Reviewed-on: http://review.gluster.org/16054 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kaleb KEITHLEY Signed-off-by: Jiffin Tony Thottan Reviewed-on: http://review.gluster.org/16197 --- extras/hook-scripts/reset/post/Makefile.am | 5 +-- extras/hook-scripts/reset/post/S31ganesha-reset.sh | 48 ---------------------- 2 files changed, 1 insertion(+), 52 deletions(-) delete mode 100755 extras/hook-scripts/reset/post/S31ganesha-reset.sh (limited to 'extras') diff --git a/extras/hook-scripts/reset/post/Makefile.am b/extras/hook-scripts/reset/post/Makefile.am index bb28d990596..1b336ac1a85 100644 --- a/extras/hook-scripts/reset/post/Makefile.am +++ b/extras/hook-scripts/reset/post/Makefile.am @@ -1,4 +1 @@ -EXTRA_DIST = S31ganesha-reset.sh - -hookdir = $(GLUSTERD_WORKDIR)/hooks/1/reset/post/ -hook_SCRIPTS = S31ganesha-reset.sh +EXTRA_DIST = diff --git a/extras/hook-scripts/reset/post/S31ganesha-reset.sh b/extras/hook-scripts/reset/post/S31ganesha-reset.sh deleted file mode 100755 index 9538911a842..00000000000 --- a/extras/hook-scripts/reset/post/S31ganesha-reset.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -PROGNAME="Sganesha-reset" -OPTSPEC="volname:,gd-workdir:" -VOL= -GLUSTERD_WORKDIR= - -function parse_args () { - ARGS=$(getopt -l $OPTSPEC -o "o" -name $PROGNAME $@) - eval set -- "$ARGS" - while true; do - case $1 in - --volname) - shift - VOL=$1 - ;; - --gd-workdir) - shift - GLUSTERD_WORKDIR=$1 - ;; - *) - shift - break - ;; - esac - shift - done -} - -function is_volume_started () { - volname=$1 - echo "$(grep status $GLUSTERD_WORKDIR/vols/"$volname"/info |\ - cut -d"=" -f2)" -} - -parse_args $@ -if ps aux | grep -q "[g]anesha.nfsd" - then - kill -s TERM `cat /var/run/ganesha.pid` - sleep 10 - rm -rf /var/lib/glusterfs-ganesha/exports - rm -rf /var/lib/glusterfs-ganesha/.export_added - sed -i /conf/d /var/lib/ganesha/nfs-ganesha.conf - if [ "1" = $(is_volume_started "$VOL") ]; - then - gluster volume start $VOL force - fi -fi -- cgit