diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index f200f93ff..0abaf48c5 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -39,6 +39,7 @@ chmod 0755 /tmp/updateflag cd /tmp log_label="xcat.deployment" +msgutil_r "$MASTER_IP" "info" "=============deployment starting====================" "/var/log/xcat/xcat.log" "$log_label" msgutil_r "$MASTER_IP" "info" "Executing post.xcat to prepare for firstbooting ..." "/var/log/xcat/xcat.log" "$log_label" RAND=$(perl -e 'print int(rand(50)). "\n"') @@ -196,9 +197,9 @@ run_ps () { if [ -z \"\$scriptype\" ]; then scriptype=\"postscript\" fi - + log_label=\"xcat.deployment.\"\$scriptype if [ -f \$1 ]; then - msgutil_r \"\$MASTER_IP\" \"info\" "\"Running \$scriptype: \$1\"" \"\$logfile\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype start..: \$1\"" \"\$logfile\" \"\$log_label\" if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then local compt=\$(file \$1) local reg=\"shell script\" @@ -217,9 +218,9 @@ run_ps () { if [ \"\$ret_local\" -ne \"0\" ]; then return_value=\$ret_local fi - msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype \$1 return with \$ret_local\"" \"\$logfile\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype end...: \$1 return with \$ret_local\"" \"\$logfile\" \"\$log_label\" else - msgutil_r \"\$MASTER_IP\" \"error\" "\"\$scriptype \$1 does NOT exist.\"" \"\$logfile\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"error\" "\"\$scriptype \$1 does NOT exist.\"" \"\$logfile\" \"\$log_label\" return_value=-1 fi diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat.ng b/xCAT-server/share/xcat/install/scripts/post.xcat.ng index 07c4e64bd..4f206b279 100644 --- a/xCAT-server/share/xcat/install/scripts/post.xcat.ng +++ b/xCAT-server/share/xcat/install/scripts/post.xcat.ng @@ -242,9 +242,9 @@ run_ps () { if [ -z \"\$scriptype\" ]; then scriptype=\"postscript\" fi - + log_label=\"xcat.deployment.\"\$scriptype if [ -f \$1 ]; then - msgutil_r \"\$MASTER_IP\" \"info\" "\"Running \$scriptype: \$1\"" \"\$logfile\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"info\" "\"Running \$scriptype: \$1\"" \"\$logfile\" \"\$log_label\" if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then local compt=\$(file \$1) local reg=\"shell script\" @@ -263,9 +263,9 @@ run_ps () { if [ \"\$ret_local\" -ne \"0\" ]; then return_value=\$ret_local fi - msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype \$1 return with \$ret_local\"" \"\$logfile\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype \$1 return with \$ret_local\"" \"\$logfile\" \"\$log_label\" else - msgutil_r \"\$MASTER_IP\" \"error\" "\"\$scriptype \$1 does NOT exist.\"" \"\$logfile\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"error\" "\"\$scriptype \$1 does NOT exist.\"" \"\$logfile\" \"\$log_label\" return_value=-1 fi diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 6136b3471..d70a64323 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -2,7 +2,7 @@ NEWROOT=$3 RWDIR=.statelite XCATMASTER=$XCAT - +log_label="xcat.deployment" . /lib/dracut-lib.sh rootlimit="$(getarg rootlimit=)" @@ -20,7 +20,7 @@ xcatdebugmode="$(getarg xcatdebugmode=)" [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "running xcatroot...." [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "MASTER=$MASTER XCATIPORT=$XCATIPORT" - +logger -t $log_label -p local4.info "=============deployment starting====================" if [ "$NODESTATUS" != "0" ]; then [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "nodestatus: netbooting,reporting..." /tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting" diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 924fe1c1c..1bab4cf52 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -21,7 +21,7 @@ if [ $? -ne 0 ]; then fi [ "$xcatdebugmode" = "1" -o "$xcatdebugmode" = "2" ] && SYSLOGHOST="" || SYSLOGHOST="-n $MASTER" - +logger $SYSLOGHOST -t $log_label -p local4.info "=============deployment starting====================" logger $SYSLOGHOST -t $log_label -p local4.info "Executing xcatroot to prepare for netbooting (dracut_33)..." [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "MASTER=$MASTER XCATIPORT=$XCATIPORT NODESTATUS=$NODESTATUS" diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_047/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_047/xcatroot index 1956735dd..254adb7fe 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_047/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_047/xcatroot @@ -1,5 +1,4 @@ #!/bin/bash -set -x log_label="xcat.deployment" NEWROOT=$3 @@ -22,7 +21,7 @@ if [ $? -ne 0 ]; then fi [ "$xcatdebugmode" = "1" -o "$xcatdebugmode" = "2" ] && SYSLOGHOST="" || SYSLOGHOST="-n $MASTER" - +logger $SYSLOGHOST -t $log_label -p local4.info "=============deployment starting====================" logger $SYSLOGHOST -t $log_label -p local4.info "Executing xcatroot to prepare for netbooting (dracut_33)..." [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p local4.debug "MASTER=$MASTER XCATIPORT=$XCATIPORT NODESTATUS=$NODESTATUS" diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 430fc367e..d1af92cc3 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -68,11 +68,11 @@ echolog() echo "$msgstr" fi if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then - msgutil_r "$MASTER_IP" "$msgtype" "$msgstr" "/var/log/xcat/xcat.log" "xcat.xcatdsklspost" + msgutil_r "$MASTER_IP" "$msgtype" "$msgstr" "/var/log/xcat/xcat.log" "$log_label" fi else echo "$msgstr" - msgutil_r "$MASTER_IP" "$msgtype" "$msgstr" "/var/log/xcat/xcat.log" "xcat.xcatdsklspost" + msgutil_r "$MASTER_IP" "$msgtype" "$msgstr" "/var/log/xcat/xcat.log" "$log_label" fi #reload the functions defined in./xcatlib.sh @@ -119,7 +119,6 @@ download_postscripts() INSTALLDIR="/install" fi fi - echolog "debug" "trying to download postscripts from http://$server$INSTALLDIR/postscripts/" max_retries=5 retry=0 @@ -216,8 +215,12 @@ pmatch () ARGNUM=$#; if [ -z $1 ]; then NODE_DEPLOYMENT=1 + log_label="xcat.deployment" + echolog "info" "=============deployment starting====================" else NODE_DEPLOYMENT=0 + log_label="xcat.updatenode" + echolog "info" "=============updatenode starting====================" case $1 in 1|2|5) MODE=$1 @@ -885,18 +888,22 @@ run_ps () { if [ -z \"\$scriptype\" ]; then scriptype=\"postscript\" fi - + if [ \$UPDATENODE -eq 0 ]; then + log_label=\"xcat.deployment.\"\$scriptype + else + log_label=\"xcat.updatenode.\"\$scriptype + fi if [ -f \$1 ]; then - echo \"Running \$scriptype: \$1\" - msgutil_r \"\$MASTER_IP\" \"info\" "\"Running \$scriptype: \$1\"" \"\$logfile\" \"xcat.mypostscript\" + echo \"\$scriptype start..: \$1\" + msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype start..: \$1\"" \"\$logfile\" \"\$log_label\" if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then local compt=\$(file \$1) local reg=\"shell script\" if [[ \"\$compt\" =~ \$reg ]]; then - bash -x ./\$@ 2>&1 | tee -a \$logfile | tee >(logger -t xcat.mypostscript -p debug) + bash -x ./\$@ 2>&1 | tee -a \$logfile | tee >(logger -t \$log_label -p debug) ret_local=\${PIPESTATUS[0]} else - ./\$@ 2>&1 | tee -a \$logfile | tee >(logger -t xcat.mypostscript -p debug) + ./\$@ 2>&1 | tee -a \$logfile | tee >(logger -t \$log_label -p debug) ret_local=\${PIPESTATUS[0]} fi else @@ -907,11 +914,11 @@ run_ps () { if [ \"\$ret_local\" -ne \"0\" ]; then return_value=\$ret_local fi - echo \"\$scriptype: \$1 exited with code \$ret_local\" - msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype \$1 return with \$ret_local\"" \"\$logfile\" \"xcat.mypostscript\" + echo \"\$scriptype end....: \$1 exited with code \$ret_local\" + msgutil_r \"\$MASTER_IP\" \"info\" "\"\$scriptype end...:\$1 return with \$ret_local\"" \"\$logfile\" \"\$log_label\" else echo \"\`date\` \$scriptype \$1 does NOT exist.\" - msgutil_r \"\$MASTER_IP\" \"error\" "\"\$scriptype \$1 does NOT exist.\"" \"\$logfile\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"error\" "\"\$scriptype \$1 does NOT exist.\"" \"\$logfile\" \"\$log_label\" return_value=-1 fi @@ -937,23 +944,23 @@ if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ] || [ "$MODE" = "6" ]; then if [ "$MODE" = "6" ]; then echo " if [ \"\$return_value\" -eq \"0\" ]; then - msgutil_r \$MASTER_IP \"debug\" \"node booted successfully, reporting status...\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"debug\" \"node booted successfully, reporting status...\" \"/var/log/xcat/xcat.log\" \"\$log_label\" updateflag.awk \$MASTER 3002 \"installstatus booted\" else - msgutil_r \$MASTER_IP \"debug\" \"node boot failed, reporting status...\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"debug\" \"node boot failed, reporting status...\" \"/var/log/xcat/xcat.log\" \"\$log_label\" updateflag.awk \$MASTER 3002 \"installstatus failed\" fi " >> /$xcatpost/mypostscript else echo " if [ \"\$return_value\" -eq \"0\" ]; then - msgutil_r \$MASTER_IP \"debug\" \"node booted successfully, reporting status...\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"debug\" \"node booted successfully, reporting status...\" \"/var/log/xcat/xcat.log\" \"\$log_label\" updateflag.awk \$MASTER 3002 \"installstatus booted\" - msgutil_r \$MASTER_IP \"info\" \"provision completed.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"info\" \"provision completed.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"\$log_label\" else - msgutil_r \$MASTER_IP \"debug\" \"node boot failed, reporting status...\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"debug\" \"node boot failed, reporting status...\" \"/var/log/xcat/xcat.log\" \"\$log_label\" updateflag.awk \$MASTER 3002 \"installstatus failed\" - msgutil_r \$MASTER_IP \"error\" \"provision completed with error.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"error\" \"provision completed with error.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"\$log_label\" fi " >> /$xcatpost/mypostscript fi @@ -987,6 +994,11 @@ fi #tell user it is done when this is called by updatenode command if [ "$MODE" = "1" ] || [ "$MODE" = "2" ] || [ "$MODE" = "5" ]; then echolog "info" "returned from postscript" + echolog "info" "=============updatenode ending====================" +fi + +if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ] || [ "$MODE" = "6" ]; then + echolog "info" "=============deployment ending====================" fi exit $VRET_POST diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 9e485818c..235c241d8 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -6,7 +6,7 @@ ################################################################# . /xcatpost/xcatlib.sh -log_label="xcat.xcatinstallpost" +log_label="xcat.deployment" 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` @@ -125,16 +125,16 @@ echo " if [ \"\$return_value\" -eq \"0\" ]; then if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then - msgutil_r \"\$MASTER_IP\" \"debug\" \"node booted, reporting status...\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"debug\" \"node booted, reporting status...\" \"/var/log/xcat/xcat.log\" \"\$log_label\" fi updateflag.awk \$MASTER 3002 \"installstatus booted\" - msgutil_r \$MASTER_IP \"info\" \"provision completed.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"info\" \"provision completed.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"\$log_label\" else if [ \"\$XCATDEBUGMODE\" = \"1\" ] || [ \"\$XCATDEBUGMODE\" = \"2\" ]; then - msgutil_r \"\$MASTER_IP\" \"debug\" \"node boot failed, reporting status...\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \"\$MASTER_IP\" \"debug\" \"node boot failed, reporting status...\" \"/var/log/xcat/xcat.log\" \"\$log_label\" fi updateflag.awk \$MASTER 3002 \"installstatus failed\" - msgutil_r \$MASTER_IP \"error\" \"provision completed with error.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"xcat.mypostscript\" + msgutil_r \$MASTER_IP \"error\" \"provision completed with error.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"\$log_label\" fi " >> /xcatpost/mypostscript.post fi @@ -145,4 +145,5 @@ if [ -x /xcatpost/mypostscript.post ];then msgutil_r "$MASTER_IP" "info" "Running /xcatpost/mypostscript.post" "/var/log/xcat/xcat.log" "$log_label" /xcatpost/mypostscript.post msgutil_r "$MASTER_IP" "info" "/xcatpost/mypostscript.post return" "/var/log/xcat/xcat.log" "$log_label" + msgutil_r "$MASTER_IP" "info" "=============deployment ending====================" "/var/log/xcat/xcat.log" "$log_label" fi