- Timestamp:
- Sep 4, 2007 6:52:58 PM (17 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- c23025e
- Parents:
- 61f19e0
- Location:
- fedkit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/federate.sh
r61f19e0 r63f7c7e 3 3 BOSSNODE="/usr/local/etc/emulab/bossnode" 4 4 # GATEWAY="detertunnel" 5 6 PORTS="139 7777" 7 NC="/usr/bin/nc" 8 RCDIR="/usr/local/etc/emulab/rc" 9 10 RCACCT="rc.accounts" 11 SMBMOUNT="smbmount.pl" 5 12 6 13 if [ -f $BOSSNODE ] … … 10 17 11 18 EMUDIR="/usr/local/etc/emulab/" 19 20 # Find this experiment's stashed scripts. (Perl for advanced parsing) 21 SCRIPTDIR=`$EMUDIR/tmcc -b status | perl -ne '/ALLOCATED=([^\/]+)\/([^\s]+)/ && print "/proj/$1/exp/$2/tmp\n";'` 22 23 # Die if things are weird 24 if [ -z "$SCRIPTDIR" ] ; then 25 echo "Can't find federation scripts. Tmcc status says:" 26 $EMUDIR/tmcc -b status 27 exit 1; 28 fi 29 30 # Move the SMB mounting script out of NFS so we can call it after the umount 31 cp "$SCRIPTDIR/$SMBMOUNT" /tmp 32 33 # Copy the global hostnames file into /etc/hosts so this node can address 34 # others in the experiment on other testbeds. 35 grep 127\\.0\\.0\\.1 /etc/hosts > /tmp/hosts 36 cat "$SCRIPTDIR/hosts" >> /tmp/hosts 37 cp /tmp/hosts /etc/hosts && rm /tmp/hosts 38 12 39 GATEWAY=`$EMUDIR/tmcc -b syncserver | awk ' { match($0, /SERVER=[^[:space:]]+/); print substr($0,RSTART+8,RLENGTH-9);}'` 13 14 PORTS="139 7777"15 NC="/usr/bin/nc"16 RCDIR="/usr/local/etc/emulab/rc"17 18 RCACCT="rc.accounts"19 SMBMOUNT="smbmount.pl"20 40 21 41 # … … 43 63 echo $GATEWAY > $BOSSNODE 44 64 65 45 66 # 46 67 # Unmount stuff before messing with accounts … … 60 81 echo "Mounting via SMB." 61 82 62 exec $EMUDIR/$SMBMOUNT83 exec "/tmp/$SMBMOUNT" -
fedkit/splitter.pl
r61f19e0 r63f7c7e 2 2 3 3 use Getopt::Std; 4 5 @scripts = ("federate.sh", "smbmount.pl"); 6 $local_script_dir = "."; 4 7 5 8 # use scp to transfer a file, reporting true if successful and false otherwise. … … 41 44 } 42 45 else { return 1; } 46 } 47 48 # Ship local copies of the federation scripts out to the given host. If any of 49 # the script transfers fails, return 0. The scripts to transfer are from the 50 # global @scripts and are found locally in $local_script_dir (another global). 51 sub ship_scripts { 52 my($host, $user, $dest_dir) = @_; # Where, who, where remotely 53 my($s); 54 55 for $s (@scripts) { 56 &scp_file("$local_script_dir/$s", "$user\@$host", $dest_dir) || 57 return 0; 58 } 59 return 1; 43 60 } 44 61 … … 60 77 my($tclfile) = "./$eid.$tb.tcl"; # Local tcl file with the 61 78 # sub-experiment 62 my($to_hostname) = "/proj/$pid/hosts.$eid"; # remote hostnames file 79 my($proj_dir) = "/proj/$pid/exp/$eid/tmp"; # Where to stash federation stuff 80 my($to_hostname) = "$proj_dir/hosts"; # remote hostnames file 63 81 64 82 # Determine the status of the remote experiment … … 79 97 print "$tb: $state\n"; 80 98 81 # Copy the configuration data over (unless the host is local)99 # Copy the experiment definition data over (unless the host is local) 82 100 if ( $host ne "localhost") { 83 101 &scp_file($tclfile, "$user\@$host") || return 0; 84 &scp_file("./hostnames", "$user\@$host", $to_hostname) || return 0;85 102 } 86 103 87 104 # Remote experiment is active. Modify it. 88 105 if ($state eq "active") { 106 # First copy new scripts and hostinfo into the remote /proj 107 &scp_file("./hostnames", "$user\@$host", $to_hostname) || return 0; 108 &ship_scripts($host, $user, $proj_dir) || return 0; 89 109 &ssh_cmd($user, $host, "/usr/testbed/bin/modexp -r -s -w $pid " . 90 110 "$eid $tclfile", "modexp") || return 0; … … 96 116 &ssh_cmd($user, $host, "/usr/testbed/bin/modexp -w $pid $eid $tclfile", 97 117 "modexp") || return 0; 118 # First copy new scripts and hostinfo into the remote /proj 119 &scp_file("./hostnames", "$user\@$host", $to_hostname) || return 0; 120 &ship_scripts($host, $user, $proj_dir) || return 0; 121 # Now start up 98 122 &ssh_cmd($user, $host, "/usr/testbed/bin/swapexp -w $pid $eid in", 99 123 "swapexp") || return 0; … … 101 125 } 102 126 103 # No remote experiment. Create one. 127 # No remote experiment. Create one. We do this in 2 steps so we can put 128 # the configuration files and scripts into the new experiment directories. 104 129 if ($state eq "none") { 105 &ssh_cmd($user, $host, "/usr/testbed/bin/startexp - i-w -p " .130 &ssh_cmd($user, $host, "/usr/testbed/bin/startexp -f -w -p " . 106 131 "$pid -e $eid $tclfile", "startexp") || return 0; 132 # First copy new scripts and hostinfo into the remote /proj 133 &scp_file("./hostnames", "$user\@$host", $to_hostname) || return 0; 134 &ship_scripts($host, $user, $proj_dir) || return 0; 135 # Now start up 136 &ssh_cmd($user, $host, "/usr/testbed/bin/swapexp -w $pid $eid in", 137 "swapexp") || return 0; 107 138 return 1; 108 139 } … … 138 169 139 170 # Argument processing. 140 getopts(' c:m:e:f:n', \%opts);171 getopts('d:c:m:e:f:n', \%opts); 141 172 142 173 $eid = $opts{'e'}; # Experiment ID … … 145 176 $startem = $opts{'n'} ? 0 : 1; # If true, start the sub-experiments 146 177 $config = $opts{'c'} || "./testbeds"; 178 $local_script_dir = $opts{'d'}; # Local scripts 179 180 for $s (@scripts) { 181 die "$local_script_dir/$s not in local script directory. Try -d\n" 182 unless -r "$local_script_dir/$s"; 183 } 147 184 148 185 die "Must supply file, master and experiment" unless $master && $tcl && $eid; … … 265 302 266 303 B<splitter.pl> B<-e> I<experiment> B<-m> I<master_testbed> [B<-n>] 267 [B<-c> I<config_file>] [B<-f> I<experiment_tcl>] [I<experiment_tcl>] 304 [B<-d> F<script_dir>] [B<-c> F<config_file>] [B<-f> F<experiment_tcl>] 305 [F<experiment_tcl>] 268 306 269 307 =head1 DESCRIPTION … … 289 327 currently instantiated last. 290 328 329 Scripts to start federation are copied into the local experiment's tmp file - 330 e.g., F</proj/DETER/exp/simple-split/tmp>. These are taken from the directory 331 given by the B<-d> option. 332 291 333 If any sub-experiment fails to instantiate, the other sub-exeriments are 292 334 swapped out.
Note: See TracChangeset
for help on using the changeset viewer.