Commit 93422c05 authored by Leigh Stoller's avatar Leigh Stoller

Try to catch overquota error when experiment is first created. My

approach is that the person is already overquota and that the initial
mkexpdir script is what fails. Eventually, might need to be more
proactive by checking to see if there some minimal amount of room
before going overquota.
parent 3bb95b4c
......@@ -352,9 +352,33 @@ $justexit = 0;
# Create a directory structure for the experiment.
#
if (system("$mkexpdir $pid $gid $eid") != 0) {
if (($? >> 8) == EDQUOT()) {
# Obey exit status protocol for web page; User should see this.
$errorstat = 1;
}
fatal("$mkexpdir failed");
}
#
# Grab the working directory path, and thats where we work.
# The user's experiment directory is off in /proj space.
#
my $workdir = TBExptWorkDir($pid, $eid);
my $userdir = TBExptUserDir($pid, $eid);
chdir("$workdir") or
fatal("Could not chdir to $workdir: $!");
#
# It would be nice to check for overquota during the rest of this
# setup, but thats going to be a pain. Besides, its very unlikely
# that someone goes overquota at this point. Typically, the person
# is already overquota at this point. If this turns out to be wrong,
# it will be easy to add a little test to make sure there is at least
# a reasonable amount of room to proceed (create temp file and stick
# some data in it).
#
#
# Dump the eventkey into a file in the experiment directory.
#
......@@ -381,16 +405,6 @@ if (!defined($tempnsfile)) {
exit(0);
}
#
# Grab the working directory path, and thats where we work.
# The user's experiment directory is off in /proj space.
#
my $workdir = TBExptWorkDir($pid, $eid);
my $userdir = TBExptUserDir($pid, $eid);
chdir("$workdir") or
fatal("Could not chdir to $workdir: $!");
#
# Now we can get the NS file!
#
......
......@@ -2,10 +2,9 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2003, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
......@@ -40,6 +39,7 @@ use libtestbed;
my $tbdata = "tbdata";
my @dirlist = ($tbdata, "bin", "tmp", "logs", "tftpboot");
my $exitval;
#
# Turn off line buffering on output
......@@ -109,26 +109,30 @@ if (! chdir($expdir)) {
}
if (! mkdir($eid, 0770)) {
$exitval = $ERRNO;
print "Could not mkdir $eid in $expdir: $!\n";
exit(-1);
exit($exitval);
}
if (! chmod(0770, "$eid")) {
$exitval = $ERRNO;
print "Could not chmod $eid to 0770 in $expdir: $!\n";
rmdir($eid);
exit(-1);
exit($exitval);
}
if (! chown($UID, $unix_gid, "$eid")) {
$exitval = $ERRNO;
print "Could not chown $eid to $UID/$unix_gid in $expdir: $!\n";
rmdir($eid);
exit(-1);
exit($exitval);
}
if (! chdir($eid)) {
$exitval = $ERRNO;
print "Could not chdir to $eid in $expdir: $!\n";
rmdir($eid);
exit(-1);
exit($exitval);
}
#
......@@ -155,7 +159,7 @@ DBQueryFatal("update experiments set path='$eiddir' ".
# Create the working directory.
#
if (-e $workdir) {
fatal("$workdir already exists!");
fatal("$workdir already exists!", -1);
}
if (! mkdir($workdir, 0775)) {
fatal("Could not create $workdir: $!");
......@@ -179,16 +183,21 @@ if ($pid ne $gid) {
exit(0);
sub fatal($)
sub fatal($;$)
{
my ($msg) = @_;
my ($msg, $exitval) = @_;
$exitval = $ERRNO
if (!defined($exitval));
system("/bin/rm -rf $eiddir");
system("/bin/rm -rf $workdir");
unlink($eidlink)
if ($pid ne $gid && -l $eidlink);
die("*** $0:\n".
" $msg\n");
print STDERR "*** $0:\n".
" $msg\n";
exit($exitval);
}
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