From 12e44ea0155143307d78488de569ad58c52ca0e4 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 12 Sep 2008 01:11:45 +0000 Subject: [PATCH] -Significant speedup for vitals query on blades git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2149 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 92681a7f2..f26b3fbfa 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -704,14 +704,22 @@ sub vitals { } } + my @bindlist; + my $bindobj; if (grep /voltage/,@vitems) { + for my $idx (15..40) { - $tmp=$session->get([".1.3.6.1.4.1.2.3.51.2.22.1.5.5.1.$idx.$slot"]); - unless ((not $tmp) or $tmp =~ /Not Readable/) { + push @bindlist,[".1.3.6.1.4.1.2.3.51.2.22.1.5.5.1.$idx",$slot]; + } + $bindobj= new SNMP::VarList(@bindlist); + $session->get($bindobj); #[".1.3.6.1.4.1.2.3.51.2.22.1.5.5.1.$idx.$slot"]); + for my $tmp (@$bindobj) { + if ($tmp and defined $tmp->[2] and $tmp->[2] !~ /Not Readable/) { $tmp =~ s/ = /:/; - push @output,"$tmp"; + push @output,$tmp->[2]; } } + @bindlist=(); } if (grep /temp/,@vitems) { @@ -719,10 +727,14 @@ sub vitals { if ($idx eq 11) { next; } - $tmp=$session->get([".1.3.6.1.4.1.2.3.51.2.22.1.5.3.1.$idx.$slot"]); - unless ($tmp =~ /Not Readable/) { + push @bindlist,[".1.3.6.1.4.1.2.3.51.2.22.1.5.3.1.$idx",$slot]; + } + $bindobj= new SNMP::VarList(@bindlist); + $session->get($bindobj); + for my $tmp (@$bindobj) { + if ($tmp and defined $tmp->[2] and $tmp->[2] !~ /Not Readable/) { $tmp =~ s/ = /:/; - push @output,"$tmp"; + push @output,$tmp->[2]; } } } @@ -760,7 +772,7 @@ sub vitals { if ($stat==0) { $stat = "off"; } elsif ($stat==1) { $stat = "on"; } elsif ($stat==2) { $stat = "blinking"; } $tmp="KVM led: ".$stat; - push @output,"$tmp"; + push @output,$tmp; } if (grep /mtled/,@vitems) {