diff --git a/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl b/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl index 68a7b6ee8..2ed561e34 100755 --- a/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl +++ b/xCAT-server/share/xcat/mypostscript/mypostscript.tmpl @@ -43,6 +43,8 @@ export PRIMARYNIC MASTER=#TABLE:noderes:$NODE:xcatmaster# export MASTER +SERVICEGROUP=#TABLE:noderes:$NODE:servicenode# +export SERVICEGROUP SYSLOG=#TABLE:noderes:$NODE:syslog# export SYSLOG diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 7aac7ab28..81df3d557 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -19,10 +19,8 @@ # ##################################################### - [ -f "/xcatpost/xcatlib.sh" ] && . /xcatpost/xcatlib.sh - if [ -f /xcatpost/mypostscript.post ]; then XCATDEBUGMODE=`grep 'XCATDEBUGMODE=' /xcatpost/mypostscript.post | cut -d= -f2 | tr -d \'\" | tr A-Z a-z` MASTER_IP=`grep '^MASTER_IP=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` @@ -39,6 +37,7 @@ else done fi +XCATINFOFILE=/opt/xcat/xcatinfo #echolog: process message log and echo in xcatdsklspost #arguments: @@ -691,6 +690,22 @@ else echo "USEFLOWCONTROL=NO" >> /opt/xcat/xcatinfo fi +# Store the SERVICEGROUP into the xcatinfo file for node deployment, and also for updatenode -s +if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "1" ]; then + sn_group=`grep '^SERVICEGROUP' /$xcatpost/mypostscript |cut -d= -f2 | tr -d \'\"` + if [ "x" != "x$sn_group" ]; then + # Change or add SERVICEGROUP line if service node pool defined. + grep 'SERVICEGROUP=' $XCATINFOFILE > /dev/null 2>&1 + if [ $? -eq 0 ]; then + sed -i "s/SERVICEGROUP=.*/SERVICEGROUP=$sn_group/" $XCATINFOFILE + else + echo "SERVICEGROUP=$sn_group" >> $XCATINFOFILE + fi + else + # Remove SERVICEGROUP line if no service node pool defined. + sed -i "/SERVICEGROUP=.*/d" $XCATINFOFILE + fi +fi # when called by the updatenode command MODE=1,2 # the nodename is passed in by xdsh in the NODE environment variable by xdsh. diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 5976cb531..4fcdd284d 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -20,7 +20,7 @@ fi SLI=$(awk 'BEGIN{srand(); printf("%d\n",rand()*10)}') sleep $SLI - +XCATINFOFILE=/opt/xcat/xcatinfo MACADDR=`grep MACADDRESS= /xcatpost/mypostscript.post |awk -F = '{print $2}'|sed s/\'//g` INSTALLNIC=`ip -o link|grep -i $MACADDR|awk '{print $2}'|sed s/://` @@ -74,7 +74,20 @@ if [ $? -eq 0 ]; then else echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo fi - +# Store the SERVICEGROUP into the xcatinfo file for statful installation +sn_group=`grep '^SERVICEGROUP' /xcatpost/mypostscript |cut -d= -f2 | tr -d \'\"` +if [ "x" != "x$sn_group" ]; then + # Change or add SERVICEGROUP line if service node pool defined. + grep 'SERVICEGROUP=' $XCATINFOFILE > /dev/null 2>&1 + if [ $? -eq 0 ]; then + sed -i "s/SERVICEGROUP=.*/SERVICEGROUP=$sn_group/" $XCATINFOFILE + else + echo "SERVICEGROUP=$sn_group" >> $XCATINFOFILE + fi +else + # Remove SERVICEGROUP line if no service node pool defined. + sed -i "/SERVICEGROUP=.*/d" $XCATINFOFILE +fi CNS=`grep NODESTATUS= /xcatpost/mypostscript.post |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z` if [ -z "$CNS" ] || [[ "$CNS" =~ ^(1|yes|y)$ ]]; then