From 899428db2c17903bfccb391d90e94d6890ed1909 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 30 Jun 2014 12:59:46 -0400 Subject: [PATCH] defect 4178,4179: pass the [all] parameter to inventory and vitals resource, this is must have for ppc node; make the return code of rinv and rvitals always to be 0 so that rest api could handle the return message which has both success and failure. --- perl-xCAT/xCAT/FSPvitals.pm | 8 ++++---- perl-xCAT/xCAT/PPCinv.pm | 4 ++-- perl-xCAT/xCAT/PPCvitals.pm | 8 ++++---- xCAT-server/xCAT-wsapi/xcatws.cgi | 5 +++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/FSPvitals.pm b/perl-xCAT/xCAT/FSPvitals.pm index 360329c38..44549fc80 100644 --- a/perl-xCAT/xCAT/FSPvitals.pm +++ b/perl-xCAT/xCAT/FSPvitals.pm @@ -264,7 +264,7 @@ sub temp { # No frame commands for IVM ################################# if ( $hwtype eq "ivm" ) { - push @result, [$name,"$prefix Not available (No BPA)",1]; + push @result, [$name,"$prefix Not available (No BPA)",0]; next; } ################################# @@ -272,14 +272,14 @@ sub temp { ################################# if ( @$d[4] !~ /^(fsp|lpar|cec)$/ ) { my $text = "$prefix Only available for CEC/LPAR"; - push @result, [$name,$text,1]; + push @result, [$name,$text,0]; next; } ################################# # Error - No frame ################################# if ( $mtms eq "0" ) { - push @result, [$name,"$prefix Not available (No BPA)",1]; + push @result, [$name,"$prefix Not available (No BPA)",0]; next; } ################################# @@ -352,7 +352,7 @@ sub rackenv { ################################# if ( @$d[4] !~ /^(bpa|frame)$/ ) { my $text = "$prefix Only available for BPA/Frame"; - push @result, [$name,$text,1]; + push @result, [$name,$text,0]; next; } diff --git a/perl-xCAT/xCAT/PPCinv.pm b/perl-xCAT/xCAT/PPCinv.pm index ea7f0d0c0..24d06ac79 100644 --- a/perl-xCAT/xCAT/PPCinv.pm +++ b/perl-xCAT/xCAT/PPCinv.pm @@ -347,7 +347,7 @@ sub bus { ################################# # Output header ################################# - push @result, [$name,"I/O Bus Information"]; + push @result, [$name,"I/O Bus Information", 0]; ################################# # Output error @@ -532,7 +532,7 @@ sub config { ################################# # Output header ################################# - push @result, [$name,"Machine Configuration Info"]; + push @result, [$name,"Machine Configuration Info", 0]; my $i; foreach ( @prefix ) { diff --git a/perl-xCAT/xCAT/PPCvitals.pm b/perl-xCAT/xCAT/PPCvitals.pm index e993400c7..375a48f0b 100644 --- a/perl-xCAT/xCAT/PPCvitals.pm +++ b/perl-xCAT/xCAT/PPCvitals.pm @@ -203,7 +203,7 @@ sub voltage { # Voltages available in frame ################################# if ( @$d[4] ne "bpa" ) { - push @result, [$name,"$text Only available for BPA",1]; + push @result, [$name,"$text Only available for BPA",0]; next; } my $volt = enumerate_volt( $exp, $d ); @@ -256,7 +256,7 @@ sub temp { # No frame commands for IVM ################################# if ( $hwtype eq "ivm" ) { - push @result, [$name,"$prefix Not available (No BPA)",1]; + push @result, [$name,"$prefix Not available (No BPA)",0]; next; } ################################# @@ -264,14 +264,14 @@ sub temp { ################################# if ( @$d[4] !~ /^(fsp|cec|lpar)$/ ) { my $text = "$prefix Only available for CEC/LPAR"; - push @result, [$name,$text,1]; + push @result, [$name,$text,0]; next; } ################################# # Error - No frame ################################# if ( $mtms eq "0" ) { - push @result, [$name,"$prefix Not available (No BPA)",1]; + push @result, [$name,"$prefix Not available (No BPA)",0]; next; } ################################# diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 1ef36af5d..879bf81b6 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1585,6 +1585,9 @@ sub actionout { # use resourcename as the record name if ($param->{'resourcename'} eq "eventlog") { push @{$jsonnode->{$d->{node}->[0]->{name}->[0]}->{$param->{'resourcename'}}}, $d->{node}->[0]->{data}->[0]->{contents}->[0]; + } elsif ($param->{'resourcename'} =~ /(vitals|inventory)/) { + # handle output of rvital and rinv for ppc node + push @{$jsonnode->{$d->{node}->[0]->{name}->[0]}}, $d->{node}->[0]->{data}->[0]->{contents}->[0]; } else { $jsonnode->{$d->{node}->[0]->{name}->[0]}->{$param->{'resourcename'}} = $d->{node}->[0]->{data}->[0]->{contents}->[0]; } @@ -1756,6 +1759,8 @@ sub actionhdl { if (defined($urilayers[3])) { my @attrs = split(';', $urilayers[3]); push @args, @attrs; + } else { # default, get all attrs + push @args, "all"; } } elsif ($params->{'resourcename'} eq "serviceprocessor") { if (isGET()) {