From bf306b5fc12edd9c25eb5c5d6534d8a5b69b74da Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 8 May 2014 03:22:23 -0700 Subject: [PATCH] fix the problem that redhat provisioning on X will enter infinite installation loop when unicats dhcp is enabled --- xCAT-server/lib/perl/xCAT/Template.pm | 24 ++++++++++++++----- .../share/xcat/install/scripts/post.rh.common | 12 +++++++++- .../xcat/install/scripts/post.sles.common | 2 +- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 7e03dff72..d6bc2c818 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -105,11 +105,6 @@ sub subvars { } - my @managedaddressmode = xCAT::TableUtils->get_site_attribute("managedaddressmode"); - my $tmp=$managedaddressmode[0]; - if( defined($tmp) ){ - $ENV{MANAGEDADDRESSMODE}=$tmp; - } #replace the env with the right value so that correct include files can be found $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg; @@ -249,6 +244,7 @@ sub subvars { $inc =~ s/#WINDISABLENULLADMIN#/windows_disable_null_admin()/eg; $inc =~ s/#MANAGEDADDRESSMODE#/managed_address_mode()/eg; $inc =~ s/#HOSTNAME#/$node/g; + $inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg; my $nrtab = xCAT::Table->new("noderes"); my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']); @@ -638,6 +634,22 @@ sub get_win_prodkey { sub managed_address_mode { return $::XCATSITEVALS{managedaddressmode}; } + + +sub get_node_domain { + my $lcnode=shift; + if ( $lcnode eq 'THISNODE' ){ + $lcnode=$node; + } + + my $nd = xCAT::NetworkUtils->getNodeDomains([$lcnode]); + my %nodedomains = %$nd; + my $domain=$nodedomains{$lcnode}; + + return $domain; + +} + sub esxipv6setup { if (not $::XCATSITEVALS{managedaddressmode} or $::XCATSITEVALS{managedaddressmode} =~ /v4/) { return ""; } # blank line for ipv4 schemes my $v6addr; @@ -705,7 +717,7 @@ sub kickstartnetwork { push @nameserversIP, $ip; } - + #there is no network option to set dns search domain in kickstart, it will be set in %post if (scalar @nameserversIP) { $line .=" --nameserver=". join(",",@nameserversIP); } diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.common b/xCAT-server/share/xcat/install/scripts/post.rh.common index f34fe6e5d..b3b1fc0f1 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.common +++ b/xCAT-server/share/xcat/install/scripts/post.rh.common @@ -1,7 +1,17 @@ # -# Setup hostname +# Setup hostname and resov.conf # echo "post scripts" >/root/post.log + +#there is no network option to set dns search domain in kickstart file, +#the search domain in /etc/resolv.conf is set in the post installation script +export MANAGEDADDRESSMODE=#MANAGEDADDRESSMODE# +export SEARCHDOMAIN=#GETNODEDOMAIN:THISNODE# + +if [ "$MANAGEDADDRESSMODE" == "static" ]; then + echo "search $SEARCHDOMAIN" >> /etc/resolv.conf +fi + export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac" ] then diff --git a/xCAT-server/share/xcat/install/scripts/post.sles.common b/xCAT-server/share/xcat/install/scripts/post.sles.common index cfe6f29cc..ae6db1e24 100644 --- a/xCAT-server/share/xcat/install/scripts/post.sles.common +++ b/xCAT-server/share/xcat/install/scripts/post.sles.common @@ -1,5 +1,5 @@ #!/bin/sh -export MANAGEDADDRESSMODE="#XCATVAR:MANAGEDADDRESSMODE#" +export MANAGEDADDRESSMODE=#MANAGEDADDRESSMODE# cd /etc/sysconfig/network