Commit 41d34103 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.

Added sanity checks to batchexp, swapexp, and endexp to watch for the
case that testbed admin installed the new code but did not run the
fixup script as instructed in doc/UPDATING.
parent 1855897b
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -204,6 +204,12 @@ usage()
usage()
if (defined($tempnsfile) && defined($copyarg));
if (! -e "$TB/expinfo/$pid") {
die("*** $0:\n".
" $TB/expinfo/$pid has not been created yet!\n".
" Did you run 'fixexpinfo' like you were supposed to?\n");
}
if (!defined($gid)) {
$gid = $pid;
}
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -158,6 +158,32 @@ my $pid = $experiment->pid();
my $eid = $experiment->eid();
my $swapper = $experiment->GetSwapper();
my $workdir = $experiment->WorkDir();
my $userdir = $experiment->UserDir();
my $infodir = $experiment->InfoDir();
# Sanity check.
if (! (-e $workdir && -e $userdir)) {
die("*** $0:\n".
" Missing a critical directory!\n");
}
if (! -e $infodir) {
if (! -e "$TB/expinfo/$pid") {
die("*** $0:\n".
" $TB/expinfo/$pid has not been created yet!\n".
" Did you run 'fixexpinfo' like you were supposed to?\n");
}
#
# This is not going to happen unless a devel tree has been
# mixed with the main tree (or another devel tree). Try to
# recover, bail of not possible.
#
if (system("/bin/mkdir -m 777 -p $infodir")) {
die("*** $0:\n".
" $infodir was missing and cannot be created!\n");
}
}
#
# See if this is a template instance; error if the -x option not provided,
# since that means user is trying to self-terminate; not in the program.
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -74,6 +74,7 @@ my $expdir = "$piddir/exp";
my $eiddir = "$expdir/$eid";
my $eidlink = "$projroot/$pid/exp/$eid";
my $workdir = TBExptWorkDir($pid, $eid);
my $INFODIR = "$TB/expinfo";
#
# Unix info for the group
......@@ -153,6 +154,20 @@ if (! chown($UID, $unix_gid, "$workdir")) {
fatal("Could not chown $workdir to $UID/$unix_gid: $!");
}
#
# Create the expinfo directory.
#
my $expinfo = "$INFODIR/$pid/$eid";
if (! -e $expinfo) {
if (! mkdir($expinfo, 0777)) {
fatal("Could not create $expinfo: $!");
}
if (! chown($UID, $unix_gid, "$expinfo")) {
fatal("Could not chown $expinfo to $UID/$unix_gid: $!");
}
}
#
# If a group experiment, leave behind a symlink from the project experiment
# directory to the group experiment directory. This is convenient so that
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -427,6 +427,23 @@ if (! -e $workdir) {
}
}
#
# Create experiment info (long term archive) directory.
#
my $infodir = "$TB/expinfo/$pid";
if (! -e $infodir) {
if (! mkdir("$infodir", 0775)) {
fatal("Could not make directory $infodir: $!");
}
if (! chmod(0775, "$infodir")) {
fatal("Could not chmod directory $infodir: $!");
}
if (! chown($uid, $gid, "$infodir")) {
fatal("Could not chown $infodir to $uid/$gid: $!");
}
}
#
# If approved to use remote nodes, then grant permission to use the
# specific types of virtual nodes on those remote physical nodes.
......
......@@ -305,6 +305,7 @@ if (! $experiment) {
my $workdir = $experiment->WorkDir();
my $userdir = $experiment->UserDir();
my $infodir = $experiment->InfoDir();
#
# See if this is a template instance; error if the -x option not provided,
......@@ -317,6 +318,28 @@ if (my $instance = Template::Instance->LookupByExptidx($experiment->idx())) {
}
}
# Sanity check.
if (! (-e $workdir && -e $userdir)) {
die("*** $0:\n".
" Missing a critical directory! Stopping now ...\n");
}
if (! -e $infodir) {
if (! -e "$TB/expinfo/$pid") {
die("*** $0:\n".
" $TB/expinfo/$pid has not been created yet!\n".
" Did you run 'fixexpinfo' like you were supposed to?\n");
}
#
# This is not going to happen unless a devel tree has been
# mixed with the main tree (or another devel tree). Try to
# recover, bail of not possible.
#
if (system("/bin/mkdir -m 777 -p $infodir")) {
die("*** $0:\n".
" $infodir was missing and cannot be created!\n");
}
}
# XXX Hack for geni mode.
if ($genimode) {
$experiment->SetState(EXPTSTATE_ACTIVE);
......
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