Commit 5565f82b authored by Mike Hibler's avatar Mike Hibler
Browse files

Change blob transfer (tb-set-tarfile) to use new mserver mechanism.

parent 95b370f5
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2010 University of Utah and the Flux Group.
# Copyright (c) 2004-2010 , 2011University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -96,7 +96,7 @@ sub doboot()
{
my @blobs;
my $errors = 0;
my $need_mkextrafs = 1;
my $bossip;
if (-e "$BOOTDIR/rc.blobs-ran") {
print STDOUT " Blobs installation already done.\n";
......@@ -112,23 +112,55 @@ sub doboot()
return
if (! @blobs);
#
# Convention: blobs starting with /local/ in their install path
# trigger the creation of the extra filesystem. If we do make the
# extrafs, put the tmpdir there as well.
#
my $tmpdir = "/var/tmp";
if (grep(/^\/local\//, @blobs) > 0) {
my $ldir = os_mountextrafs("/local");
if ($ldir ne "/local") {
print STDOUT " WARNING: /local is not a separate filesystem, ".
"hope everything fits!\n";
} elsif (-e "/local/tmp" || mkdir("/local/tmp", 0777)) {
$tmpdir = "/local/tmp";
}
}
unlink("$LOGDIR/blobs.log");
my $blobno = 1;
foreach my $blob (@blobs) {
my ($basename, $dest, $frisbeeargs);
eval {
($mcastaddr, $portnum, undef, $basename, $dest) =
$blob =~ m|^URL=frisbee.mcast://(.+?):(.+?)/(.+/)?(.+) ACTION=unpack:(\S+)|
or die "Bad Blobs line\n";
if ($blob =~ m|^URL=frisbee.mcast://(.+?):(.+?)/(.+/)?(.+) ACTION=unpack:(\S+)|) {
$basename = $4;
$dest = $5;
$frisbeeargs = "-m $1 -p $2";
}
elsif ($blob =~ m|^URL=frisbee://(\S+) ACTION=unpack:(\S+)|) {
$basename = $1;
$dest = $2;
# find the boss IP
if (!defined($bossip)) {
$bossip = `cat $BOOTDIR/bossip`;
if (!$bossip) {
die "Cannot determine boss address\n";
}
chomp($bossip);
}
$frisbeeargs = "-S $bossip -F $basename";
}
else {
die "Bad Blobs line\n";
}
# FIXME: Make sure $basename doesn't exist...
my $local_path = "/var/tmp/$basename";
my $frisbee_cmd = "$FRISBEE -p $portnum -m $mcastaddr $local_path".
my $local_path = "$tmpdir/blob$PID-$blobno";
unlink($local_path);
my $frisbee_cmd = "$FRISBEE $frisbeeargs $local_path".
" >>$LOGDIR/blobs.log 2>&1";
if ($dest =~ /^\/local/ && $need_mkextrafs) {
os_mountextrafs("/local");
$need_mkextrafs = 0;
}
print STDOUT " Downloading blob $basename to $local_path\n";
#print STDOUT "$frisbee_cmd\n";
......@@ -146,8 +178,7 @@ sub doboot()
die "Tarinstall failed (see $LOGDIR/blobs.log)\n";
}
}
system("rm $local_path");
unlink($local_path);
};
if ($@) {
my $err = $@;
......@@ -155,6 +186,7 @@ sub doboot()
warning("$err on line: $blob");
$errors++;
}
$blobno++;
}
if (!$errors) {
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2010 University of Utah and the Flux Group.
* Copyright (c) 2000-2011 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -3249,50 +3249,35 @@ COMMAND_PROTOTYPE(doblobs)
int nrows;
char buf[MYBUFSIZE];
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
char path[255], action[255];
char address[MYBUFSIZE], server_address[MYBUFSIZE];
int frisbee_pid;
res = mydb_query("select b.path,action,load_address,frisbee_pid from experiment_blobs as b join frisbee_blobs as f on b.path=f.path where exptidx=%d order by b.idx",
4, reqp->exptidx);
res = mydb_query("select path,action from experiment_blobs "
" where exptidx=%d order by idx",
2, reqp->exptidx);
if (!res) {
error("BLOBS: %d: DB Error getting blobs!\n",
reqp->exptidx);
error("BLOBS: %s: DB Error getting blobs for %s/%s!\n",
reqp->nodeid, reqp->pid, reqp->eid);
return 1;
}
nrows = (int)mysql_num_rows(res);
if (nrows <= 0) {
return 1;
mysql_free_result(res);
return 0;
}
while (nrows) {
while (nrows > 0) {
row = mysql_fetch_row(res);
frisbee_pid = 0;
path[0] = '\0';
action[0] = '\0';
address[0] = '\0';
server_address[0] = '\0';
strcpy(address, row[2]);
if (row[0] && row[0][0])
strncpy(path, row[0], 255);
if (row[1] && row[1][0])
strncpy(action, row[1], 255);
if (row[0] == NULL || row[0][0] == '\0' ||
row[1] == NULL || row[1][0] == '\0') {
error("BLOBS: %s: bogus path/action for %s/%s in DB\n",
reqp->nodeid, reqp->pid, reqp->eid);
continue;
}
if (row[2] && row[2][0])
strcpy(address, row[2]);
if (row[3] && row[3][0])
frisbee_pid = atoi(row[3]);
bufp += OUTPUT(bufp, ebufp - bufp,
"URL=frisbee.mcast://%s%s ACTION=%s\n",
address, path, action);
"URL=frisbee://%s ACTION=%s\n",
row[0], row[1]);
nrows--;
}
......@@ -4110,7 +4095,6 @@ COMMAND_PROTOTYPE(doloadinfo)
}
if (nrows > 1 && vers <= 29) {
neednewmfs:
bufp += OUTPUT(bufp, ebufp - bufp,
"ADDR=/NEWER-MFS-NEEDED PART=0 PARTOS=Bogus\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment