diff --git a/xCAT-server-2.0/lib/xcat/plugins/mknb.pm b/xCAT-server-2.0/lib/xcat/plugins/mknb.pm index 8783156d2..1987a25b8 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/mknb.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/mknb.pm @@ -117,10 +117,10 @@ sub process_request { } elsif ($arch =~ /ppc/) { open($cfgfile,">","$tftpdir/etc/".lc($_)); print $cfgfile "timeout=5\n"; - print $cfgfile "label=xcat\n"; - print $cfgfile "image=xcat/nbk.$arch\n"; - print $cfgfile "initrd=xcat/nbfs.$arch.gz\n"; - print $cfgfile 'append="xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\n"; + print $cfgfile " label=xcat\n"; + print $cfgfile " image=xcat/nbk.$arch\n"; + print $cfgfile " initrd=xcat/nbfs.$arch.gz\n"; + print $cfgfile ' append="xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n"; close($cfgfile); } } diff --git a/xCAT-server-2.0/lib/xcat/plugins/pxe.pm b/xCAT-server-2.0/lib/xcat/plugins/pxe.pm index 4c46e81bc..d2ce20fe7 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/pxe.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/pxe.pm @@ -100,15 +100,31 @@ sub setstate { print $pcfg "LOCALBOOT 0\n"; close($pcfg); } + my $mactab = xCAT::Table->new('mac'); #to get all the hostnames + my %ipaddrs; my $ip = inet_ntoa(inet_aton($node));; unless ($ip) { syslog("local1|err","xCAT unable to resolve IP in pxe plugin"); return; } - my @ipa=split(/\./,$ip); - my $pname = sprintf("%02X%02X%02X%02X",@ipa); - unlink($tftpdir."/pxelinux.cfg/".$pname); - link($tftpdir."/pxelinux.cfg/".$node,$tftpdir."/pxelinux.cfg/".$pname); + $ipaddrs{$ip} = 1; + if ($mactab) { + my $ment = $mactab->getNodeAttribs($node,['mac']); + if ($ment and $ment->{mac}) { + my @macs = split(/\|/,$ment->{mac}); + foreach (@macs) { + if (/!(.*)/) { + $ipaddrs{inet_ntoa(inet_aton($1))} = 1; + } + } + } + } + foreach $ip (keys %ipaddrs) { + my @ipa=split(/\./,$ip); + my $pname = sprintf("%02X%02X%02X%02X",@ipa); + unlink($tftpdir."/pxelinux.cfg/".$pname); + link($tftpdir."/pxelinux.cfg/".$node,$tftpdir."/pxelinux.cfg/".$pname); + } } diff --git a/xCAT-server-2.0/lib/xcat/plugins/yaboot.pm b/xCAT-server-2.0/lib/xcat/plugins/yaboot.pm index 189b893f7..1a3cd8f20 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/yaboot.pm @@ -108,10 +108,26 @@ sub setstate { syslog("local1|err","xCAT unable to resolve IP in yaboot plugin"); return; } - my @ipa=split(/\./,$ip); - my $pname = sprintf("%02x%02x%02x%02x",@ipa); - unlink($tftpdir."/etc/".$pname); - link($tftpdir."/etc/".$node,$tftpdir."/etc/".$pname); + my $mactab = xCAT::Table->new('mac'); + my %ipaddrs; + $ipaddrs{$ip} = 1; + if ($mactab) { + my $ment = $mactab->getNodeAttribs($node,['mac']); + if ($ment and $ment->{mac}) { + my @macs = split(/\|/,$ment->{mac}); + foreach (@macs) { + if (/!(.*)/) { + $ipaddrs{inet_ntoa(inet_aton($1))} = 1; + } + } + } + } + foreach $ip (keys %ipaddrs) { + my @ipa=split(/\./,$ip); + my $pname = sprintf("%02x%02x%02x%02x",@ipa); + unlink($tftpdir."/etc/".$pname); + link($tftpdir."/etc/".$node,$tftpdir."/etc/".$pname); + } }