From 776a6f936db790e6fea7657322d3867e8f54e7dc Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 30 Mar 2012 18:33:15 +0000 Subject: [PATCH] Add a hidden ripmi directive for debug and development support git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12076 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/ipmi.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ed6ae8cc3..ec7169c92 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -52,6 +52,7 @@ sub handled_commands { rsetboot => 'nodehm:mgt', #done rbeacon => 'nodehm:mgt', #done reventlog => 'nodehm:mgt', + ripmi => 'ipmi', # rfrurewrite => 'nodehm:mgt', #deferred, doesn't even work on several models, no one asks about it, keeping it commented for future requests getrvidparms => 'nodehm:mgt' #done } @@ -484,6 +485,8 @@ sub on_bmc_connect { return; } return power($sessdata); + } elsif ($command eq "ripmi") { + return ripmi($sessdata); } elsif ($command eq "rspreset") { return resetbmc($sessdata); } elsif($command eq "rbeacon") { @@ -1149,6 +1152,31 @@ sub getrvidparms_with_buildid { } +sub ripmi { #implement generic raw ipmi commands + my $sessdata = shift; + my $netfun = hex(shift @{$sessdata->{extraargs}}); + my $command = hex(shift @{$sessdata->{extraargs}}); + my @data; + foreach (@{$sessdata->{extraargs}}) { + push @data,hex($_); + } + $sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@data,callback=>\&ripmi_callback,callback_args=>$sessdata); +} + +sub ripmi_callback { + if (check_rsp_errors(@_)) { + return; + } + my $rsp = shift; + my $sessdata = shift; + if ($rsp->{error}) { + xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes); + return; + } + my $output=sprintf("%02X "x(scalar(@{$rsp->{data}})),@{$rsp->{data}}); + xCAT::SvrUtils::sendmsg($output,$callback,$sessdata->{node},%allerrornodes); +} + sub power { my $sessdata = shift;