2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-12 00:00:12 +00:00

Support newer PDU firmware

Newer PDU firmware renumbered OIDs.  Detect and adapt
to new OIDs on the newer firmware.
This commit is contained in:
Jarrod Johnson
2017-05-10 10:19:58 -04:00
parent 6331ada774
commit 494cf232f4

View File

@ -271,8 +271,6 @@ sub powerpduoutlet {
my $value;
my $statstr;
my $oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.11";
my $type = "INTEGER";
my $tmpnodestr = join(",", @$noderange);
my $nodetab = xCAT::Table->new('pduoutlet');
@ -341,6 +339,9 @@ sub outletpower {
my $oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.11";
my $type = "INTEGER";
if ($session->newmib) {
$oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.13";
}
my $varbind = new SNMP::Varbind([ $oid, $outlet, $value, $type ]);
return $session->set($varbind);
@ -392,6 +393,9 @@ sub outletstat {
my $oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.11";
my $output;
my $statstr;
if ($session->newmib) {
$oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.13";
}
$output = $session->get("$oid.$outlet");
if ($output eq 1) {
@ -431,6 +435,15 @@ sub connectTopdu {
unless ($session) {
return;
}
$session->newmib = 0;
my $pduversion = $session->get(".1.3.6.1.4.1.2.6.223.7.3.0");
if ($pduversion =~ /(\d+)\.(\d+)_(\d+)/) {
if ($1 >= 1 and $2 >= 3 and $3 >= 3) {
$session->newmib = 1;
}
}
return $session;
}