diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index a8a1d8633..de2425e89 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -1865,6 +1865,38 @@ sub getPostScripts } + #for redhat 7, append "disableconsistentNICrename" to default postscripts + #if "net.ifnames=0" is specified in kcmdline/addkcmdline of node or osimage + my $tftpdir = xCAT::TableUtils::getTftpDir(); + my $osimagetab=xCAT::Table->new('osimage',-create=>1); + my $osimgent = $osimagetab->getAttribs({imagename => $osimgname },'osvers'); + my $os = $osimgent->{'osvers'}; + my $nrret = $::GLOBAL_TAB_HASH{noderes}{$node}; + my $netboot = $nrret->{'netboot'}; + + if( ($os =~ "rhel7*") || ($os =~ "rhels7*") ) + { + my $nodecfg; + if($netboot eq "grub2") + { + $nodecfg="$tftpdir/boot/grub2/$node"; + }elsif($netboot eq "xnba") + { + $nodecfg="$tftpdir/xcat/xnba/nodes/$node"; + + }elsif($netboot eq "pxe") + { + $nodecfg="$tftpdir/pxelinux.cfg/$node"; + + } + + my $rc=system("grep net.ifnames=0 $nodecfg >/dev/null 2>&1"); + if($rc ==0) + { + $result .= "disableconsistentNICrename\n"; + } + } + return $result; }