if MN already in the database, xcatconfig -m will replace it, if the name has changed

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14164 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2012-10-30 14:55:03 +00:00
parent 4a7d0e4fdc
commit 39e72aec0b

View File

@ -2045,7 +2045,7 @@ sub cleanupPSTable
=head3 setupMNinDB
Will add the management node to the database with group=__mgmtnode
Will add/replace the management node to the database with group=__mgmtnode
=cut
@ -2056,6 +2056,29 @@ sub setupMNinDB
my $mnname = `hostname`;
chomp $mnname;
$mnname && $mnname =~ s/\..*//; # strip off domain
# check to see if MN already defined in the database
my $cmds = "XCATBYPASS=Y $::XCATROOT/bin/nodels __mgmtnode";
my $mn = xCAT::Utils->runcmd("$cmds", 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message('E', "Could run $cmds.");
return;
}
my $chtabcmds;
if (($mn) && ($mn ne $mnname)) { # remove the old one
$chtabcmds = "$::XCATROOT/sbin/chtab -d node=$mn nodelist;";
my $outref = xCAT::Utils->runcmd("$chtabcmds", 0);
if ($::RUNCMD_RC != 0)
{
xCAT::MsgUtils->message('E', "Could not run $chtabcmds.");
return;
}
} else { # already defined correctly
return;
}
# now add a new one
my $chtabcmds = "$::XCATROOT/sbin/chtab node=$mnname nodelist.groups=__mgmtnode;";
my $outref = xCAT::Utils->runcmd("$chtabcmds", 0);
if ($::RUNCMD_RC != 0)