From 5154e581ae3424890533bcd71e61e0a6f4a5aa08 Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Wed, 2 Sep 2015 17:15:23 +0530 Subject: CommonHA: Avoid scp of the config state to the same host During add-node, have seen an issue where in scp doesn't work if the source and destination host are same. Fixed the same. BUG: 1259225 Change-Id: Ib8fe21b3c95d653c62698310d5390b46a3c6bbf4 Signed-off-by: Soumya Koduri Reviewed-on: http://review.gluster.org/12091 Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System Reviewed-on: http://review.gluster.org/13720 Tested-by: Kaleb KEITHLEY Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- extras/ganesha/scripts/ganesha-ha.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'extras/ganesha/scripts/ganesha-ha.sh') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index cb4c5424428..901464e0ef8 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -315,14 +315,27 @@ copy_export_config () local short_host=$(hostname -s) # avoid prompting for password, even with password-less scp # scp $host1:$file $host2:$file prompts for the password - scp -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \ + # Ideally all the existing nodes in the cluster should have same + # copy of the configuration files. Maybe for sanity check, copy + # the state from HA_VOL_SERVER? + if [ "${HA_VOL_SERVER}" == $(hostname) ] + then + cp ${GANESHA_CONF} ${tganesha_conf} + else + scp -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \ ${SECRET_PEM} ${HA_VOL_SERVER}:${GANESHA_CONF} $short_host:${tganesha_conf} + fi scp -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \ ${SECRET_PEM} ${tganesha_conf} ${new_node}:${GANESHA_CONF} rm -f ${tganesha_conf} - scp -r -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \ + if [ "${HA_VOL_SERVER}" == $(hostname) ] + then + cp -r ${HA_CONFDIR}/exports ${tganesha_exports} + else + scp -r -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \ ${SECRET_PEM} ${HA_VOL_SERVER}:${HA_CONFDIR}/exports/ $short_host:${tganesha_exports} + fi scp -r -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i \ ${SECRET_PEM} ${tganesha_exports}/exports ${new_node}:${HA_CONFDIR}/ rm -rf ${tganesha_exports} -- cgit