2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 17:23:08 +00:00

correct the logic to determine the ENV{XCATMASTER}

This commit is contained in:
immarvin 2016-06-06 23:13:26 -04:00
parent b0edd6fcff
commit 216f80f93f

View File

@ -74,28 +74,43 @@ sub subvars {
$inc.=$_;
}
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
my $master;
#my $sitetab = xCAT::Table->new('site');
#the "xcatmaster" attribute of the node
my $noderestab = xCAT::Table->new('noderes');
#(my $et) = $sitetab->getAttribs({key=>"master"},'value');
my @masters = xCAT::TableUtils->get_site_attribute("master");
my $tmp = $masters[0];
if ( defined($tmp) ) {
$master = $tmp;
}
my $ipfn;
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfnd[0]) { $ipfn = $ipfnd[1];}
if ($ipfn) {
$master = $ipfn;
}
my $et = $noderestab->getNodeAttribs($node,['xcatmaster']);
if ($et and $et->{'xcatmaster'}) {
$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
my $ipfn;
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfnd[0]) { $ipfn = $ipfnd[1];}
if ($ipfn) {
$master = $ipfn;
}
}
unless ($master) {
die "Unable to identify master for $node";
}
$ENV{XCATMASTER}=$master;
my ($host, $ipaddr) = xCAT::NetworkUtils->gethostnameandip($master);