-Change places in blade and ipmi plugin where error output was not treated like error output

-Add wvid support for certain service processor builds in ipmi


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2823 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2009-03-02 18:33:59 +00:00
parent d6ceff603d
commit 8b476545d6
4 changed files with 92 additions and 8 deletions

View File

@ -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];
}
}
}
}

View File

@ -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

View File

@ -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";

View File

@ -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>!argument>title=$currnode kvm</argument>!;
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]);