From 9d5dede0d1a2190d7942db274d55a878bede8215 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 24 Apr 2018 03:47:45 -0400 Subject: [PATCH] update node status when enter shell/standby --- xCAT-genesis-scripts/usr/bin/doxcat | 7 ++++++- xCAT-server/lib/xcat/plugins/destiny.pm | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/xCAT-genesis-scripts/usr/bin/doxcat b/xCAT-genesis-scripts/usr/bin/doxcat index 1e909551d..e0ab88555 100755 --- a/xCAT-genesis-scripts/usr/bin/doxcat +++ b/xCAT-genesis-scripts/usr/bin/doxcat @@ -319,6 +319,11 @@ if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can a logger -s -t $log_label -p local4.info "Getting initial certificate --> $XCATMASTER:$XCATPORT" /bin/getcert $XCATMASTER:$XCATPORT fi +if [ "$destiny" ]; then + # run getdestiny to update node status + /bin/getdestiny $XCATMASTER:$XCATPORT >/dev/null 2>&1 +fi + while :; do grepconfigraid=`echo $destiny|grep "configraid"` @@ -389,7 +394,7 @@ while :; do tar xvf `basename $destparameter` ./runme.sh cd - - logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` dest=`echo $destiny|awk -F= '{print $1}'` logger -s -t $log_label -p local4.info "nextdestiny - Complete." diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 38f16ed1b..3cc38c86c 100755 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -915,6 +915,16 @@ sub getdestiny { my %node_status = (); foreach $node (@$nodes) { unless ($chaintab) { #Without destiny, have the node wait with ssh hopefully open at least + my $stat = xCAT_monitoring::monitorctrl->getNodeStatusFromNodesetState("standby", "getdestiny"); + if ($stat) { + if (exists($node_status{$stat})) { + push @{ $node_status{$stat} }, $node; + } else { + $node_status{$stat} = [$node]; + } + xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%node_status, 1); + } + $callback->({ node => [ { name => [$node], data => ['standby'], destiny => ['standby'] } ] }); return; } @@ -928,10 +938,10 @@ sub getdestiny { #print "node=$node, stat=$stat\n"; if ($stat) { if (exists($node_status{$stat})) { - my $pa = $node_status{$stat}; - push(@$pa, $node); + push @{ $node_status{$stat} }, $node; + } else { + $node_status{$stat} = [$node]; } - else { $node_status{$stat} = [$node]; } } } @@ -979,10 +989,10 @@ sub getdestiny { #print "node=$node, stat=$stat\n"; if ($stat) { if (exists($node_status{$stat})) { - my $pa = $node_status{$stat}; - push(@$pa, $node); + push @{ $node_status{$stat} }, $node; + } else { + $node_status{$stat} = [$node]; } - else { $node_status{$stat} = [$node]; } } }