From 4b5a7005b1fc7913246d20945fdfacf9335b57fa Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Fri, 23 Nov 2012 11:07:12 +0000 Subject: [PATCH] add LCD info with 'rvitals all' for Firebird blade git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@14417 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 28 +++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 2618a5886..4a80b2511 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -43,6 +43,7 @@ use Getopt::Long; use xCAT::SvrUtils; use xCAT::FSPUtils; my $indiscover=0; +my $vitals_info = undef; #used by 'rvitals all' to show lcds info for Firebird blade sub handled_commands { return { @@ -3253,7 +3254,26 @@ sub bladecmd { } elsif ($command eq "rpower") { return power(@args); } elsif ($command eq "rvitals") { - return vitals(@args); + my ($rc, @result) = vitals(@args); + if (defined($vitals_info) and defined($vitals_info->{$currnode})) { + my $attr = $vitals_info->{$currnode}; + my $fsp_api = ($::XCATROOT) ? "$::XCATROOT/sbin/fsp-api" : "/opt/xcat/sbin/fsp-api"; + my $cmd = "$fsp_api -a query_lcds -T 0 -t 0:$$attr[3]:$$attr[0]:$currnode: 2>&1"; + my $res = xCAT::Utils->runcmd($cmd, -1); + if ($res !~ /error/i) { + my @array = split(/\n/, $res); + foreach my $a(@array) { + my ($name, $data) = split(/:/,$a); + if ($data =~ /1\|(\w[\w\s]*)/) { + push @result, "Current LCD: $1"; + } else { + push @result, "Current LCD: blank"; + } + } + } + } + return ($rc, @result); + #return vitals(@args); } elsif ($command =~ /r[ms]preset/) { return resetmp(@args); } elsif ($command eq "rspconfig") { @@ -5304,7 +5324,11 @@ sub dompa { xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1); } } - + if ($command eq "rvitals") { + if ((scalar(@$args) ==1 and $args->[0] eq '') or grep (/all/,@$args)) { + $vitals_info = &get_blades_for_mpa($mpa); + } + } foreach $node (sort (keys %{$mpahash->{$mpa}->{nodes}})) { $curn = $node;