mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	Enable a node to control reporting of it's own state more carefully... provided it has an x509 certificate we bless.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13608 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -48,6 +48,22 @@ $::STATUS_STANDING_BY="standingby"; | ||||
| $::STATUS_SHELL="shell"; | ||||
| $::STATUS_DEFINED="defined"; | ||||
| $::STATUS_UNKNOWN="unknown"; | ||||
| %::VALID_STATUS_VALUES = ( | ||||
| 	$::STATUS_ACTIVE=>1, | ||||
| 	$::STATUS_INACTIVE=>1, | ||||
| 	$::STATUS_INSTALLING=>1, | ||||
| 	$::STATUS_INSTALLED=>1, | ||||
| 	$::STATUS_BOOTING=>1, | ||||
| 	$::STATUS_NETBOOTING=>1, | ||||
| 	$::STATUS_BOOTED=>1, | ||||
| 	$::STATUS_POWERING_OFF=>1, | ||||
| 	$::STATUS_DISCOVERING=>1, | ||||
| 	$::STATUS_CONFIGURING=>1, | ||||
| 	$::STATUS_STANDING_BY=>1, | ||||
| 	$::STATUS_SHELL=>1, | ||||
| 	$::STATUS_DEFINED=>1, | ||||
| 	$::STATUS_UNKNOWN=>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 | ||||
| %::NEXT_NODESTAT_VAL=( | ||||
|   | ||||
| @@ -56,6 +56,7 @@ sub handled_commands | ||||
|     return { | ||||
|             updatenode     => "updatenode", | ||||
|             updatenodestat => "updatenode", | ||||
|             updatemynodestat => "updatenode", | ||||
|             updatenodeappstat => "updatenode" | ||||
|             }; | ||||
| } | ||||
| @@ -89,6 +90,10 @@ sub preprocess_request | ||||
|     { | ||||
|         return [$request]; | ||||
|     } | ||||
|     elsif ($command eq "updatemynodestat") | ||||
|     { | ||||
|         return [$request]; | ||||
|     } | ||||
|     elsif ($command eq "updatenodeappstat") | ||||
|     { | ||||
|         return [$request]; | ||||
| @@ -136,6 +141,11 @@ sub process_request | ||||
|     { | ||||
|         return updatenodestat($request, $callback); | ||||
|     } | ||||
|     elsif ($command eq "updatemynodestat") | ||||
|     { | ||||
| 	delete $request->{node}; #the restricted form of this command must be forbidden from specifying other nodes, only can set it's own value | ||||
|         return updatenodestat($request, $callback); | ||||
|     } | ||||
|     elsif ($command eq "updatenodeappstat") | ||||
|     { | ||||
|         return updatenodeappstat($request, $callback); | ||||
| @@ -1322,7 +1332,11 @@ sub updatenodestat | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|         if ($request->{node}) { @nodes = ($request->{node}); } | ||||
|         if ($request->{node}) { @nodes = ($request->{node}); }  | ||||
|         else { #client asking to update its own status... | ||||
| 		unless (ref $request->{username}) { return; } #TODO: log an attempt without credentials?  | ||||
| 		@nodes = @{$request->{username}}; | ||||
|         } | ||||
|     } | ||||
|     if (ref($request->{arg})) | ||||
|     { | ||||
| @@ -1337,6 +1351,7 @@ sub updatenodestat | ||||
|     { | ||||
|         my %node_status = (); | ||||
|         my $stat        = $args[0]; | ||||
|         unless ($::VALID_STATUS_VALUES{$stat}) { return; } #don't accept just any string, see GlobalDef for updates | ||||
|         $node_status{$stat} = []; | ||||
|         foreach my $node (@nodes) | ||||
|         { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user