From 73d2274527a5e09654e515fe193bf2f8f65ab90a Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Fri, 23 Nov 2012 10:40:39 +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/trunk@14416 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 28c71632e..c9862d45c 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -47,6 +47,7 @@ use xCAT::FSPUtils; my $indiscover=0; my $CALLBACK = undef; my $verbose_cmd = undef; +my $vitals_info = undef; #used by 'rvitals all' to show lcds info for Firebird blade sub handled_commands { return { @@ -3300,7 +3301,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") { @@ -5387,7 +5407,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;