2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-20 02:00:24 +00:00

enhance my_ip_facing when multiple ips found for xcatmaster for mypost(#4274)

* Using facing IP first than sitemaster

* enhance my_ip_facing when multiple ips found
This commit is contained in:
Yuan Bai
2017-11-09 17:37:34 +08:00
committed by Bin Xu
parent 6793f140ef
commit 2b7b0b4e19

View File

@@ -413,8 +413,29 @@ sub makescript {
$noderesent = $::GLOBAL_TAB_HASH{noderes}{$node};
}
unless ($master) {
#the ip address of the mn facing the compute node
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
my $ipfndscalar = @ipfnd;
unless ($ipfnd[0]) {
$master = $ipfnd[1];
if ($ipfndscalar > 2) {
foreach my $ipinfnd (@ipfnd) {
if ($::XCATSITEVALS{master} and $ipinfnd eq $::XCATSITEVALS{master}) {
$master = $ipinfnd;
last;
}
}
}
if ($master) {
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} = $master;
}
}
}
if (!defined($master)) {
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} = $::XCATSITEVALS{master};
$master = $::XCATSITEVALS{master};
}
#get the node type, service node or compute node
@@ -1535,10 +1556,22 @@ sub collect_all_attribs_for_tables_in_template
$::GLOBAL_TAB_HASH{noderes}{$node}{xcatmaster} eq ""))
{
my $value = undef;
my @valued = xCAT::NetworkUtils->my_ip_facing($node);
unless ($valued[0]) { $value = $valued[1]; }
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $value;
my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node);
my $ipfndscalar = @ipfnd;
unless ($ipfnd[0]) {
$value = $ipfnd[1];
if ($ipfndscalar > 2) {
foreach my $ipinfnd (@ipfnd) {
if ($::XCATSITEVALS{master} and $ipinfnd eq $::XCATSITEVALS{master}) {
$value = $ipinfnd;
last;
}
}
}
}
if ($value) {
$::GLOBAL_TAB_HASH{$tabname}{$node}{$attrib} = $value;
}
}
# for nodetype.os and nodetype.arch