From b8602d756f0c383f7258eb245c589c183513e06d Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 28 Nov 2014 01:49:33 -0800 Subject: [PATCH] fix defect #4299 Node provision failed because kickstart file have unreasonable conf which caused by switch discovery emthod --- xCAT-server/lib/xcat/plugins/grub2.pm | 7 ++++++- xCAT-server/lib/xcat/plugins/yaboot.pm | 24 +++++++++++++++++------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index bb2e0ed15..dfe5d3cfa 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -222,10 +222,12 @@ sub setstate { } my $mactab = xCAT::Table->new('mac'); my %ipaddrs; + my $macstring; $ipaddrs{$ip} = 1; if ($mactab) { my $ment = $machash{$node}->[0]; #$mactab->getNodeAttribs($node,['mac']); if ($ment and $ment->{mac}) { + $macstring=$ment->{mac}; my @macs = split(/\|/,$ment->{mac}); foreach (@macs) { $nodemac = $_; @@ -246,7 +248,10 @@ sub setstate { unlink($tftpdir."/boot/grub2/".$pname); link($tftpdir."/boot/grub2/".$node,$tftpdir."/boot/grub2/".$pname); } - + if($macstring){ + $nodemac=xCAT::Utils->parseMacTabEntry($macstring,$node); + } + if ($nodemac =~ /:/) { my $tmp = lc($nodemac); $tmp =~ s/(..):(..):(..):(..):(..):(..)/$1-$2-$3-$4-$5-$6/g; diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 6d08786c8..381e6a8bb 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -263,10 +263,12 @@ sub setstate { } my $mactab = xCAT::Table->new('mac'); my %ipaddrs; + my $macstring; $ipaddrs{$ip} = 1; if ($mactab) { my $ment = $machash{$node}->[0]; #$mactab->getNodeAttribs($node,['mac']); if ($ment and $ment->{mac}) { + $macstring=$ment->{mac}; my @macs = split(/\|/,$ment->{mac}); foreach (@macs) { $nodemac = $_; @@ -287,14 +289,22 @@ sub setstate { unlink($tftpdir."/etc/".$pname); link($tftpdir."/etc/".$node,$tftpdir."/etc/".$pname); } + + if($macstring){ + $nodemac=xCAT::Utils->parseMacTabEntry($macstring,$node); + } + + if ($nodemac =~ /:/) { + my $tmp =lc($nodemac); + $tmp =~ s/(..):(..):(..):(..):(..):(..)/$1-$2-$3-$4-$5-$6/g; + my $pname = "yaboot.conf-" . $tmp; + unlink($tftpdir."/".$pname); + link($tftpdir."/etc/".$node,$tftpdir."/".$pname); + } + + } - if ($nodemac =~ /:/) { - my $tmp =lc($nodemac); - $tmp =~ s/(..):(..):(..):(..):(..):(..)/$1-$2-$3-$4-$5-$6/g; - my $pname = "yaboot.conf-" . $tmp; - unlink($tftpdir."/".$pname); - link($tftpdir."/etc/".$node,$tftpdir."/".$pname); - } + return; }