mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-26 13:10:35 +00:00
Fix 3151, Backup service node is not reflected in the /opt/xcat/xcatinfo file (#3434)
* populate node attribute servicenode into mypostscript, and then inject into /opt/xcat/xcatinfo cover both updatenode -s and os installation case. * using 1 step of sed for chaning
This commit is contained in:
@@ -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
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user