Commit 8c85cf56 authored by Leigh Stoller's avatar Leigh Stoller

Change to infodir (/usr/testbed/expinfo) handling; experiment

directories are now placed in a project subdirectory, to avoid
blowing out the max number of subdirs (32K in FreeBSD). Dirs are
now called $pid/$eid/$idx.

Cleanup and move infodir method to the experiment library.
parent f08be568
......@@ -1510,6 +1510,21 @@ sub UserDir($)
return $self->path();
}
# Long term storage.
sub InfoDir($$)
{
my ($self) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $pid = $self->pid();
my $eid = $self->eid();
my $idx = $self->idx();
return "$TB/expinfo/$pid/$eid/$idx";
}
# Event/Web key filenames.
sub EventKeyPath($)
......@@ -2685,13 +2700,13 @@ sub SaveLogFiles($)
my $pid = $self->pid();
my $eid = $self->eid();
my $workdir = $self->WorkDir();
my $logdir = TBExptLogDir($pid, $eid);
my $infodir = $self->InfoDir();
# What the hell is this file! Very annoying.
if (-e "$workdir/.rnd") {
mysystem("/bin/rm -f $workdir/.rnd");
}
mysystem("/bin/cp -Rpf $workdir/ $logdir");
mysystem("/bin/cp -Rpf $workdir/ $infodir");
return 0;
}
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008 University of Utah and the Flux Group.
# Copyright (c) 2008-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -164,7 +164,7 @@ DBQueryFatal("update experiments set ".
#
my $workdir = $experiment->WorkDir();
my $userdir = $experiment->UserDir();
my $logdir = TBExptLogDir($experiment->pid(), $experiment->eid());
my $infodir = $experiment->InfoDir();
if (system("$CHOWN $target_uid $workdir")) {
fatal("Failed: '$CHOWN $target_user $workdir'");
......@@ -172,8 +172,8 @@ if (system("$CHOWN $target_uid $workdir")) {
if (system("$CHOWN $target_uid $userdir")) {
fatal("Failed: '$CHOWN $target_user $userdir'");
}
if (system("$CHOWN $target_uid $logdir")) {
fatal("Failed: '$CHOWN $target_user $logdir'");
if (system("$CHOWN $target_uid $infodir")) {
fatal("Failed: '$CHOWN $target_user $infodir'");
}
exit(0);
......
......@@ -174,7 +174,7 @@ use vars qw(@ISA @EXPORT);
TBIsNodeImageable TBIsNodeVirtual TBControlNetIP TBPhysNodeID
TBNodeUpdateAccountsByPid TBNodeUpdateAccountsByType
TBNodeUpdateAccountsByUID
TBSaveExpLogFiles TBExptWorkDir TBExptUserDir TBExptLogDir
TBExptWorkDir TBExptUserDir
TBIPtoNodeID TBNodeBootReset TBNodeStateWait
TBExptSetSwapUID TBExptSetThumbNail
TBPlabNodeUsername MarkPhysNodeDown
......@@ -1889,24 +1889,6 @@ sub MarkPhysNodeDown($)
TBSetNodeHistory($pnode, TB_NODEHISTORY_OP_MOVE, $UID, $pid, $eid);
}
#
# Return the working directory name for an experiment. This is where
# the scripts work. The logs are copied over to the user's version of
# the directory later.
#
sub TBExptLogDir($$)
{
my($pid, $eid) = @_;
my $query_result =
DBQueryFatal("select idx from experiments ".
"where pid='$pid' and eid='$eid'");
my ($idx) = $query_result->fetchrow_array;
return "$TB/expinfo/${pid}-${eid}.${idx}";
}
#
# Return the IDX for a current experiment.
#
......@@ -3259,25 +3241,6 @@ sub MapNodeOSID($$)
return $n_osid;
}
#
# Save off the log files for an experiment to long term storage.
#
sub TBSaveExpLogFiles($$)
{
my($pid, $eid) = @_;
my $workdir = TBExptWorkDir($pid, $eid);
my $logdir = TBExptLogDir($pid, $eid);
# What the hell is this file! Very annoying.
if (-e "$workdir/.rnd") {
system("/bin/rm -f $workdir/.rnd");
}
system("/bin/cp -Rpf $workdir/ $logdir");
return 1;
}
#
# Grab the tipserver list and return.
#
......
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