fix defect 3415106 remove nimprime check

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10673 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2011-09-29 13:32:05 +00:00
parent faefeffa90
commit 89919c7272

View File

@ -3559,7 +3559,10 @@ sub get_site_Master
=head3 get_ServiceNode
Will get the Service node ( name or ipaddress) as known by the Management
Server or Node for the input nodename or ipadress of the node
Node or Node for the input nodename or ipadress of the node
which can be a Service Node.
If the input node is a Service Node then it's Service node
is always the Management Node.
input: list of nodenames and/or node ipaddresses (array ref)
service name
@ -3601,8 +3604,8 @@ sub get_ServiceNode
my $nodehmtab;
my $noderestab;
my $snattribute;
my $oshash;
my $nodetab;
my $oshash;
my $nodetab;
$::ERROR_RC = 0;
# determine if the request is for the service node as known by the MN
@ -3616,27 +3619,9 @@ sub get_ServiceNode
{
$snattribute = "xcatmaster";
}
my $master =
xCAT::Utils->get_site_Master(); # read the site table, master attrib
# need better logic here for MIXED CLUSTERS
# the NIM primary will be either the site.nimprime attr
# or, if not set, the site.master attr
my $nimprime;
$nimprime = xCAT::InstUtils->getnimprime();
chomp $nimprime;
# $master and $nimprime is possible to be the same (MN)
# but $master is IP addr, $nimprime is short hostname
# this results in %snhash may have two keys duplicated.
# so use ip for nimprime.
my $nimprimeip = xCAT::NetworkUtils->getipaddr($nimprime);
$nimprime = $nimprimeip;
# get site.master this will be the default
my $master = xCAT::Utils->get_site_Master();
$noderestab = xCAT::Table->new('noderes');
$nodetab = xCAT::Table->new('nodetype');
unless ($noderestab) # no noderes table, use default site.master
{
@ -3645,17 +3630,10 @@ sub get_ServiceNode
if ($master) # use site Master value
{
if ($nodetab) {
$oshash = $nodetab->getNodesAttribs(\@node_list, ["os"]);
}
foreach my $node (@node_list)
{
if ( ($oshash->{$node}->[0]->{os}) && ($oshash->{$node}->[0]->{os} eq "AIX")) {
push @{$snhash{$nimprime}}, $node;
} else {
push @{$snhash{$master}}, $node;
}
}
}
else
@ -3664,9 +3642,6 @@ sub get_ServiceNode
$::ERROR_RC = 1;
}
if ($nodetab) {
$nodetab->close;
}
return \%snhash;
}
@ -3675,32 +3650,24 @@ sub get_ServiceNode
$nodehash = $noderestab->getNodesAttribs(\@node_list, [$snattribute]);
$oshash = $nodetab->getNodesAttribs(\@node_list, ["os"]);
foreach my $node (@node_list)
{
foreach my $rec (@{$nodehash->{$node}})
{
if ($rec and $rec->{$snattribute})
if ($rec and $rec->{$snattribute}) # use noderes.servicenode
{
my $key = $rec->{$snattribute};
push @{$snhash{$key}}, $node;
}
else
else # use site.master
{
if ( ($oshash->{$node}->[0]->{os}) && ($oshash->{$node}->[0]->{os} eq "AIX")) {
if ($nimprime) {
push @{$snhash{$nimprime}}, $node;
}
} else {
push @{$snhash{$master}}, $node;
}
push @{$snhash{$master}}, $node;
}
}
}
$noderestab->close;
$nodetab->close;
return \%snhash;
}