- Timestamp:
- Sep 21, 2007 10:26:25 AM (17 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- 4e794c9f
- Parents:
- fe459d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/splitter.pl
rfe459d0 rb68f597 112 112 # current user is used. 113 113 sub scp_file { 114 my($file, $ where, $dest) = @_;114 my($file, $user, $host, $dest) = @_; 115 115 116 116 # XXX system with a relative pathname is sort of gross 117 system("scp $file $ where:$dest");117 system("scp $file $user\@$host:$dest"); 118 118 if ($?) { 119 119 warn "scp failed $?\n"; … … 149 149 &ssh_cmd($user, $host, "mkdir -p $dest_dir"); 150 150 for $s (@scripts) { 151 &scp_file("$local_script_dir/$s", "$user\@$host", $dest_dir) ||151 &scp_file("$local_script_dir/$s", $user, $host, $dest_dir) || 152 152 return 0; 153 153 } … … 174 174 } 175 175 else { 176 &scp_file("$src_dir/$f", "$user\@$host", $dest_dir) || return 0;176 &scp_file("$src_dir/$f", $user, $host, $dest_dir) || return 0; 177 177 } 178 178 } … … 200 200 # sub-experiment 201 201 my($proj_dir) = "/proj/$pid/exp/$eid/tmp"; # Where to stash federation stuff 202 my($tarfiles_dir) = "/proj/$pid/tarfiles/$eid"; # Where to stash tarfiles 202 203 my($to_hostname) = "$proj_dir/hosts"; # remote hostnames file 203 204 my($status) = new IO::Pipe; # The pipe to get status … … 217 218 # Copy the experiment definition data over 218 219 print "transferring subexperiment to $tb\n" if $verbose; 219 &scp_file("$tmpdir/$tb/$tclfile", "$user\@$host") || return 0;220 &scp_file("$tmpdir/$tb/$tclfile", $user, $host) || return 0; 220 221 # Clear out any old experiment data; if not deleted, copies over it by 221 222 # different users will fail. … … 227 228 &ssh_cmd($user, $host, "/bin/sh -c \\'/bin/rm -rf $proj_dir/*\\'") || 228 229 return 0; 230 print "clearing experiment tarfiles subdirs on $tb\n" if $verbose; 231 &ssh_cmd($user, $host, "/bin/rm -rf $tarfiles_dir/") || 232 return 0; 233 print "creating tarfiles subdir $tarfiles_dir on $tb\n" if $verbose; 234 &ssh_cmd($user, $host, "mkdir -p $tarfiles_dir", "create tarfiles") || 235 return 0; 229 236 # Remote experiment is active. Modify it. 230 237 if ($state eq "active") { 231 238 print "Transferring federation support files to $tb\n" if $verbose; 232 239 # First copy new scripts and hostinfo into the remote /proj 233 &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||240 &scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) || 234 241 return 0; 235 242 &ship_scripts($host, $user, $proj_dir) || return 0; 236 243 &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0; 244 if ( -d "$tmpdir/tarfiles") { 245 &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) || 246 return 0; 247 } 237 248 238 249 print "Modifying $eid in place on $tb\n" if $verbose; … … 247 258 # First copy new scripts and hostinfo into the remote /proj (because 248 259 # the experiment exists, the directory tree should be there. 249 &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||260 &scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) || 250 261 return 0; 251 262 &ship_scripts($host, $user, $proj_dir) || return 0; 252 263 &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0; 264 if ( -d "$tmpdir/tarfiles") { 265 &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) || 266 return 0; 267 } 253 268 254 269 print "Modifying $eid on $tb\n" if $verbose; … … 265 280 # the configuration files and scripts into the new experiment directories. 266 281 if ($state eq "none") { 282 283 if ( -d "$tmpdir/tarfiles") { 284 # Tarfiles have to exist for the creation to work 285 print "copying tarfiles to $tb\n"; 286 &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) || 287 return 0; 288 } 267 289 print "Creating $eid on $tb\n" if $verbose; 268 290 &ssh_cmd($user, $host, "/usr/testbed/bin/startexp -i -f -w -p " . … … 270 292 print "Transferring federation support files to $tb\n" if $verbose; 271 293 # First copy new scripts and hostinfo into the remote /proj 272 &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||294 &scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) || 273 295 return 0; 274 296 &ship_scripts($host, $user, $proj_dir) || return 0; … … 574 596 # XXX: oh is this bad 575 597 s#GWCONF#FEDDIR\`hostname\`.gw.conf#g; 598 s#PROJDIR#/proj/$project{$ctb}/#g; 599 s#EID#$eid#g; 576 600 s#FEDDIR#/proj/$project{$ctb}/exp/$eid/tmp/#g; 577 601 print FILE; … … 582 606 for $t (@tarfiles) { 583 607 die "tarfile '$t' unreadable: $!\n" unless -r $t; 584 for $tb (keys %allocated) { 585 unless (-d "$tmpdir/$tb/tarfiles") { 586 mkdir("$tmpdir/$tb/tarfiles") || 587 die "Can't create $tmpdir/$tb/tarfiles:$!\n"; 588 } 589 copy($t, "$tmpdir/$tb/tarfiles") || 590 die "Can't copy $t to $tmpdir/$tb/tarfiles:$!\n"; 591 } 608 unless (-d "$tmpdir/tarfiles") { 609 mkdir("$tmpdir/tarfiles") || 610 die "Can't create $tmpdir/tarfiles:$!\n"; 611 } 612 copy($t, "$tmpdir/tarfiles") || 613 die "Can't copy $t to $tmpdir/tarfiles:$!\n"; 592 614 } 593 615
Note: See TracChangeset
for help on using the changeset viewer.