diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index d1415fa3a..012163b8b 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -82,9 +82,9 @@ sub subvars { close($inh); #the logic to determine the $ENV{XCATMASTER} confirm to the following priority(from high to low): - #the "xcatmaster" attribute of the node - #the site.master - #the ip address of the mn facing the compute node + ## 1, the "xcatmaster" attribute of the node + ## 2, the ip address of the mn/sn facing the compute node + ## 3, the site.master my $master; #the "xcatmaster" attribute of the node @@ -94,16 +94,6 @@ sub subvars { $master = $et->{'xcatmaster'}; } - unless ($master) { - - #the site.master - my @masters = xCAT::TableUtils->get_site_attribute("master"); - my $tmp = $masters[0]; - if (defined($tmp)) { - $master = $tmp; - } - } - unless ($master) { #the ip address of the mn facing the compute node @@ -115,14 +105,23 @@ sub subvars { } } + unless ($master) { + + #the site.master + my @masters = xCAT::TableUtils->get_site_attribute("master"); + my $tmp = $masters[0]; + if (defined($tmp)) { + $master = $tmp; + } + } + unless ($master) { $tmplerr = "Unable to identify master for $node"; return; } $ENV{XCATMASTER} = $master; - - my ($host, $ipaddr) = xCAT::NetworkUtils->gethostnameandip($master); + my $ipaddr = xCAT::NetworkUtils->getipaddr($master); if ($ipaddr) { $ENV{MASTER_IP} = "$ipaddr"; }