fix the problem that redhat provisioning on X will enter infinite installation loop when unicats dhcp is enabled

This commit is contained in:
immarvin 2014-05-08 03:22:23 -07:00
parent 467d54c4a3
commit f3f19a6ff6
3 changed files with 30 additions and 8 deletions

View File

@ -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;
@ -248,6 +243,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']);
@ -619,6 +615,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;
@ -686,7 +698,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);
}

View File

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

View File

@ -1,5 +1,5 @@
#!/bin/sh
export MANAGEDADDRESSMODE="#XCATVAR:MANAGEDADDRESSMODE#"
export MANAGEDADDRESSMODE=#MANAGEDADDRESSMODE#
cd /etc/sysconfig/network