From 77f416ca0239fc9ba080c21bd51d3799ac2cc3f4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 5 Apr 2016 17:01:56 -0400 Subject: [PATCH 1/3] Change to recognize newer Lenovo mfg id --- xCAT-genesis-scripts/bin/bmcsetup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 6c872ff53..51d3e2f15 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -87,7 +87,7 @@ if [ "$IPMIMFG" == 2 ]; then #IBM fi fi fi -elif [ "$IPMIMFG" == 20301 ] ; then +elif [ "$IPMIMFG" == 20301 -o "$IPMIMFG" == 19046 ] ; then XPROD=`ipmitool mc info|grep "^Product ID"|awk '{print $4}'` IBMVPDV=`ipmitool raw 0x3a 0xb 2 0 16 1` if [ $IBMVPDV -eq 2 ]; then From 9869d148ac900551396a8af97feeb2128d57e90a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 5 Apr 2016 17:01:56 -0400 Subject: [PATCH 2/3] Change to recognize newer Lenovo mfg id --- xCAT-genesis-scripts/bin/bmcsetup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 6c872ff53..51d3e2f15 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -87,7 +87,7 @@ if [ "$IPMIMFG" == 2 ]; then #IBM fi fi fi -elif [ "$IPMIMFG" == 20301 ] ; then +elif [ "$IPMIMFG" == 20301 -o "$IPMIMFG" == 19046 ] ; then XPROD=`ipmitool mc info|grep "^Product ID"|awk '{print $4}'` IBMVPDV=`ipmitool raw 0x3a 0xb 2 0 16 1` if [ $IBMVPDV -eq 2 ]; then From 0815a449295f6903cff44452640bed495eaaba79 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 11 Apr 2016 16:07:23 -0400 Subject: [PATCH 3/3] Copy location data into confluent on makeconfluentcfg --- xCAT-server/lib/xcat/plugins/confluent.pm | 86 +++++++++++++++++++---- 1 file changed, 72 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/confluent.pm b/xCAT-server/lib/xcat/plugins/confluent.pm index 2f2725af2..e450e3b55 100644 --- a/xCAT-server/lib/xcat/plugins/confluent.pm +++ b/xCAT-server/lib/xcat/plugins/confluent.pm @@ -1,4 +1,5 @@ # IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html +# Lenovo(c) 2016 #TODO: delete entries not being refreshed if no noderange package xCAT_plugin::confluent; use strict; @@ -218,9 +219,16 @@ sub makeconfluentcfg { # Get db info for the nodes related to console my $hmtab = xCAT::Table->new('nodehm'); + my $nodepostab = xCAT::Table->new('nodepos'); my @cfgents1;# = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']); + my @cfgents2; + my @cfgents3; + my $explicitnodes = 0; if (($nodes and @$nodes > 0) or $req->{noderange}->[0]) { - @cfgents1 = $hmtab->getNodesAttribs($nodes,['node','cons','serialport','mgt','conserver','termserver','termport','consoleondemand']); + $explicitnodes = 1; + @cfgents1 = $hmtab->getNodesAttribs($nodes,['node','cons', 'mgt','conserver','termserver','termport','consoleondemand']); + @cfgents2 = $nodepostab->getNodesAttribs($nodes,['node', 'rack', 'u', 'chassis', 'slot' , 'room']); + @cfgents3 = $nodepostab->getNodesAttribs($nodes,['node', 'mpa', 'id']); # Adjust the data structure to make the result consistent with the getAllNodeAttribs() call we make if a noderange was not specified my @tmpcfgents1; foreach my $ent (@cfgents1) @@ -230,24 +238,57 @@ sub makeconfluentcfg { push @tmpcfgents1, $ent->{$nodeent}->[0] ; } } - @cfgents1 = @tmpcfgents1 - + @cfgents1 = @tmpcfgents1; + @tmpcfgents1 = (); + foreach my $ent (@cfgents2) + { + foreach my $nodeent ( keys %$ent) + { + push @tmpcfgents1, $ent->{$nodeent}->[0] ; + } + } + @cfgents2 = @tmpcfgents1; + @tmpcfgents1 = (); + foreach my $ent (@cfgents3) + { + foreach my $nodeent ( keys %$ent) + { + push @tmpcfgents1, $ent->{$nodeent}->[0] ; + } + } + @cfgents3 = @tmpcfgents1; } else { @cfgents1 = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport','consoleondemand']); + @cfgents2 = $nodepostab->getAllNodeAttribs(['rack', 'u', 'chassis', 'slot' , 'room']); + @cfgents3 = $nodepostab->getAllNodeAttribs(['mpa', 'id']); } #cfgents1 should now have all the nodes, so we can fill in the cfgents array and cfgenthash one at a time. # skip the nodes that do not have 'cons' defined, unless a serialport setting suggests otherwise - my @cfgents=(); my %cfgenthash; foreach (@cfgents1) { if ($_->{cons} or defined($_->{'serialport'})) { unless ($_->{cons}) {$_->{cons} = $_->{mgt};} #populate with fallback - push @cfgents, $_; + $cfgenthash{$_->{node}} = $_; # also put the ref to the entry in a hash for quick look up + } elsif ($explicitnodes) { $cfgenthash{$_->{node}} = $_; # also put the ref to the entry in a hash for quick look up } } + foreach my $nent (@cfgents2) { + foreach (keys %$nent) { + $cfgenthash{$nent->{node}}->{$_} = $nent->{$_}; + } + } + foreach my $nent (@cfgents3) { + foreach (keys %$nent) { + $cfgenthash{$nent->{node}}->{$_} = $nent->{$_}; + } + } + my @cfgents=(); + foreach (values %cfgenthash) { + push @cfgents, $_; + } if ($::DEBUG) { my $rsp; @@ -381,7 +422,7 @@ sub donodeent { my $rsp = $confluent->next_result(); while ($rsp) { if (exists $rsp->{error}) { - xCAT::SvrUtils::sendmsg([1,"Confluent error: " . $rsp->{error}],$cb); + xCAT::SvrUtils::sendmsg([1,":Confluent error: " . $rsp->{error}],$cb); } $rsp = $confluent->next_result(); } @@ -392,15 +433,12 @@ sub donodeent { foreach my $node (sort keys %$cfgenthash) { my $cfgent = $cfgenthash->{$node}; my $cmeth=$cfgent->{cons}; - if (not $cmeth) { - return $node; - } - if ($cmeth ne 'ipmi') { + if ($cmeth and $cmeth ne 'ipmi') { $cmeth = 'xcat' . $cmeth; } my %parameters; - $parameters{'console.method'} = $cmeth; - if ($cmeth eq 'ipmi') { + if ($cmeth) { $parameters{'console.method'} = $cmeth; } + if ($cmeth eq 'ipmi' or not $cmeth) { $parameters{'secret.hardwaremanagementuser'} = $ipmiauthdata->{$node}->{username}; $parameters{'secret.hardwaremanagementpassword'} = @@ -419,13 +457,33 @@ foreach my $node (sort keys %$cfgenthash) { } elsif ($::XCATSITEVALS{'consoleondemand'} and $::XCATSITEVALS{'consoleondemand'} !~ m/^n/) { $parameters{'console.logging'} = 'none'; } + # ok, now for nodepos... + if (defined $cfgent->{u}) { + $parameters{'location.u'} = $cfgent->{u}; + } + if (defined $cfgent->{rack}) { + $parameters{'location.rack'} = $cfgent->{rack}; + } + if (defined $cfgent->{room}) { + $parameters{'location.room'} = $cfgent->{room}; + } + if (defined $cfgent->{chassis}) { + $parameters{'enclosure.manager'} = $cfgent->{chassis}; + } elsif (defined $cfgent->{mpa}) { + $parameters{'enclosure.manager'} = $cfgent->{mpa}; + } + if (defined $cfgent->{slot}) { + $parameters{'enclosure.bay'} = $cfgent->{slot}; + } elsif (defined $cfgent->{id}) { + $parameters{'enclosure.bay'} = $cfgent->{id}; + } $parameters{'groups'} = [grep {defined && length} split /,/,$groupdata->{$node}->[0]->{'groups'}]; if (exists $currnodes{$node}) { $confluent->update('/nodes/'.$node.'/attributes/current', parameters=>\%parameters); my $rsp = $confluent->next_result(); while ($rsp) { if (exists $rsp->{error}) { - xCAT::SvrUtils::sendmsg([1,"Confluent error: " . $rsp->{error}],$cb,$node); + xCAT::SvrUtils::sendmsg([1,":Confluent error: " . $rsp->{error}],$cb,$node); } $rsp = $confluent->next_result(); } @@ -435,7 +493,7 @@ foreach my $node (sort keys %$cfgenthash) { my $rsp = $confluent->next_result(); while ($rsp) { if (exists $rsp->{error}) { - xCAT::SvrUtils::sendmsg([1,"Confluent error: " . $rsp->{error}],$cb,$node); + xCAT::SvrUtils::sendmsg([1,":Confluent error: " . $rsp->{error}],$cb,$node); } $rsp = $confluent->next_result(); }