defect 3851, updates for 2.8.2-pcm
This commit is contained in:
parent
322a84494e
commit
fb61328178
@ -3237,7 +3237,18 @@ sub bld_resolve_nodes_hash
|
||||
|
||||
# find out if we have an MN in the list, local cp and sh will be used
|
||||
# not remote shell
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@target_list);
|
||||
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
|
||||
my $mname = pop @MNnodeinfo; # hostname
|
||||
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)
|
||||
{
|
||||
|
||||
@ -3246,11 +3257,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,
|
||||
@ -4079,14 +4088,15 @@ sub parse_and_run_dsh
|
||||
# check if any node in the noderange is the Management Node and exit
|
||||
# with error, if the Management Node is in the Database and in the
|
||||
# noderange
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if ($mname) { # MN in the nodelist
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@nodelist);
|
||||
if (@mname) { # MN in the nodelist
|
||||
my $nodes=join(',', @mname);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"You must not run -K option against the Management Node:$mname.";
|
||||
"You must not run -K option against the Management Node:$nodes.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
# if devicetype=Mellanox, xdsh does not setup ssh, rspconfig does
|
||||
if ($switchtype =~ /Mellanox/i) {
|
||||
my $rsp = {};
|
||||
|
@ -238,12 +238,13 @@ sub getAllSN
|
||||
# if did not input "ALL" and there is a MN, remove it
|
||||
my @newservicenodes;
|
||||
if ((!defined($options)) || ($options ne "ALL")) {
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if ($mname) { # if there is a MN
|
||||
foreach my $nodes (@servicenodes) {
|
||||
if ($mname ne ($nodes)){
|
||||
push @newservicenodes, $nodes;
|
||||
}
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@servicenodes);
|
||||
if (@mname) { # if there is a MN
|
||||
foreach my $node (@servicenodes) {
|
||||
# check to see if node in MN list
|
||||
if (!(grep(/^$node$/, @mname))) { # if node not in the MN array
|
||||
push @newservicenodes, $node;
|
||||
}
|
||||
}
|
||||
$servicenodetab->close;
|
||||
return @newservicenodes; # return without the MN in the array
|
||||
|
@ -3125,7 +3125,7 @@ sub isSELINUX
|
||||
=head3 noderangecontainsMN
|
||||
Returns:
|
||||
returns nothing, if ManagementNode is not the input noderange
|
||||
returns name of MN, if Management Node is in the input noderange
|
||||
returns array of MN, if Management Node(s) is in the input noderange
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
@ -3133,7 +3133,7 @@ sub isSELINUX
|
||||
Input:
|
||||
array of nodes in the noderange
|
||||
Example:
|
||||
my $mn=xCAT::Utils->noderangecontainsMN($noderange);
|
||||
my @mn=xCAT::Utils->noderangecontainsMN($noderange);
|
||||
Comments:
|
||||
=cut
|
||||
|
||||
@ -3142,26 +3142,30 @@ sub noderangecontainsMn
|
||||
{
|
||||
my ($class, @noderange)=@_;
|
||||
# check if any node in the noderange is the Management Node return the
|
||||
# name
|
||||
my $mname;
|
||||
# name
|
||||
my @mnames; # management node names in the database, members of __mgmtnode
|
||||
my $tab = xCAT::Table->new('nodelist');
|
||||
my @nodelist=$tab->getAllNodeAttribs(['node','groups']);
|
||||
foreach my $n (@nodelist) {
|
||||
if (defined($n->{'groups'})) {
|
||||
my @groups=split(",",$n->{'groups'});
|
||||
if ((grep (/__mgmtnode/,@groups))) { # this is the MN
|
||||
$mname=$n->{'node'};
|
||||
last;
|
||||
push @mnames,$n->{'node'};
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($mname) { # if Management Node defined in the database
|
||||
if (grep(/^$mname$/, @noderange)) { # if MN in the noderange
|
||||
return $mname;
|
||||
} else {
|
||||
return ;
|
||||
my @MNs; # management node names found the noderange
|
||||
if (@mnames) { # if any Management Node defined in the database
|
||||
foreach my $mn (@mnames) {
|
||||
if (grep(/^$mn$/, @noderange)) { # if MN in the noderange
|
||||
push @MNs, $mn;
|
||||
}
|
||||
}
|
||||
if (@MNs) { # management nodes in the noderange
|
||||
return @MNs;
|
||||
}
|
||||
}
|
||||
return; # if no MN in the noderange, return nothing
|
||||
}
|
||||
|
||||
=head3 filter_nodes
|
||||
|
@ -211,7 +211,7 @@ sub makescript {
|
||||
return;
|
||||
}
|
||||
|
||||
$mn = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
@::mn = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
|
||||
my $inc;
|
||||
my $t_inc;
|
||||
@ -609,7 +609,7 @@ sub getNodeType
|
||||
my $node = shift;
|
||||
my $result;
|
||||
|
||||
if ( $node =~ /^$mn$/) {
|
||||
if (grep(/^$node$/, @::mn)) { # is it in the Management Node array
|
||||
$result="MN";
|
||||
return $result;
|
||||
}
|
||||
|
@ -359,16 +359,16 @@ sub preprocess_updatenode
|
||||
|
||||
# check to see if the Management Node is in the noderange and
|
||||
# if it is abort
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
if ($mname)
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
if (@mname)
|
||||
{ # MN in the nodelist
|
||||
my $nodes=join(',', @mname);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"You must not run -k option against the Management Node:$mname.";
|
||||
"You must not run -k option against a management node: $nodes.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
# now build a list of all service nodes that are either in the
|
||||
# noderange or a service node of a node in the noderange
|
||||
# and update there ssh keys and credentials
|
||||
@ -1058,13 +1058,14 @@ sub updatenode
|
||||
|
||||
# check to see if the Management Node is in the noderange and
|
||||
# if it is abort
|
||||
my $mname = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
if ($mname)
|
||||
my @mname = xCAT::Utils->noderangecontainsMn(@$nodes);
|
||||
if (@mname)
|
||||
{ # MN in the nodelist
|
||||
my $nodes=join(',', @mname);
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] =
|
||||
"You must not run -k option against the Management Node:$mname.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1);
|
||||
"You must not run -k option against a management node: $nodes.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2054,27 +2054,24 @@ sub setupMNinDB
|
||||
|
||||
my $defined = 0;
|
||||
my $cmds="XCATBYPASS=Y $::XCATROOT/sbin/tabdump nodelist | grep __mgmtnode";
|
||||
my $output = xCAT::Utils->runcmd("$cmds", -1);
|
||||
my @output = xCAT::Utils->runcmd("$cmds", -1);
|
||||
if ($::RUNCMD_RC == 0) # found a management node defined
|
||||
{
|
||||
my $chtabcmds;
|
||||
my @mn = split(",", $output);
|
||||
$mn[0] =~ s/"//g; # remove the quotes
|
||||
if ($mn[0] ne $mnname) { # does not match current host name,delete it
|
||||
$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;
|
||||
# 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;
|
||||
}
|
||||
} else { # it is defined and good
|
||||
xCAT::MsgUtils->message('I', "$mnname already defined in the nodelist table.");
|
||||
$defined=1;
|
||||
}
|
||||
}
|
||||
# now add with the new name , if not already there
|
||||
if ($defined ==0) {
|
||||
|
||||
}
|
||||
# now add with the new name , if not already there
|
||||
if ($defined ==0) {
|
||||
my $chtabcmds = "$::XCATROOT/sbin/chtab node=$mnname nodelist.groups=__mgmtnode;";
|
||||
my $outref = xCAT::Utils->runcmd("$chtabcmds", 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
@ -2125,9 +2122,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