mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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}, | ||||
|   | ||||
| @@ -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.", | ||||
|   | ||||
| @@ -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; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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);} | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user