From a11fd07dbc09dad8d9f3907c69592098deabb3d6 Mon Sep 17 00:00:00 2001 From: John Simpson Date: Fri, 8 Nov 2013 09:57:20 -0500 Subject: [PATCH] update to process firm the same as firmware --- xCAT-server/lib/xcat/plugins/ipmi.pm | 93 +++++----------------------- 1 file changed, 16 insertions(+), 77 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 51d34b41d..ffcb4be9e 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -568,7 +568,6 @@ sub on_bmc_connect { "snmpdest3", "snmpdest4", "community", - "textid", ); my @coutput; @@ -694,17 +693,6 @@ sub setnetinfo { } @cmd = (1,$channel_number,0x10,@clist); } - elsif ($subcommand eq "textid") { - if (1 or $sessdata->{isite}) { #if we have an IBM ITE system, we can go ahead and pursue this via vpd interface a la rinv - $sessdata->{do_textid}=1; - $sessdata->{set_textid}=$argument; - $sessdata->{currfruid}=0; - $sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,0x2,0x0,1,0,1,1,0],callback=>\&got_vpd_version,callback_args=>$sessdata); - return; - } else { - return(1,"unsupported command rspconfig $subcommand on this platform"); - } - } elsif($subcommand =~ m/snmpdest(\d+)/ ) { my $dstip = $argument; #pop(@input); $dstip = inet_ntoa(inet_aton($dstip)); @@ -834,17 +822,6 @@ sub getnetinfo { elsif ($subcommand eq "community") { @cmd = (0x02,$channel_number,0x10,0x00,0x00); } - elsif ($subcommand eq "textid") { - if (1 or $sessdata->{isite}) { #if we have an IBM ITE system, we can go ahead and pursue this via vpd interface a la rinv - $sessdata->{get_textid}=1; - $sessdata->{do_textid}=1; - $sessdata->{currfruid}=0; - $sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,0x2,0x0,1,0,1,1,0],callback=>\&got_vpd_version,callback_args=>$sessdata); - return; - } else { - return(1,"unsupported command rspconfig $subcommand on this platform"); - } - } else { return(1,"unsupported command getnetinfo $subcommand"); } @@ -1747,6 +1724,10 @@ sub inv { $sessdata->{skipotherfru}=1; @types = qw(asset); } + elsif($subcommand eq "firm" || $subcommand eq "firmware") { + $sessdata->{skipotherfru}=1; + @types = qw(firmware); + } elsif($subcommand eq "model") { $sessdata->{skipotherfru}=1; @types = qw(model); @@ -2820,47 +2801,7 @@ sub got_vpd_version { # block 1, $blone+0x1d0: port type first 4 bits protocol, last 3 bits addressing # block 1, $blone+0x240: 64 bytes, up to 8 sets of addresses, mac is left aligned # block 1, $blone+0x300: if mac+wwn, grab wwn - if ($sessdata->{do_textid}) { - $sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,0xca,0x0,1,$sessdata->{currfruid},1,2,0],callback=>\&got_vpd_block2,callback_args=>$sessdata); - } else { $sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,0xc8,0x0,1,$sessdata->{currfruid},1,2,0],callback=>\&got_vpd_block1,callback_args=>$sessdata); - } -} -sub got_vpd_block2 { - my $rsp = shift; - my $sessdata = shift; - unless ($rsp and not $rsp->{error} and $rsp->{code} == 0) { # if this should go wonky, jump ahead - add_fruhash($sessdata); - return; - } - $sessdata->{vpdblock2offset}=$rsp->{data}->[5]<<8+$rsp->{data}->[6]; - my $ptoffset = $sessdata->{vpdblock2offset} + 0xf0; - $sessdata->{textidoffset}=$ptoffset; - if ($sessdata->{get_textid}) { - $sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,$ptoffset&0xff,$ptoffset>>8,1,$sessdata->{currfruid},1,16,0],callback=>\&got_textid,callback_args=>$sessdata); - } elsif (defined $sessdata->{set_textid}) { - my $name = $sessdata->{set_textid}; - if ($name eq '*') { $name = $sessdata->{node}; } - my @textid = unpack("C*",$name); - my $neededspaces = 16 - scalar(@textid); - push @textid,unpack("C*"," "x$neededspaces); - $sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,$ptoffset&0xff,$ptoffset>>8,1,$sessdata->{currfruid},2,16,0,@textid],callback=>\&set_textid,callback_args=>$sessdata); - } -} -sub set_textid { - my $rsp = shift; - my $sessdata = shift; - my $ptoffset = $sessdata->{textidoffset}; - $sessdata->{ipmisession}->subcmd(netfn=>0x2e,command=>0x51,data=>[0xd0,0x51,0,$ptoffset&0xff,$ptoffset>>8,1,$sessdata->{currfruid},1,16,0],callback=>\&got_textid,callback_args=>$sessdata); -} -sub got_textid { - my $rsp = shift; - my $sessdata = shift; - my @data = @{$rsp->{data}}; - @data = @data[5..20]; - my $text = pack("C*",@data); - $text =~ s/\s*$//; - xCAT::SvrUtils::sendmsg("textid:".$text,$callback,$sessdata->{node}); } sub got_vpd_block1 { my $rsp = shift; @@ -6690,7 +6631,6 @@ sub process_request { while (xCAT::IPMI->waitforrsp()) { yield }; return; } - if ($request->{command}->[0] eq "rspconfig") { my $updatepasswd = 0; my $index = 0; @@ -6702,20 +6642,20 @@ sub process_request { $index++; } if ($updatepasswd) { - splice(@{$request->{arg}}, $index, 1); - @exargs=@{$request->{arg}}; - foreach (@donargs) { - my $cliuser = $authdata->{$_->[0]}->{cliusername}; - my $clipass = $authdata->{$_->[0]}->{clipassword}; - xCAT::IMMUtils::setupIMM($_->[0],curraddr=>$_->[1],skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$cliuser,clipassword=>$clipass,callback=>$callback); - } - if ($#exargs == -1) { - return; - } - } + splice(@{$request->{arg}}, $index, 1); + @exargs=@{$request->{arg}}; + foreach (@donargs) { + my $cliuser = $authdata->{$_->[0]}->{cliusername}; + my $clipass = $authdata->{$_->[0]}->{clipassword}; + xCAT::IMMUtils::setupIMM($_->[0],curraddr=>$_->[1],skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$cliuser,clipassword=>$clipass,callback=>$callback); + } + if ($#exargs == -1) { + return; + } + } } - # handle the rscan to scan the mic on the target node + # handle the rscan to scan the mic on the target host if ($request->{command}->[0] eq "rscan") { scan ($request, $subreq, $noderange, $extrargs); return; @@ -6770,7 +6710,6 @@ sub process_request { } } } - #donot update node provision status (installing or netbooting) here xCAT::Utils->filter_nostatusupdate(\%newnodestatus); #print "newstatus" . Dumper(\%newnodestatus);