From c0074cf8ab6f6fe85faffa48a456256c37d25db7 Mon Sep 17 00:00:00 2001 From: Bin Xu Date: Fri, 19 Jan 2018 16:39:11 +0800 Subject: [PATCH] Add the 'postbooting' status to indicate xCAT start to handle postboot tasks (#4346) (#4369) - for diskful, it will be set when leaving 'booting' stage - for diskless, it will be set when leaving 'netbooting' stage - for diskful reboot, it will set when (site.runpostscript=1) - modify the document accordingly - also modify GlobalDef.pm, but it won't have impact as the status will not be in nodeset operation. --- .../guides/admin-guides/references/man5/nodelist.5.rst | 2 +- .../guides/admin-guides/references/man7/node.7.rst | 2 +- perl-xCAT/xCAT/GlobalDef.pm | 9 ++++++--- perl-xCAT/xCAT/Schema.pm | 2 +- xCAT/postscripts/xcatpostinit1.install | 9 ++++++--- xCAT/postscripts/xcatpostinit1.netboot | 4 +++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man5/nodelist.5.rst b/docs/source/guides/admin-guides/references/man5/nodelist.5.rst index bb70e22b4..7dbe45086 100644 --- a/docs/source/guides/admin-guides/references/man5/nodelist.5.rst +++ b/docs/source/guides/admin-guides/references/man5/nodelist.5.rst @@ -50,7 +50,7 @@ nodelist Attributes: \ **status**\ - The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, configuring, installing, alive, standingby, powering-off, unreachable. If blank, defined is assumed. The possible status change sequences are: For installation: defined->[discovering]->[configuring]->[standingby]->installing->booting->booted->[alive], For diskless deployment: defined->[discovering]->[configuring]->[standingby]->netbooting->booted->[alive], For booting: [alive/unreachable]->booting->[alive], For powering off: [alive]->powering-off->[unreachable], For monitoring: alive->unreachable. Discovering and configuring are for x Series discovery process. Alive and unreachable are set only when there is a monitoring plug-in start monitor the node status for xCAT. Note that the status values will not reflect the real node status if you change the state of the node from outside of xCAT (i.e. power off the node using HMC GUI). + The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, configuring, installing, alive, standingby, powering-off, unreachable. If blank, defined is assumed. The possible status change sequences are: For installation: defined->[discovering]->[configuring]->[standingby]->installing->booting->[postbooting]->booted->[alive], For diskless deployment: defined->[discovering]->[configuring]->[standingby]->netbooting->[postbooting]->booted->[alive], For booting: [alive/unreachable]->booting->[postbooting]->booted->[alive], For powering off: [alive]->powering-off->[unreachable], For monitoring: alive->unreachable. Discovering and configuring are for x Series discovery process. Alive and unreachable are set only when there is a monitoring plug-in start monitor the node status for xCAT. Note that the status values will not reflect the real node status if you change the state of the node from outside of xCAT (i.e. power off the node using HMC GUI). diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index 63d82dfa8..eb772d3b5 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -1131,7 +1131,7 @@ node Attributes: \ **status**\ (nodelist.status) - The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, configuring, installing, alive, standingby, powering-off, unreachable. If blank, defined is assumed. The possible status change sequences are: For installation: defined->[discovering]->[configuring]->[standingby]->installing->booting->booted->[alive], For diskless deployment: defined->[discovering]->[configuring]->[standingby]->netbooting->booted->[alive], For booting: [alive/unreachable]->booting->[alive], For powering off: [alive]->powering-off->[unreachable], For monitoring: alive->unreachable. Discovering and configuring are for x Series discovery process. Alive and unreachable are set only when there is a monitoring plug-in start monitor the node status for xCAT. Note that the status values will not reflect the real node status if you change the state of the node from outside of xCAT (i.e. power off the node using HMC GUI). + The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, configuring, installing, alive, standingby, powering-off, unreachable. If blank, defined is assumed. The possible status change sequences are: For installation: defined->[discovering]->[configuring]->[standingby]->installing->booting->[postbooting]->booted->[alive], For diskless deployment: defined->[discovering]->[configuring]->[standingby]->netbooting->[postbooting]->booted->[alive], For booting: [alive/unreachable]->booting->[postbooting]->booted->[alive], For powering off: [alive]->powering-off->[unreachable], For monitoring: alive->unreachable. Discovering and configuring are for x Series discovery process. Alive and unreachable are set only when there is a monitoring plug-in start monitor the node status for xCAT. Note that the status values will not reflect the real node status if you change the state of the node from outside of xCAT (i.e. power off the node using HMC GUI). diff --git a/perl-xCAT/xCAT/GlobalDef.pm b/perl-xCAT/xCAT/GlobalDef.pm index b9b99ea20..19cc18828 100644 --- a/perl-xCAT/xCAT/GlobalDef.pm +++ b/perl-xCAT/xCAT/GlobalDef.pm @@ -46,6 +46,7 @@ $::STATUS_INACTIVE = "unreachable"; $::STATUS_INSTALLING = "installing"; $::STATUS_INSTALLED = "installed"; $::STATUS_BOOTING = "booting"; +$::STATUS_POSTBOOTING = "postbooting"; $::STATUS_NETBOOTING = "netbooting"; $::STATUS_BOOTED = "booted"; $::STATUS_POWERING_ON = "powering-on"; @@ -66,6 +67,7 @@ $::STATUS_BMCREADY = "bmcready"; $::STATUS_INSTALLING => 1, $::STATUS_INSTALLED => 1, $::STATUS_BOOTING => 1, + $::STATUS_POSTBOOTING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_BOOTED => 1, $::STATUS_POWERING_ON => 1, @@ -86,15 +88,16 @@ $::STATUS_BMCREADY = "bmcready"; $::STATUS_SYNCED => 1, ); -#defined->[discovering]->[configuring]->[standingby]->installing->[installed]->booting->alive, defined->[discovering]->[configuring]-[standingby]->netbooting->booted->alive, alive/unreachable->booting->alive, powering-off->unreachable, alive->unreachable +#defined->[discovering]->[configuring]->[standingby]->installing->[installed]->booting->[postbooting]->booted->alive, defined->[discovering]->[configuring]-[standingby]->netbooting->[postbooting]->booted->alive, alive/unreachable->booting->alive, powering-off->unreachable, alive->unreachable %::NEXT_NODESTAT_VAL = ( $::STATUS_DEFINED => { $::STATUS_DISCOVERING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1, $::STATUS_BOOTING => 1, $::STATUS_CONFIGURING => 1 }, $::STATUS_DISCOVERING => { $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_BOOTING => 1 }, $::STATUS_CONFIGURING => { $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_STANDING_BY => 1 }, $::STATUS_INSTALLING => { $::STATUS_INSTALLED => 1, $::STATUS_BOOTING => 1 }, $::STATUS_INSTALLED => { $::STATUS_BOOTING => 1 }, - $::STATUS_BOOTING => { $::STATUS_BOOTED => 1, $::STATUS_ACTIVE => 1, $::STATUS_INACTIVE => 1 }, - $::STATUS_NETBOOTING => { $::STATUS_BOOTED => 1 }, + $::STATUS_BOOTING => { $::STATUS_BOOTED => 1, $::STATUS_ACTIVE => 1, $::STATUS_INACTIVE => 1, $::STATUS_POSTBOOTING => 1 }, + $::STATUS_POSTBOOTING => { $::STATUS_BOOTED => 1 }, + $::STATUS_NETBOOTING => { $::STATUS_POSTBOOTING => 1, $::STATUS_BOOTED => 1 }, $::STATUS_BOOTED => { $::STATUS_ACTIVE => 1, $::STATUS_INACTIVE => 1 }, $::STATUS_ACTIVE => { $::STATUS_INACTIVE => 1, $::STATUS_DISCOVERING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1 }, $::STATUS_INACTIVE => { $::STATUS_ACTIVE => 1, $::STATUS_DISCOVERING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1 }, diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 487ab0ac2..76eada918 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -624,7 +624,7 @@ passed as argument rather than by table value', descriptions => { node => 'The hostname of a node in the cluster.', groups => "A comma-delimited list of groups this node is a member of. Group names are arbitrary, except all nodes should be part of the 'all' group. Internal group names are designated by using __. For example, __Unmanaged, could be the internal name for a group of nodes that is not managed by xCAT. Admins should avoid using the __ characters when defining their groups.", - status => 'The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, configuring, installing, alive, standingby, powering-off, unreachable. If blank, defined is assumed. The possible status change sequences are: For installation: defined->[discovering]->[configuring]->[standingby]->installing->booting->booted->[alive], For diskless deployment: defined->[discovering]->[configuring]->[standingby]->netbooting->booted->[alive], For booting: [alive/unreachable]->booting->[alive], For powering off: [alive]->powering-off->[unreachable], For monitoring: alive->unreachable. Discovering and configuring are for x Series discovery process. Alive and unreachable are set only when there is a monitoring plug-in start monitor the node status for xCAT. Note that the status values will not reflect the real node status if you change the state of the node from outside of xCAT (i.e. power off the node using HMC GUI).', + status => 'The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, configuring, installing, alive, standingby, powering-off, unreachable. If blank, defined is assumed. The possible status change sequences are: For installation: defined->[discovering]->[configuring]->[standingby]->installing->booting->[postbooting]->booted->[alive], For diskless deployment: defined->[discovering]->[configuring]->[standingby]->netbooting->[postbooting]->booted->[alive], For booting: [alive/unreachable]->booting->[postbooting]->booted->[alive], For powering off: [alive]->powering-off->[unreachable], For monitoring: alive->unreachable. Discovering and configuring are for x Series discovery process. Alive and unreachable are set only when there is a monitoring plug-in start monitor the node status for xCAT. Note that the status values will not reflect the real node status if you change the state of the node from outside of xCAT (i.e. power off the node using HMC GUI).', statustime => "The data and time when the status was updated.", appstatus => "A comma-delimited list of application status. For example: 'sshd=up,ftp=down,ll=down'", appstatustime => 'The date and time when appstatus was updated.', diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install index 96fd3f72e..21bf77392 100755 --- a/xCAT/postscripts/xcatpostinit1.install +++ b/xCAT/postscripts/xcatpostinit1.install @@ -28,7 +28,7 @@ fi case $1 in stop) - [ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off" + [ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off" ;; start) # check for the REBOOT specified in xcatinfo to run post boot scripts on reboot @@ -37,11 +37,14 @@ start) fi # if the xcatdsklspost file exists and this is a reboot - run xcatdsklspost with a mode of 6 if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost ] && [[ "$RUNBOOTSCRIPTS" =~ ^(1|yes|y)$ ]]; then + [ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus postbooting" + # xcatdsklspost will set the status to 'booted' or 'failed' /opt/xcat/xcatdsklspost 6 elif [ "$REBOOT" = "TRUE" ] && [[ "$NODESTATUS" =~ ^(1|yes|y)$ ]]; then - /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus booted" + /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus booted" else - # run /opt/xcat/xcatinstallpost + [ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus postbooting" + # run /opt/xcat/xcatinstallpost, it will set the status to 'booted' or 'failed' if [ -r /opt/xcat/xcatinstallpost ]; then /opt/xcat/xcatinstallpost fi diff --git a/xCAT/postscripts/xcatpostinit1.netboot b/xCAT/postscripts/xcatpostinit1.netboot index 099c0b725..f21ba9c73 100755 --- a/xCAT/postscripts/xcatpostinit1.netboot +++ b/xCAT/postscripts/xcatpostinit1.netboot @@ -34,7 +34,7 @@ status) stop) echo -n "nothing to stop " logger -t xcat -p local4.info "nothing to stop" - grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off" + grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off" ;; start) # Node is stateless by default @@ -56,10 +56,12 @@ start) # Test for script existance if ! [ -x "$SCRIPT" ]; then msg "can't locate executable $SCRIPT" + grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus failed" exit -1 fi # Run $SCRIPT according to node type + grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus postbooting" if [ $STATELITE -ne 0 ]; then logger -t xcat -p local4.info "Call $SCRIPT for statelite mode" "$SCRIPT" 4