From dd4fd4b76be51e328069e4ef6bb1472c260f65e7 Mon Sep 17 00:00:00 2001 From: sjing Date: Wed, 24 Nov 2010 07:07:56 +0000 Subject: [PATCH] support xcatmon push model for HPC software. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8256 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/updatenode.pm | 62 +++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index d3aef9df1..564b0a265 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -51,7 +51,8 @@ sub handled_commands { return { updatenode => "updatenode", - updatenodestat => "updatenode" + updatenodestat => "updatenode", + updatenodeappstat => "updatenode" }; } @@ -84,6 +85,10 @@ sub preprocess_request { return [$request]; } + elsif ($command eq "updatenodeappstat") + { + return [$request]; + } else { my $rsp = {}; @@ -127,6 +132,10 @@ sub process_request { return updatenodestat($request, $callback); } + elsif ($command eq "updatenodeappstat") + { + return updatenodeappstat($request, $callback); + } else { my $rsp = {}; @@ -2525,3 +2534,54 @@ sub updateOS { return; } + +#------------------------------------------------------------------------------- + +=head3 updatenodeappstat + This subroutine is used to handle the messages reported by + HPCbootstatus postscript. Update appstatus node attribute. + + Arguments: + Returns: + 0 - for success. + 1 - for error. + +=cut + +#----------------------------------------------------------------------------- +sub updatenodeappstat +{ + my $request = shift; + my $callback = shift; + my @nodes = (); + my @args = (); + if (ref($request->{node})) + { + @nodes = @{$request->{node}}; + } + else + { + if ($request->{node}) { @nodes = ($request->{node}); } + } + if (ref($request->{arg})) + { + @args = @{$request->{arg}}; + } + else + { + @args = ($request->{arg}); + } + + if ((@nodes > 0) && (@args > 0)) + { + # format: apps=status + my $appstat = $args[0]; + my ($apps, $newstatus) = split(/=/,$appstat); + + xCAT::Utils->setAppStatus(\@nodes, $apps, $newstatus); + + } + + return 0; +} +