fix defect #4299 Node provision failed because kickstart file have unreasonable conf which caused by switch discovery emthod

This commit is contained in:
immarvin 2014-11-28 01:49:33 -08:00
parent 607e2bd385
commit b8602d756f
2 changed files with 23 additions and 8 deletions

View File

@ -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;

View File

@ -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;
}