Commit 04c858da authored by Leigh Stoller's avatar Leigh Stoller

Turn the hardwired limit on autoswap maximum into a sitevar; general/autoswap_max

parent d87285c8
......@@ -390,13 +390,14 @@ if (exists($editexp_args{"autoswap"})) {
$editexp_args{"autoswap"} = 0;
}
}
my $autoswap_max = TBGetSiteVar("general/autoswap_max");
if (exists($editexp_args{"autoswap_timeout"})) {
if ($editexp_args{"autoswap_timeout"} <= 0) {
UserError("Max Duration: Invalid time provided");
}
if ($editexp_args{"autoswap_timeout"} > (24 * 5) &&
if ($editexp_args{"autoswap_timeout"} > $autoswap_max &&
!$this_user->IsAdmin()) {
UserError("Max Duration: 5 days maximum - ".
UserError("Max Duration: $autoswap_max hours maximum - ".
"you must ask testbed operations for more");
}
}
......
......@@ -102,6 +102,7 @@ INSERT INTO sitevariables VALUES ('images/frisbee/maxrate_std',NULL,'72000000','
INSERT INTO sitevariables VALUES ('images/frisbee/maxrate_usr',NULL,'54000000','Max bandwidth (Bytes/sec) at which to distribute user-defined images from the /proj/.../images directory.',0);
INSERT INTO sitevariables VALUES ('general/idlepower_enable',NULL,'0','Enable idle power down to conserve electricity',0);
INSERT INTO sitevariables VALUES ('general/idlepower_idletime',NULL,'3600','Maximum number of seconds idle before a node is powered down to conserve electricity',0);
INSERT INTO sitevariables VALUES ('general/autoswap_max',NULL,'120','Maximum number of hours for the experiment autoswap limit.',0);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
......
#
# Add sitevar to control how long the user is allowed to the autoswap
# out field to
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
DBQueryFatal("INSERT INTO sitevariables VALUES ".
" ('general/autoswap_max',NULL,'120', ".
" 'Maximum number of hours for the ".
"experiment autoswap limit.', 0)")
if (!TBSiteVarExists("idle/autoswap_max"));
return 0;
}
1;
......@@ -64,6 +64,7 @@ $uid = $this_user->uid();
# Need this below;
$idleswaptimeout = TBGetSiteVar("idle/threshold");
$autoswap_max = TBGetSiteVar("general/autoswap_max");
# Convert the xml into PHP datatypes; an array of arguments. We ignore the
# the method for now.
......@@ -274,8 +275,8 @@ else {
$errors["Max. Duration"] = "No or invalid time provided";
}
# The user can override autoswap timeout, but limit unless an admin.
if ($formfields["exp_autoswap_timeout"] > 24 * 5 && !ISADMIN()) {
$errors["Max. Duration"] = "5 days maximum - ".
if ($formfields["exp_autoswap_timeout"] > $autoswap_max && !ISADMIN()) {
$errors["Max. Duration"] = "$autoswap_max hours maximum - ".
"you must ask testbed operations for more";
}
}
......
......@@ -17,6 +17,7 @@ $this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
$idleswaptimeout = TBGetSiteVar("idle/threshold");
$autoswap_max = TBGetSiteVar("general/autoswap_max");
#
# Verify page arguments.
......@@ -43,6 +44,7 @@ function SPITFORM($experiment, $formfields, $errors)
{
global $isadmin, $TBDOCBASE, $linktest_levels, $EXPOSELINKTEST;
global $WIKIDOCURL, $TBMAILADDR;
global $autoswap_max;
#
# Standard Testbed Header
......@@ -310,7 +312,7 @@ function SPITFORM($experiment, $formfields, $errors)
<ol type=1 start=1>
<li> You may not turn off Maximum Duration, but you are allowed
to change the
the number of hours, up to five days (5 * 24 hours).
the number of hours, up to $autoswap_max hours.
Contact " . $TBMAILADDR . " if you need more time.
</li>
</ol>
......
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