diff --git a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm index 8ba604ba0c..8f0d0ec7e0 100644 --- a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm +++ b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm @@ -223,6 +223,19 @@ sub write_nic_profiles { return; } +# NetworkManager otherwise makes a DHCP profile for every Ethernet port without one. +sub disable_auto_profiles { + my ($rootimg_dir, $osver) = @_; + my $major = el_major_version($osver); + my $confdir = "$rootimg_dir/etc/NetworkManager/conf.d"; + return unless defined($major) && $major >= 10 && -d $confdir; + my $file = "$confdir/xcat.conf"; + my $fh; + open($fh, '>', $file) && print($fh "[main]\nno-auto-default=*\n") && close($fh) + or die("Error: cannot write $file: $!\n"); + return; +} + sub varsubinline{ my $line=shift; my $refvardict=shift; diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index a73e254e98..26826cb2fb 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -2167,6 +2167,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi close($cfgfile); imgutils::write_nic_profiles($rootimg_dir, $osver, $prinic, $othernics); + imgutils::disable_auto_profiles($rootimg_dir, $osver); # securetty not needed on s390x if ($arch ne "s390x") {