From 8f32293390978def940f5bed0028774cd98068f1 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 30 Mar 2011 06:06:38 +0000 Subject: [PATCH] bug 3243565: fix for support for networks.gateway git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9180 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DBobjUtils.pm | 16 ++++++++++++++++ xCAT-server/lib/xcat/plugins/networks.pm | 7 +++++++ 2 files changed, 23 insertions(+) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 04ea5ed7b..5c8117852 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -1949,6 +1949,22 @@ sub getNetwkInfo $nethash{$node}{'gateway'} = ''; } $nethash{$node}{'myselfgw'} = 1; + # For hwctrl commands, it is possible that this subroutine is called + # on MN instead of SN, if the hcp SN is not set + if (xCAT::Utils->isMN() && !$nethash{$node}{'gateway'}) + { + # does not have ip address in this subnet, + # use the node attribute 'xcatmaster' + my $noderestab = xCAT::Table->new('noderes'); + my $et = $noderestab->getNodeAttribs($node, ['xcatmaster']); + if ($et and defined($et->{'xcatmaster'})) + { + my $value = $et->{'xcatmaster'}; + $nethash{$node}{'gateway'} = xCAT::NetworkUtils->getipaddr($value); + } + $noderestab->close(); + } + } next; } diff --git a/xCAT-server/lib/xcat/plugins/networks.pm b/xCAT-server/lib/xcat/plugins/networks.pm index bd0849778..4d6ea8faf 100644 --- a/xCAT-server/lib/xcat/plugins/networks.pm +++ b/xCAT-server/lib/xcat/plugins/networks.pm @@ -482,6 +482,13 @@ sub donets $gw = $netgw{'0.0.0.0'}{'0.0.0.0'}; #default gatetway } } + # set gateway to keyword , + # to indicate to use the cluster-facing ip address + # on this management node or service node + if (!$gw) + { + $gw = ""; + } # use convention for netname attr my $netn;