From 31c60fc35f1e7b2939744853f9b34efdf63ea02c Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 1 Aug 2012 12:29:40 +0000 Subject: [PATCH] fix for defect 3552171 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13385 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DSHCLI.pm | 64 +++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/perl-xCAT/xCAT/DSHCLI.pm b/perl-xCAT/xCAT/DSHCLI.pm index 14e70991e..862a6c6ab 100644 --- a/perl-xCAT/xCAT/DSHCLI.pm +++ b/perl-xCAT/xCAT/DSHCLI.pm @@ -4074,23 +4074,6 @@ sub parse_and_run_dcp return; } } - if ($options{'File'}) - { - - # input -F file is copied to tmp file on a service node - if (xCAT::Utils->isServiceNode()) - { # running on service node - $options{'File'} = "/tmp/xcatrf.tmp"; - } - my $syncfile = $options{'File'}; - if (!-f $options{'File'}) - { - my $rsp = (); - $rsp->{data}->[0] = "File:$syncfile does not exist."; - xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); - return; - } - } # invalid to put the -F with the -r flag if ($options{'File'} && $options{'node-rcp'}) @@ -4208,6 +4191,23 @@ sub parse_and_run_dcp $synfiledir = $syndir[0]; } + # input -F file is sync'd to site.syncfiledir on the service node + + #if (xCAT::Utils->isServiceNode()) + #{ # running on service node + # my $snsynfile = $synfiledir; + # $snsynfile .= $options{'File'}; + # $options{'File'} = $snsynfile; + #} + my $syncfile = $options{'File'}; + if (!-f $options{'File'}) + { + my $rsp = (); + $rsp->{data}->[0] = "File:$syncfile does not exist."; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); + return; + } + my $rc; my $syncfile = $options{'File'}; # the parsing of the file will fill in an array of postscripts @@ -4221,9 +4221,34 @@ sub parse_and_run_dcp } else { # running on MN + # build the files to sync from the nodes sync file $rc = &parse_rsync_input_file_on_MN(\@nodelist, \%options, $syncfile, $::SYNCSN, $synfiledir); + # build a temporary syncfile for the node's synclist + # we need to make sure the latest is on the servicenode + # for running of the syncfiles postscript, which only pulls + # from the service node + my $tmpsyncfile="/tmp/xdcpsynclist.$$"; + my $syncline = "$syncfile -> $syncfile"; + open(FILE, ">$tmpsyncfile") + or die "cannot open file $tmpsyncfile\n"; + print FILE " $syncline"; + close FILE; + # now put the original syncfile on the queue to sync to the SN's + $rc = + &parse_rsync_input_file_on_MN(\@nodelist, \%options, $tmpsyncfile, + $::SYNCSN, $synfiledir); + # cleanup + my $cmd = "rm $tmpsyncfile"; + my @output = xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "Command: $cmd failed."; + xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); + } + } if ($rc == 1) { @@ -4460,13 +4485,16 @@ sub rsync_to_image Globals: - + $::SYNCSN indicates we are only syncing the files to the + service nodes xdcp -s flag Error: None Example: Comments: + We also add the original synclist file for the node to be sync'd + to the service node =cut