handle dcp rsync cfm hierarchically

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3441 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2009-05-25 12:27:48 +00:00
parent 5b095239c1
commit c9d2c76a56
3 changed files with 36 additions and 5 deletions

View File

@ -42,7 +42,7 @@ our @dsh_valid_env = (
'DSH_PATH', 'DSH_SYNTAX',
'DSH_TIMEOUT', 'DSH_REMOTE_PASSWORD',
'DSH_TO_USERID', 'DSH_FROM_USERID',
'DEVICETYPE', 'RSYNCSN',
'DEVICETYPE', 'RSYNCSN','DSH_RSYNC_FILE',
);
select(STDERR);
$| = 1;

View File

@ -171,6 +171,10 @@ if ($ENV{'DEVICETYPE'})
push(@{$cmdref->{env}}, "DEVICETYPE=$ENV{'DEVICETYPE'}");
}
if ($ENV{'DSH_RSYNC_FILE'})
{
push(@{$cmdref->{env}}, "DSH_RSYNC_FILE=$ENV{'DSH_RSYNC_FILE'}");
}
if ($ENV{'RSYNCSN'})
{
push(@{$cmdref->{env}}, "RSYNCSN=$ENV{'RSYNCSN'}");
@ -453,6 +457,10 @@ sub parse_args_xdcp
{
$ENV{'RSYNCSN'} = "yes"; # rsync file to SN
}
if ($options{'File'})
{
$ENV{'DSH_RSYNC_FILE'} = $options{'File'} ; # rsync file
}
if ($options{'version'})
{
my $version = xCAT::Utils->Version();

View File

@ -61,14 +61,18 @@ sub preprocess_request
my $nodes = $req->{node};
my $service = "xcat";
my @requests;
my $syncsn = 0;
my $syncsn = 0;
my $syncsnfile = "NONE";
foreach my $envar (@{$req->{env}})
{
my ($var, $value) = split(/=/, $envar, 2);
if ($var eq "RSYNCSN")
{ # syncing SN, will change
$syncsn = 1; # nodelist to the list of SN
last; # for those nodes
}
if ($var eq "DSH_RSYNC_FILE")
{ # if hierarchy,need to put file on the SN
$syncsnfile = $value; # sync file to SN
}
}
@ -78,9 +82,28 @@ sub preprocess_request
{
$sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN");
if ($syncsn == 0)
{ # not syncing sn, do hierarchy
# build each request for each service node
{ # not syncing sn, do hierarchy
# build each request for each service node
foreach my $snkey (keys %$sn)
{
if ($syncsnfile ne "NONE")
{ # need to send rsync file to SN
my $addreq;
$addreq->{node}->[0] = $snkey;
$addreq->{noderange}->[0] = $snkey;
$addreq->{arg}->[0] = $syncsnfile;
$addreq->{arg}->[1] = $syncsnfile;
$addreq->{command}->[0] = $req->{command}->[0];
$addreq->{cwd}->[0] = $req->{cwd}->[0];
push @requests, $addreq;
}
else
{
last;
}
}
foreach my $snkey (keys %$sn)
{
my $reqcopy = {%$req};