From d1175084d68a17d0af4dee93681119d6340ddb75 Mon Sep 17 00:00:00 2001 From: linggao Date: Mon, 29 Sep 2008 14:53:58 +0000 Subject: [PATCH] more on node status monitoring git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2258 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/GlobalDef.pm | 7 ++++--- perl-xCAT/xCAT/Schema.pm | 2 +- xCAT-server/lib/xcat/monitoring/monitorctrl.pm | 14 +++++++++++++- xCAT-server/lib/xcat/monitoring/xcatmon.pm | 7 +++++++ xCAT-server/sbin/xcatnodemon | 4 +++- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/GlobalDef.pm b/perl-xCAT/xCAT/GlobalDef.pm index ab29ed600..b7d6ac58e 100644 --- a/perl-xCAT/xCAT/GlobalDef.pm +++ b/perl-xCAT/xCAT/GlobalDef.pm @@ -37,11 +37,12 @@ $::STATUS_DISCOVERING="discovering"; $::STATUS_DEFINED="defined"; $::STATUS_UNKNOWN="unknown"; -#defined->[discovering]->installing->booting->booted->alive, defined->netbooting->booted->alive, alive/unreachable->booting->booted->alive, powering-off->unreachable, alive->unreachable +#defined->[discovering]->installing->installed->booting->alive, defined->netbooting->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_BOOTING=>1}, - $::STATUS_DISCOVERING=>{$::STATUS_INSTALLING=>1}, - $::STATUS_INSTALLING =>{$::STATUS_BOOTING=>1}, + $::STATUS_DISCOVERING=>{$::STATUS_INSTALLING=>1, $::STATUS_BOOTING=>1}, + $::STATUS_INSTALLING =>{$::STATUS_INSTALLED=>1, $::STATUS_DISCOVERING=>1}, + $::STATUS_INSTALLED =>{$::STATUS_BOOTING=>1}, $::STATUS_BOOTING=>{$::STATUS_BOOTED=>1,$::STATUS_ACTIVE=>1, $::STATUS_INACTIVE=>1}, $::STATUS_NETBOOTING=>{$::STATUS_BOOTED=>1}, $::STATUS_BOOTED=>{$::STATUS_ACTIVE=>1, $::STATUS_INACTIVE=>1}, diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index c91112bc1..8e467f8f3 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -263,7 +263,7 @@ nodelist => { 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.", - status => 'The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, installing, alive, powering-off, unreachable. The default value is defined. The possible status change sequenses are: defined->[discovering]->installing->booting->booted->alive, defined->netbooting->booted->alive, alive/unreachable->booting->booted->alive, alive->powering-off->unreachable, alive->unreachable', + status => 'The current status of this node. This attribute will be set by xCAT software. Valid values: defined, booting, netbooting, booted, discovering, installing, alive, powering-off, unreachable. The default value is defined. The possible status change sequenses are: defined->[discovering]->installing->installed->booting->alive, defined->netbooting->booted->alive, alive/unreachable->booting->alive, alive->powering-off->unreachable, alive->unreachable', appstatus => "A comma-delimited list monitored applications that are active on the node. For example 'sshd,rmcd,gmond", comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", diff --git a/xCAT-server/lib/xcat/monitoring/monitorctrl.pm b/xCAT-server/lib/xcat/monitoring/monitorctrl.pm index 61570ac5f..014dfc42f 100644 --- a/xCAT-server/lib/xcat/monitoring/monitorctrl.pm +++ b/xCAT-server/lib/xcat/monitoring/monitorctrl.pm @@ -578,6 +578,7 @@ sub setNodeStatusAttributes { } my $force=shift; my $tab = xCAT::Table->new('nodelist',-create=>0,-autocommit=>1); + my $nttab = xCAT::Table->new('nodetype',-create=>0,-autocommit=>1); my %status_hash=%$temp; @@ -588,12 +589,22 @@ sub setNodeStatusAttributes { my $nodes=$status_hash{$s}; if ($nodes && (@$nodes>0)) { my $tabdata=$tab->getNodesAttribs($nodes,['node', 'status']); + my $nttabdata=$nttab->getNodesAttribs($nodes,['node', 'nodetype']); foreach my $node (@$nodes) { my $tmp1=$tabdata->{$node}->[0]; if ($tmp1) { my $status=$tmp1->{status}; if (!$status) {$status=$::STATUS_DEFINED; } #default is 'defined' - if ($::NEXT_NODESTAT_VAL{$status}->{$s}==1) { push(@new_nodes,$node); } + if ($::NEXT_NODESTAT_VAL{$status}->{$s}==1) { push(@new_nodes,$node); } + else { + #for non-osi type, always change + my $type; + my $nttmp1=$nttabdata->{$node}->[0]; + if ($nttmp1) { + $type=$nttmp1->{nodetype}; + } + if ((!$type) || ($type !~ /osi/)) {push(@new_nodes,$node);} + } } } } @@ -618,6 +629,7 @@ sub setNodeStatusAttributes { } $tab->close; + $nttab->close; return 0; } diff --git a/xCAT-server/lib/xcat/monitoring/xcatmon.pm b/xCAT-server/lib/xcat/monitoring/xcatmon.pm index a59b8f92c..cd33dea19 100644 --- a/xCAT-server/lib/xcat/monitoring/xcatmon.pm +++ b/xCAT-server/lib/xcat/monitoring/xcatmon.pm @@ -308,6 +308,9 @@ sub getMonNodesStatus { foreach(@$monnodes) { my $node=$_->[0]; my $status=$_->[2]; + my $type=$_[1]; + if (!$status) { $status=$::STATUS_DEFINED;} #default + if ($status eq $::STATUS_ACTIVE) { push(@active_nodes, $node);} elsif ($status eq $::STATUS_INACTIVE) { push(@inactive_nodes, $node);} else { @@ -318,6 +321,10 @@ sub getMonNodesStatus { if (($need_active==1) && ($need_inactive==0)) { push(@inactive_nodes, $node); } #put it into the inactive list so that the monitoring code can switch it to active. elsif (($need_active==0) && ($need_inactive==1)) { push(@active_nodes, $node); } #put it into the active list so that the monitoring code can chane it to inactive. elsif (($need_active==1) && ($need_inactive==1)) { push(@unknown_nodes, $node);} #unknow list so that the monitoring code can change it to active or inactive + else { + #if it is non-osi node, check it anyway + if ($type !~ /osi/) {push(@unknown_nodes, $node);} + } } } } diff --git a/xCAT-server/sbin/xcatnodemon b/xCAT-server/sbin/xcatnodemon index 06bddeff5..898434001 100755 --- a/xCAT-server/sbin/xcatnodemon +++ b/xCAT-server/sbin/xcatnodemon @@ -56,7 +56,9 @@ if (@changed_inactive>0) { #only set the node status for the changed ones if (keys(%node_status) > 0) { - xCAT_monitoring::xcatmon::setNodeStatusAttributes(\%node_status); + #the second parameter means ignore checking. This is because the check is + #done getMonNodesStatus() call + xCAT_monitoring::xcatmon::setNodeStatusAttributes(\%node_status, 1); } #($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);