diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 196d1ec9a..48a81f391 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -60,6 +60,9 @@ my %usage = ( BMC specific: rspconfig [ip|netmask|gateway|backupgateway|garp] rspconfig [garp=] + iDataplex specific: + rspconfig [thermprofile] + rspconfig [thermprofile=] MPA specific: rspconfig [sshcfg|snmpcfg|build|pd1|pd2|network|swnet|ntp|textid] rspconfig [textid=name] diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index aed500ec5..9f2b13aeb 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -76,6 +76,15 @@ use xCAT::data::ipmigenericevents; use xCAT::data::ipmisensorevents; my $cache_version = 1; +my %idpxthermbytes = ( #Data to enact the profile quickly + '0z' => [0x0A,0x37,0x41,0x3C,0x0a,0x0a,0x1e], + '1a' => [0x0A,0x30,0x3C,0x3C,0x0a,0x0a,0x1e], + '2b' => [0x0A,0x30,0x3C,0x3C,0x0a,0x0a,0x1e], + '3c' => [0x0A,0x30,0x3C,0x3C,0x0a,0x0a,0x1e], + '4d' => [0x0A,0x37,0x44,0x3C,0x0a,0x0a,0x1e], + '5e' => [0x0A,0x37,0x44,0x3C,0x0a,0x0a,0x1e], + '6f' => [0x0A,0x35,0x44,0x3C,0x0a,0x0a,0x1e], +); my %codes = ( 0x00 => "Command Completed Normal", 0xC0 => "Node busy, command could not be processed", @@ -814,10 +823,14 @@ sub setnetinfo { if($subcommand eq "snmpdest") { $subcommand = "snmpdest1"; } + unless(defined($argument)) { return 0; } + if ($subcommand eq "thermprofile") { + return idpxthermprofile($argument); + } if ($subcommand eq "alert" and $argument eq "on" or $argument =~ /^en/ or $argument =~ /^enable/) { $netfun = 0x10; @cmd = (0x12,0x9,0x1,0x18,0x11,0x00); @@ -900,6 +913,32 @@ sub setnetinfo { sub getnetinfo { my $subcommand = shift; $subcommand =~ s/=.*//; + if ($subcommand eq "thermprofile") { + my $code; + my @returnd; + my $thermdata; + foreach (0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6) { + docmd(0x18,[0x52,0x15,0x40,0x1,$_],\@returnd); + $code = $returnd[36-$authoffset]; + if ($code eq 0) { + $thermdata.= sprintf("%02x ",$returnd[37-$authoffset]); + } else { + return (1,"Error reading thermal profile data for this server"); + } + } + chop($thermdata); + my $validprofiles=""; + foreach (keys %idpxthermbytes) { + if ($thermdata eq sprintf("%02x %02x %02x %02x %02x %02x %02x",@{$idpxthermbytes{$_}})) { + $validprofiles.="$_,"; + } + } + if ($validprofiles) { + chop($validprofiles); + return (0,"The following thermal profiles are in effect: ".$validprofiles); + } + return (1,"Unable to identify current thermal profile: \"$thermdata\""); + } my $netfun = 0x30; my @cmd; @@ -1187,6 +1226,44 @@ sub setboot { return($rc,$text); } +sub idpxthermprofile { + #iDataplex thermal profiles as of 6/10/2008 + my $subcommand = lc(shift); + my @returnd; + my $netfun = 0xb8; + my @cmd = (0x41,0x4d,0x4f,0x00,0x6f,0xfe,0x60,0,00,0,0,0,0,0xff); + #Hash for extensibility + my %thermprofiles = ( + '0z' => [0x37,0x41,0,0,0,0,6,0xa,0x3c,0xa,0xa,0x1e,0x6], + '1a' => [0x30,0x3c,0,0,0,0,6,0xa,0x3c,0xa,0xa,0x1e,0x6], + '2b' => [0x30,0x3c,0,0,0,0,6,0xa,0x3c,0xa,0xa,0x1e,0x6], + '3c' => [0x30,0x3c,0,0,0,0,6,0xa,0x3c,0xa,0xa,0x1e,0x6], + '4d' => [0x37,0x44,0,0,0,0,6,0xa,0x3c,0xa,0xa,0x1e,0x6], + '5e' => [0x37,0x44,0,0,0,0,6,0xa,0x3c,0xa,0xa,0x1e,0x6], + '6f' => [0x35,0x44,0,0,0,0,6,0xa,0x3c,0xa,0xa,0x1e,0x6], + ); + if ($thermprofiles{$subcommand}) { + push @cmd,@{$thermprofiles{$subcommand}}; + } else { + return (1,"Not an understood thermal profile, expected a 2 hex digit value corresponding to chassis label on iDataplex server"); + } + docmd( + $netfun, + \@cmd, + \@returnd + ); + #The BMC now understands the thermal profile, for immediate results, push to power supply now + my @directbytes = @{$idpxthermbytes{$subcommand}}; + my $dindex=0; + foreach (@directbytes) { + @cmd = (0x52,0x15,0x40,0x0,0xe0+$dindex,$_); + docmd(0x18,\@cmd,\@returnd); + $dindex++; + } + return (0,"OK"); +} + + sub power { my $subcommand = shift;