diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 6aefdf37e..1fed7d27d 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -42,9 +42,20 @@ sub check_dhcp { return 0; } +sub _slow_get_tftpdir { #make up for paths where tftpdir is not passed in + my $nrtab = = xCAT::Table->new('noderes',-create=>0); #in order to detect per-node tftp directories + unless ($nrtab) { return $globaltftpdir; } + my $ent = $nrtab->getNodeAttribs($node,["tftpdir"]); + if ($ent and $ent->{tftpdir}) { + return $ent->{tftpdir}; + } else { + return $globaltftpdir; + } +} sub getstate { my $node = shift; my $tftpdir = shift; + unless ($tftpdir) { $tftpdir = _slow_get_tftpdir($node); } if (check_dhcp($node)) { if (-r $tftpdir . "/xcat/xnba/nodes/".$node) { my $fhand; @@ -597,9 +608,17 @@ sub getNodesetStates { } my @nodes=@$noderef; my $hashref=shift; + my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories + my %nrhash = %{$noderestab->getNodesAttribs(\@nodes,[qw(tftpdir)])}; if (@nodes>0) { foreach my $node (@nodes) { - my $tmp=getstate($node); + my $tftpdir; + if ($nrhash{$node}->[0] and $nrhash{$node}->[0]->{tftpdir}) { + $tftpdir = $nrhash{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } + my $tmp=getstate($node,$tftpdir); my @a=split(' ', $tmp); my $stat = $a[0]; if (exists($hashref->{$stat})) {