From 154603406a3d90e9dc21417ce643633e6f23caa5 Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 3 Dec 2012 03:04:04 +0000 Subject: [PATCH] use xCAT::ServiceNodeUtils->get_ServiceNode to determine the node's SN as gateway git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14515 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DBobjUtils.pm | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index a8a2df71a..465ed446a 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -16,6 +16,7 @@ require xCAT::Table; require xCAT::Utils; require xCAT::MsgUtils; require xCAT::NetworkUtils; +require xCAT::ServiceNodeUtils; use strict; # IPv6 not yet implemented - need Socket6 @@ -1956,15 +1957,11 @@ sub getNetwkInfo 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(); + # use the node attribute 'xcatmaster' or site.master + my @nodes = ("$node"); + my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes,"xcat","Node"); + my $snkey = (keys %{$sn})[0]; + $nethash{$node}{'gateway'} = xCAT::NetworkUtils->getipaddr($snkey); } }