defect 3851, further enhancements
This commit is contained in:
parent
ffe7ccbf3b
commit
14331df196
@ -3240,11 +3240,14 @@ sub bld_resolve_nodes_hash
|
||||
# find out the names for the Management Node
|
||||
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
|
||||
my $mname = pop @MNnodeinfo; # hostname
|
||||
#my $rsp = {};
|
||||
#$rsp->{info}->[0] =
|
||||
# "Management node name is $mname.";
|
||||
# xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
|
||||
my $cmd="hostname";
|
||||
my $localhostname = xCAT::Utils->runcmd($cmd,0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{info}->[0] = "Command: $cmd failed. Continuing...";
|
||||
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
|
||||
}
|
||||
foreach my $target (@target_list)
|
||||
{
|
||||
|
||||
@ -3253,11 +3256,9 @@ sub bld_resolve_nodes_hash
|
||||
my $localhost;
|
||||
my $user;
|
||||
my $context = "XCAT";
|
||||
# check to see if this node is the Management Node
|
||||
if ($mname) {
|
||||
if ($mname eq $target) {
|
||||
# check to see if this node is the Management Node we are on, can run local commands (sh,cp)
|
||||
if (($mname eq $target) || ($localhostname eq $target)){
|
||||
$localhost=$target;
|
||||
}
|
||||
}
|
||||
my %properties = (
|
||||
'hostname' => $hostname,
|
||||
|
@ -2107,8 +2107,8 @@ sub cleanupPSTable
|
||||
|
||||
=head3 setupMNinDB
|
||||
|
||||
Will add/replace the management node to the noderes table with group=__mgmtnode
|
||||
Will add/replace the management node to the servicenode tble with group=__mgmtnode
|
||||
Will add the management node to the noderes table with group=__mgmtnode
|
||||
Will add the management node to the servicenode tble with group=__mgmtnode
|
||||
|
||||
|
||||
=cut
|
||||
@ -2126,25 +2126,18 @@ sub setupMNinDB
|
||||
my $cmds="XCATBYPASS=Y $::XCATROOT/sbin/tabdump nodelist | grep __mgmtnode";
|
||||
my @output = xCAT::Utils->runcmd("$cmds", -1);
|
||||
|
||||
if ($::RUNCMD_RC == 0) # found a management node defined
|
||||
if ($::RUNCMD_RC == 0) # found nodes in __mgmtnode
|
||||
{
|
||||
my $chtabcmds;
|
||||
my @mn = split(",", $output[0]);
|
||||
$mn[0] =~ s/"//g; # remove the quotes
|
||||
if ($mn[0] ne $mnname) { # does not match current host name,delete it
|
||||
my $size=@output; # if more than one management node defined, do not remove any
|
||||
if ($size == 1) {
|
||||
$chtabcmds = "$::XCATROOT/sbin/chtab -d node=$mn[0] nodelist;";
|
||||
my $outref = xCAT::Utils->runcmd("$chtabcmds", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
xCAT::MsgUtils->message('E', "Could not run $chtabcmds.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else { # it is defined and good
|
||||
xCAT::MsgUtils->message('I', "$mnname already defined in the nodelist table.");
|
||||
# Look through the MN list and see if this MN is defined
|
||||
foreach my $line (@output) {
|
||||
my @mn = split(",", $line);
|
||||
$mn[0]=~ s/"//g; # remove the quotes
|
||||
if ($mn[0] eq $mnname) { # already in the database
|
||||
verbose("$mnname already defined in the the nodelist table.");
|
||||
$defined=1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
# now add with the new name , if not already there
|
||||
@ -2199,9 +2192,10 @@ sub setupMNinDB
|
||||
}
|
||||
|
||||
} else { # it was already defined in the servicenode table
|
||||
xCAT::MsgUtils->message('I', "$mnname was already defined in the servicenode table.");
|
||||
verbose("$mnname already defined in the the servicenode table.");
|
||||
|
||||
}
|
||||
xCAT::MsgUtils->message('I', "Management Node defined in the database.");
|
||||
return;
|
||||
}
|
||||
#-----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user