diff --git a/xCAT-server/share/xcat/install/scripts/post.rh b/xCAT-server/share/xcat/install/scripts/post.rh index 70152a7f3..f3b7533f4 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh +++ b/xCAT-server/share/xcat/install/scripts/post.rh @@ -41,6 +41,10 @@ echo "$TMP" > /opt/xcat/xcatdsklspost chmod 755 /opt/xcat/xcatdsklspost chkconfig --add xcatpostinit +cat >/opt/xcat/xcatinfo << EOF +XCATSERVER=#XCATVAR:XCATMASTER# +EOF + #something Jarrod knows sed -i 's/^serial/#serial/' /boot/grub/menu.lst sed -i 's/^terminal/#terminal/' /boot/grub/menu.lst diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.iscsi b/xCAT-server/share/xcat/install/scripts/post.rh.iscsi index c61bde74e..9ccb77f66 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.iscsi +++ b/xCAT-server/share/xcat/install/scripts/post.rh.iscsi @@ -40,6 +40,10 @@ echo "$TMP" > /opt/xcat/xcatdsklspost chmod 755 /opt/xcat/xcatdsklspost chkconfig --add xcatpostinit +cat >/opt/xcat/xcatinfo << EOF +XCATSERVER=#XCATVAR:XCATMASTER# +EOF + export MASTER_IP="#XCATVAR:XCATMASTER#" export MASTER_IPS="#XCATVAR:XCATMASTER#" export MASTER="#XCATVAR:XCATMASTER#" diff --git a/xCAT-server/share/xcat/install/scripts/post.sles b/xCAT-server/share/xcat/install/scripts/post.sles index 398688451..a74b2adb0 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles +++ b/xCAT-server/share/xcat/install/scripts/post.sles @@ -68,6 +68,10 @@ EOF chmod 755 /opt/xcat/xcatdsklspost chkconfig --add xcatpostinit + +cat >/opt/xcat/xcatinfo << EOF +XCATSERVER=#XCATVAR:XCATMASTER# +EOF ]]> diff --git a/xCAT-server/share/xcat/install/scripts/post.sles.iscsi b/xCAT-server/share/xcat/install/scripts/post.sles.iscsi index 9da81a82f..d00c974e1 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles.iscsi +++ b/xCAT-server/share/xcat/install/scripts/post.sles.iscsi @@ -42,6 +42,10 @@ EOF chmod 755 /opt/xcat/xcatdsklspost chkconfig --add xcatpostinit + +cat >/opt/xcat/xcatinfo << EOF +XCATSERVER=#XCATVAR:XCATMASTER# +EOF ]]> diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11 b/xCAT-server/share/xcat/install/scripts/post.sles11 index 398688451..a74b2adb0 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11 +++ b/xCAT-server/share/xcat/install/scripts/post.sles11 @@ -68,6 +68,10 @@ EOF chmod 755 /opt/xcat/xcatdsklspost chkconfig --add xcatpostinit + +cat >/opt/xcat/xcatinfo << EOF +XCATSERVER=#XCATVAR:XCATMASTER# +EOF ]]> diff --git a/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi b/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi index 7e4a4b96d..61dfef33e 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi +++ b/xCAT-server/share/xcat/install/scripts/post.sles11.iscsi @@ -51,6 +51,10 @@ EOF chmod 755 /opt/xcat/xcatdsklspost chkconfig --add xcatpostinit + +cat >/opt/xcat/xcatinfo << EOF +XCATSERVER=#XCATVAR:XCATMASTER# +EOF ]]> diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index b443d4da9..09ae1ece2 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -33,6 +33,36 @@ if [ "$OSVER" = "11" ]; then SIP=`echo $SIP |awk -F\' '{print $2}'` #trim ' fi +#open the xcatinfo file to look for the master if it is not set +frominfofile=0 +if [ -z $SIP ]; then + if [ -f /opt/xcat/xcatinfo ]; then + SIP=`grep 'XCATSERVER' /opt/xcat/xcatinfo |cut -d= -f2` + frominfofile=1 + fi +fi + +#no hope, now let's get out here. +if [ -z $SIP ]; then + hn=`hostname` + echo "Cannot find the xCAT server for node $hn" + exit +fi + +#save the SIP into the xcatinfo file +if [ $frominfofile -eq 0 ]; then + if [ ! -f /opt/xcat/xcatinfo ]; then + mkdir -p /opt/xcat + touch /opt/xcat/xcatinfo + fi + grep 'XCATSERVER' /opt/xcat/xcatinfo 2>&1 > /dev/null + if [ $? -eq 0 ]; then + sed -i "s/XCATSERVER=.*/XCATSERVER=$SIP/" /opt/xcat/xcatinfo + else + echo "XCATSERVER=$SIP" >> /opt/xcat/xcatinfo + fi +fi + if grep 'rw /rw tmpfs ' /proc/mounts >& /dev/null; then touch /var/lock/subsys/xcatmounts echo '#!/bin/bash' > /etc/rc6.d/K10xcatmounts