From c52ece42d853350c4990ee256155f5ae0343a71a Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 21 Jan 2009 20:57:32 +0000 Subject: [PATCH] -Fix typo in previous checkin git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2635 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 2 +- xCAT-server/lib/xcat/plugins/ipmi.pm | 46 +++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 68490f446..66095cf43 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -538,7 +538,7 @@ sub mpaconfig { } setoid("1.3.6.1.4.1.2.3.51.2.4.9.3.1.4.1.1.".(2+$dstindex).".1",1,$value,'OCTET'); setoid("1.3.6.1.4.1.2.3.51.2.4.9.3.1.4.1.1.6.1",1,1,'INTEGER'); #access type: read-traps, don't give full write access to the community - if (restorev1agent) { #If we had to transiently disable the v1 agent, put it back the way it was + if ($restorev1agent) { #If we had to transiently disable the v1 agent, put it back the way it was setoid('1.3.6.1.4.1.2.3.51.2.4.9.3.1.5',0,1,'INTEGER'); } diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ced1e8fc0..4d1052ab9 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -19,6 +19,8 @@ use Storable qw(store_fd retrieve_fd thaw freeze); use xCAT::Utils; use xCAT::Usage; use Thread qw(yield); +use LWP 5.64; +use HTTP::Request::Common; my $tfactor = 0; my $vpdhash; my %bmc_comm_pids; @@ -41,6 +43,7 @@ sub handled_commands { rbeacon => 'nodehm:mgt', reventlog => 'nodehm:mgt', rfrurewrite => 'nodehm:mgt', + getrvidparms => 'nodehm:mgt' } } @@ -70,6 +73,7 @@ my $currnode; #string to describe current node, presumably nodename my $globrc=0; my $userid; my $passwd; +my $ipmi_bmcipaddr; my $timeout; my $port; my $debug; @@ -473,11 +477,11 @@ sub ipmicmd { $text = "failed to get IP for $node"; return(2,$text); } - my $nodeip = inet_ntoa($packed_ip); + $ipmi_bmcipaddr=inet_ntoa($packed_ip); $sock = IO::Socket::INET->new( Proto => 'udp', - PeerHost => $nodeip, + PeerHost => $ipmi_bmcipaddr, PeerPort => $port, ); if(!defined($sock)) { @@ -596,6 +600,9 @@ sub ipmicmd { elsif($command eq "rbeacon") { ($rc,$text) = beacon($subcommand); } + elsif($command eq "getrvidparms") { + ($rc,@output) = getrvidparms($subcommand); + } # elsif($command eq "info") { # if($subcommand eq "sensorname") { # ($rc,$text) = initsdr(); @@ -1259,6 +1266,41 @@ sub idpxthermprofile { } +sub getrvidparms { + my $netfun = 0x3a; + my @mcinfo=getdevid(); + unless ($mcinfo[2] == 2) { #Only implemented for IBM servers + return(1,"Remote video is not supported on this system"); + } + #TODO: use get bmc capabilities to see if rvid is actually supported before bothering the client java app + my @build_id; + my $localerror = docmd( + 0xe8, + [0x50], + \@build_id + ); + if ($localerror) { + return(1,$localerror); + } + @build_id=splice @build_id,36-$authoffset; + unless ($build_id[1]==0x79 and $build_id[2]==0x75 and $build_id[3]==0x6f and $build_id[4]==0x6f) { #Only know how to cope with yuoo builds + return(1,"Remote video is not supported on this system"); + } + #wvid should be a possiblity, time to do the http... + my $browser = LWP::UserAgent->new(); + my $message = "$userid,$passwd"; + $browser->cookie_jar({}); + my $baseurl = "http://".$ipmi_bmcipaddr."/"; + my $response = $browser->request(POST $baseurl."/session/create",'Content-Type'=>"text/xml",Content=>$message); + unless ($response->content eq "ok") { + return (1,"Server returned unexpected data"); + } + + $response = $browser->request(GET $baseurl."/kvm/kvm/jnlp"); + return (0,"method:imm","jnlp:".$response->content); +} + + sub power { my $subcommand = shift;