fix for bug 3833: if ip forwarding is not enabled, do not use the MN as gateway

This commit is contained in:
ligc 2013-10-15 09:50:13 +08:00
parent 3414416d01
commit 2486f856c3

9
perl-xCAT/xCAT/DBobjUtils.pm Normal file → Executable file
View File

@ -2007,7 +2007,14 @@ sub getNetwkInfo
my @nodes = ("$node");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes,"xcat","Node");
my $snkey = (keys %{$sn})[0];
$nethash{$node}{'gateway'} = xCAT::NetworkUtils->getipaddr($snkey);
my $gw = xCAT::NetworkUtils->getipaddr($snkey);
# two possible cases when this code is run:
# 1. flat cluster: ip forwarding is not enabled on MN
# 2. hw ctrl in hierarchy cluster, in which HCP SN is not set
# in either case, MN itself should not be the gateway
if (xCAT::NetworkUtils->thishostisnot($gw)) {
$nethash{$node}{'gateway'} = $gw;
}
}
}