diff --git a/xCAT-client/bin/wvid b/xCAT-client/bin/wvid index 80bc8f80b..c2247f011 100755 --- a/xCAT-client/bin/wvid +++ b/xCAT-client/bin/wvid @@ -19,7 +19,11 @@ sub process_response { my $resp = shift; foreach my $rst (\@{$resp->{node}}) { foreach my $rsp (@$rst) { - $rvidhash{$rsp->{name}->[0]}->{$rsp->{data}->[0]->{desc}->[0]} = $rsp->{data}->[0]->{contents}->[0]; + if ($rsp->{errorcode}) { + print $rsp->{name}->[0].": Error: ".$rsp->{error}->[0]."\n"; + } else { + $rvidhash{$rsp->{name}->[0]}->{$rsp->{data}->[0]->{desc}->[0]} = $rsp->{data}->[0]->{contents}->[0]; + } } } } diff --git a/xCAT-client/share/xcat/rvid/rvid.imm b/xCAT-client/share/xcat/rvid/rvid.imm new file mode 100755 index 000000000..a1691c32d --- /dev/null +++ b/xCAT-client/share/xcat/rvid/rvid.imm @@ -0,0 +1,16 @@ +#!/bin/bash +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +mkdir -p /tmp/xcat +JAVADETECTED=`which javaws 2> /dev/null` +if [ -z "$JAVADETECTED" ]; then + echo "Error: javaws not in path, unable to execute remote video" + exit 1 +fi +echo $rvid_jnlp > /tmp/xcat/wvid_imm_$$.jnlp +javaws /tmp/xcat/wvid_imm_$$.jnlp >& /dev/null +if [ ! -z "$rvid_mediajnlp" ]; then + echo $rvid_jnlp > /tmp/xcat/wvid_imm_media_$$.jnlp + javaws /tmp/xcat/wvid_imm_media_$$.jnlp >& /dev/null + rm /tmp/xcat/wvid_imm_media_$$.jnlp >& /dev/null +fi +rm /tmp/xcat/wvid_imm_$$.jnlp >& /dev/null diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 06bb2565a..224d3c659 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -2076,7 +2076,7 @@ sub process_request { # only 1 node when changing textid to something other than '*' if ($command eq "rspconfig" and grep(/^textid=[^*]/,@exargs)) { if ( @$noderange > 1 ) { - $callback->({data=>["Single node required when changing textid"], + $callback->({error=>["Single node required when changing textid"], errorcode=>1}); return; } @@ -2763,7 +2763,11 @@ sub dompa { $text =~ s/\s+$//; $output{node}->[0]->{errorcode} = $rc; $output{node}->[0]->{name}->[0]=$node; - $output{node}->[0]->{data}->[0]->{contents}->[0]=$text; + if ($rc) { + $output{node}->[0]->{error}->[0]=$text; + } else { + $output{node}->[0]->{data}->[0]->{contents}->[0]=$text; + } print $out freeze([\%output]); print $out "\nENDOFFREEZE6sK4ci\n"; @@ -2878,7 +2882,11 @@ sub dompa { $text =~ s/\s+$//; $output{node}->[0]->{errorcode} = $rc; $output{node}->[0]->{name}->[0]=$node; - $output{node}->[0]->{data}->[0]->{contents}->[0]=$text; + if ($rc) { + $output{node}->[0]->{error}->[0]=$text; + } else { + $output{node}->[0]->{data}->[0]->{contents}->[0]=$text; + } } print $out freeze([\%output]); print $out "\nENDOFFREEZE6sK4ci\n"; diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index ced1e8fc0..b192a9bd8 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,10 +73,12 @@ 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; my $ndebug = 0; +my @cmdargv; my $sock; my @user; my @pass; @@ -459,8 +464,9 @@ sub ipmicmd { $authoffset=0; my $command = shift; + @cmdargv = @_; my $subcommand = shift; - my @leftovers = @_; + my $rc=0; my $text=""; @@ -473,11 +479,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 +602,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 +1268,51 @@ 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]==0x59 and $build_id[2]==0x55 and $build_id[3]==0x4f and $build_id[4]==0x4f) { #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"); + my $jnlp = $response->content; + if ($jnlp =~ /This advanced option requires the purchase and installation/) { + return (1,"Node does not have feature key for remote video"); + } + $jnlp =~ s!argument>title=.*Video Viewer!argument>title=$currnode kvm!; + my @return=("method:imm","jnlp:$jnlp"); + if (grep /-m/,@cmdargv) { + $response = $browser->request(GET $baseurl."/kvm/vm/jnlp"); + push @return,"mediajnlp:".$response->content; + } + return (0,@return); +} + + sub power { my $subcommand = shift; @@ -5726,9 +5780,11 @@ sub sendoutput { $text =~ s/^\s+//; $text =~ s/\s+$//; $output{node}->[0]->{name}->[0]=$currnode; - $output{node}->[0]->{data}->[0]->{contents}->[0]=$text; if ($rc) { $output{node}->[0]->{errorcode}=[$rc]; + $output{node}->[0]->{error}->[0]=$text; + } else { + $output{node}->[0]->{data}->[0]->{contents}->[0]=$text; } #push @outhashes,\%output; #Save everything for the end, don't know how to be slicker with Storable and a pipe print $outfd freeze([\%output]);