From 494cf232f46d00b6621b6c5d2f24e2efd417b300 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 10 May 2017 10:19:58 -0400 Subject: [PATCH 1/2] Support newer PDU firmware Newer PDU firmware renumbered OIDs. Detect and adapt to new OIDs on the newer firmware. --- xCAT-server/lib/xcat/plugins/pdu.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 9d54d92fc..895d56184 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -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; } From 27613cdc18f7e9eafd0f09cac74828845f586408 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 10 May 2017 10:25:07 -0400 Subject: [PATCH 2/2] Fix syntax of newmib It has to be referenced as a hash element. --- xCAT-server/lib/xcat/plugins/pdu.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 895d56184..17e66f50c 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -339,7 +339,7 @@ sub outletpower { my $oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.11"; my $type = "INTEGER"; - if ($session->newmib) { + if ($session->{newmib}) { $oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.13"; } @@ -393,7 +393,7 @@ 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) { + if ($session->{newmib}) { $oid = ".1.3.6.1.4.1.2.6.223.8.2.2.1.13"; } @@ -435,11 +435,11 @@ sub connectTopdu { unless ($session) { return; } - $session->newmib = 0; + $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; + $session->{newmib} = 1; } }