From 07b31a008b59d6c0b06bd17994de85fc56560b38 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. Change-Id: I33fc18ff39e54ced277f94afef7a11a22c9ccce0 BUG: 1259225 Signed-off-by: Soumya Koduri Reviewed-on: http://review.gluster.org/12091 Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System --- extras/ganesha/scripts/ganesha-ha.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'extras/ganesha/scripts') diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index 1356a385573..72465be32aa 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -316,14 +316,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