Commit c57c1fd9 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add calls to utils/checkquota script. An experiment may not be

created, swapped in or modified when overquota. Ditto for creating
images.
parent 1e06daca
......@@ -72,6 +72,7 @@ my $TBOPS = "@TBOPSEMAIL@";
my $TBLOGS = "@TBLOGSEMAIL@";
my $TBDOCBASE = "@TBDOCBASE@";
my $TBBASE = "@TBBASE@";
my $CONTROL = "@USERNODE@";
#
# Testbed Support libraries
......@@ -82,6 +83,7 @@ use libtestbed;
my $parser = "$TB/libexec/parse-ns";
my $mkexpdir = "$TB/libexec/mkexpdir";
my $checkquota = "$TB/sbin/checkquota";
my $tbbindir = "$TB/bin/";
my $errorstat=-1;
my $user_name;
......@@ -150,6 +152,17 @@ if (! UserDBInfo($dbuid, \$user_name, \$user_email)) {
" Cannot determine your name and email address.\n");
}
#
# Before doing anything else, check for overquota ... lets not waste
# our time. Make sure user sees the error by exiting with 1.
#
if (system("$checkquota $dbuid") != 0) {
print STDERR
"*** $0:\n".
" You are over your disk quota on $CONTROL; please cleanup!\n";
exit(1);
}
#
# Parse command arguments.
#
......
......@@ -70,6 +70,7 @@ my $TBLOGS = "@TBLOGSEMAIL@";
my $TBINFO = "$TB/expinfo";
my $TBDOCBASE = "@TBDOCBASE@";
my $TBBASE = "@TBBASE@";
my $CONTROL = "@USERNODE@";
#
# Testbed Support libraries
......@@ -88,6 +89,7 @@ my $signaled = 0;
my $tbdir = "$TB/bin";
my $tbdata = "tbdata";
my $checkquota = "$TB/sbin/checkquota";
my $batch = 0;
my $idleswap = 0;
my $autoswap = 0;
......@@ -299,6 +301,17 @@ if ($waitmode) {
$SIG{INT} = 'IGNORE';
}
#
# Check for overquota; we deal with it below, cause of the batch system.
#
my $overquota = system("$checkquota $dbuid");
if ($overquota) {
print STDERR
"*** $0:\n".
" You are over your disk quota on $CONTROL; please cleanup!\n";
}
#
# Temp fix; Disallow swapmod to firewalled experiments. This will come
# out later.
......@@ -392,6 +405,11 @@ if ($batch) {
die("*** $0:\n".
" Batch experiment $pid/$eid has been canceled! Aborting.\n")
if ($canceled);
# Do not allow it to swap in. What about swapout?
die("*** $0:\n".
" Batch experiment cannot swap in when over quota! Aborting.\n")
if ($overquota);
}
elsif ($inout eq "out") {
die("*** $0:\n".
......@@ -422,6 +440,12 @@ else {
"Batch experiment $pid/$eid must be SWAPPED to\n".
"QUEUE. Currently $estate.")
if ($estate ne EXPTSTATE_SWAPPED);
ExitWithStatus(1,
"Batch experiment $pid/$eid cannot swap in when ".
"over quota!\n")
if ($overquota);
SetExpState($pid, $eid, EXPTSTATE_QUEUED);
}
elsif ($inout eq "out") {
......@@ -466,7 +490,12 @@ else {
ExitWithStatus(1,
"Cannot modify an active ElabInElab experiment (yet).")
if ($elabinelab && $estate ne EXPTSTATE_SWAPPED && !$isadmin);
ExitWithStatus(1,
"Cannot modify batch experiment $pid/$eid when ".
"over quota!\n")
if ($overquota);
#
# Otherwise, proceed with the modify. The experiment will be
# locked below, and so it cannot be injected or otherwise messed
......@@ -511,6 +540,11 @@ else {
ExitWithStatus(1,
"Experiment $pid/$eid is not swapped out!");
}
ExitWithStatus(1,
"Experiment $pid/$eid cannot swap in when ".
"over quota!\n")
if ($overquota);
last SWITCH;
};
/^out$/i && do {
......@@ -572,6 +606,11 @@ else {
"Cannot modify an active ElabInElab experiment (yet).")
if ($elabinelab &&
$estate ne EXPTSTATE_SWAPPED && !$isadmin);
ExitWithStatus(1,
"Experiment $pid/$eid cannot be modified ".
"when over quota!\n")
if ($overquota);
last SWITCH;
};
......
......@@ -38,6 +38,7 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $TBLOGS = "@TBLOGSEMAIL@";
my $BOSSNODE = "@BOSSNODE@";
my $CONTROL = "@USERNODE@";
my $TFTPDIR = "/tftpboot";
#
......@@ -65,6 +66,7 @@ my $nodereboot = "$TB/bin/node_reboot";
my $createimage = "/usr/local/bin/create-image";
my $friskiller = "$TB/sbin/frisbeelauncher";
my $osselect = "$TB/bin/os_select";
my $checkquota = "$TB/sbin/checkquota";
my $devtype = "ad";
my $devnum = 0;
my $mereuser = 0;
......@@ -155,6 +157,15 @@ if ($UID && !TBAdmin($UID)) {
}
}
#
# Before doing anything else, check for overquota ... lets not waste
# our time. Make sure user sees the error by exiting with 1.
#
if (system("$checkquota $dbuid") != 0) {
die("*** $0:\n".
" You are over your disk quota on $CONTROL; please cleanup!\n");
}
#
# Get email info for user.
#
......
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