From c9d2c76a56a7ed5c2cc604bc29cd7dfd951e6c83 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 25 May 2009 12:27:48 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/DSHCLI.pm | 2 +- xCAT-client/bin/xdsh | 8 +++++++ xCAT-server/lib/xcat/plugins/xdsh.pm | 31 ++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 130e6ce31..24b5b4988 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -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; diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 2c8e8dd85..32856ae29 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -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(); diff --git a/xCAT-server/lib/xcat/plugins/xdsh.pm b/xCAT-server/lib/xcat/plugins/xdsh.pm index d3248ef9e..97b78c684 100644 --- a/xCAT-server/lib/xcat/plugins/xdsh.pm +++ b/xCAT-server/lib/xcat/plugins/xdsh.pm @@ -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};