remove host resolution, go with input host list and let remote shell do the work

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3753 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2009-07-10 11:56:19 +00:00
parent 41e7de56f6
commit 7a5f105a2b

View File

@ -563,8 +563,8 @@ sub _execute_dsh
&& xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
if (!grep(/$user_target/, @targets_failed))
{ # not already in list
push @targets_failed, $user_target;
push @targets_failed, $user_target;
}
push @{$dsh_target_status{'failed'}}, $user_target
if !$signal_interrupt_flag;
@ -711,8 +711,10 @@ sub fork_fanout_dcp
my $user_target = shift @$targets_waiting;
my $target_properties = $$resolved_targets{$user_target};
my @shorthostname = split(/\./, $user_target);
$user_target = $shorthostname[0];
# todo remove code
#my @shorthostname = split(/\./, $user_target);
#$user_target = $shorthostname[0];
my @dcp_command;
my $rsyncfile;
@ -776,7 +778,7 @@ sub fork_fanout_dcp
{
if ($::SYNCSN == 1)
{ # syncing service node
$rsyncfile = "/tmp/rsync_$user_target";
$rsyncfile .= "_s";
}
@ -2833,26 +2835,33 @@ sub _resolve_nodes
my %resolved_nodes = ();
my %unresolved_nodes = ();
xCAT::DSHCore->resolve_hostnames($options, \%resolved_nodes,
\%unresolved_nodes, $context_targets,
@nodes);
xCAT::DSHCore->removeExclude(\%resolved_nodes, $unresolved_targets,
$context_targets);
xCAT::DSHCore->removeExclude($resolved_targets, \%unresolved_nodes,
$context_targets);
foreach my $node (keys(%unresolved_nodes))
{
my $node_properties = $unresolved_nodes{$node};
# this build the resolved nodes hash
# bypasses the old dsh resolution code
# unresolved nodes will be determined when the remote shell runs
xCAT::DSHCLI->bld_resolve_nodes_hash($options, \%resolved_nodes, @nodes);
$$node_properties{'type'} = 'node';
$$unresolved_targets{$node} = $node_properties;
# todo remove code
#xCAT::DSHCore->resolve_hostnames($options, \%resolved_nodes,
# \%unresolved_nodes, $context_targets,
# @nodes);
#xCAT::DSHCore->removeExclude(\%resolved_nodes, $unresolved_targets,
# $context_targets);
#xCAT::DSHCore->removeExclude($resolved_targets, \%unresolved_nodes,
# $context_targets);
my $rsp = {};
$rsp->{data}->[0] =
"The specified node $node address is not resolvable in the cluster.";
xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
}
#foreach my $node (keys(%unresolved_nodes))
#{
# my $node_properties = $unresolved_nodes{$node};
# $$node_properties{'type'} = 'node';
# $$unresolved_targets{$node} = $node_properties;
# my $rsp = {};
# $rsp->{data}->[0] =
# "The specified node $node address is not resolvable in the cluster.";
# xCAT::MsgUtils->message("E", $rsp, $::CALLBACK);
#}
foreach my $user_node (keys(%resolved_nodes))
{
@ -2868,6 +2877,61 @@ sub _resolve_nodes
}
}
#---------------------------------------------------------------------------
=head3
resolve_nodes_hash
Builds the resolved nodes hash.
Arguments:
$options - options hash table describing dsh configuration options
$resolved_targets - hash table of resolved properties, keyed by target name
@target_list - input list of target names to resolve
Returns:
None
Globals:
None
Error:
None
Example:
Comments:
=cut
#---------------------------------------------------------------------------
sub bld_resolve_nodes_hash
{
my ($class, $options, $resolved_targets, @target_list) = @_;
foreach my $target (@target_list)
{
my $hostname = $target;
my $ip_address;
my $localhost;
my $user;
my $context = "XCAT";
my %properties = (
'hostname' => $hostname,
'ip-address' => $ip_address,
'localhost' => $localhost,
'user' => $user,
'context' => $context,
'unresolved' => $target
);
$$resolved_targets{"$target"} = \%properties;
}
}
#----------------------------------------------------------------------------
=head3
@ -2903,8 +2967,11 @@ sub verify_targets
my @ping_list;
foreach my $user_target (keys(%$resolved_targets))
{
my @shorthostname = split(/\./, $user_target);
push @ping_list, $shorthostname[0];
# todo remove my @shorthostname = split(/\./, $user_target);
# push @ping_list, $shorthostname[0];
my $hostname = $$resolved_targets{$user_target}{'hostname'};
push @ping_list, $hostname;
}
if (@ping_list)
@ -4001,12 +4068,15 @@ sub parse_and_run_dcp
{
if ($^O eq 'aix')
{
if (-e ("/usr/bin/rsync")) {
$options{'node-rcp'} = '/usr/bin/rsync';
} else {
$options{'node-rcp'} = '/usr/local/bin/rsync';
if (-e ("/usr/bin/rsync"))
{
$options{'node-rcp'} = '/usr/bin/rsync';
}
else
{
$options{'node-rcp'} = '/usr/local/bin/rsync';
}
}
elsif ($^O eq 'linux')
{
@ -4254,13 +4324,16 @@ sub rsync_to_image
my $synccmd = "";
if ($^O eq 'aix')
{
if (-e ("/usr/bin/rsync")) {
$synccmd = "/usr/bin/rsync -Lupotz ";
} else {
$synccmd = "/usr/local/bin/rsync -Lupotz ";
}
if (-e ("/usr/bin/rsync"))
{
$synccmd = "/usr/bin/rsync -Lupotz ";
}
else
{
$synccmd = "/usr/local/bin/rsync -Lupotz ";
}
}
else # linux
else # linux
{
$synccmd = "/usr/bin/rsync -Lupotz ";
}