Commit a3f42091 authored by Mike Hibler's avatar Mike Hibler

Add site variables to control image creation.

These variables were previously constants hardwired into create_image:

images/create/maxwait:
    Max time (minutes) to allow for saving an image
images/create/idlewait:
    Max time (minutes) to allow between periods of progress
    (image file getting larger) when saving an image (should be <= maxwait)
images/create/maxsize:
    Max size (GB) of a created image
parent 7b9b115a
......@@ -93,6 +93,9 @@ INSERT INTO sitevariables VALUES ('general/default_latitude','40.768652','','The
INSERT INTO sitevariables VALUES ('general/default_longitude','-111.84581','','The default longitude of your site',0);
INSERT INTO sitevariables VALUES ('oml/default_osid',NULL,'','Default OSID to use for OML server',1);
INSERT INTO sitevariables VALUES ('oml/default_server_startcmd',NULL,'','Default command line to use to start OML server',1);
INSERT INTO sitevariables VALUES ('images/create/maxwait',NULL,'72','Max time (minutes) to allow for saving an image',0);
INSERT INTO sitevariables VALUES ('images/create/idlewait',NULL,'8','Max time (minutes) to allow between periods of progress (image file getting larger) when saving an image (should be <= maxwait)',0);
INSERT INTO sitevariables VALUES ('images/create/maxsize',NULL,'6','Max size (GB) of a created image',0);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
......
#
# Add sitevariables to control image creation limits.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
DBQueryFatal("INSERT INTO sitevariables VALUES ".
"('images/create/maxwait',NULL,'72',".
"'Max time (minutes) to allow for saving an image',0)")
if (!TBSiteVarExists("images/create/maxwait"));
DBQueryFatal("INSERT INTO sitevariables VALUES ".
"('images/create/idlewait',NULL,'8',".
"'Max time (minutes) to allow between periods of progress (image file getting larger) when saving an image (should be <= maxwait)',0)")
if (!TBSiteVarExists("images/create/idlewait"));
DBQueryFatal("INSERT INTO sitevariables VALUES ".
"('images/create/maxsize',NULL,'6',".
"'Max size (GB) of a created image',0)")
if (!TBSiteVarExists("images/create/maxsize"));
return 0;
}
1;
......@@ -10,7 +10,7 @@ use POSIX qw(setsid);
use File::Basename;
#
# Tuneables:
# Image Creation Tuneables.
#
# $maxwait max wall clock time to allow, progress or not
# Empirically we have observed about 1.6MB/sec on a pc850
......@@ -29,7 +29,27 @@ my $maxwait = (72 * 60);
my $idlewait = ( 8 * 60);
my $reportwait = ( 2 * 60);
my $checkwait = 15;
my $maximagesize = (20 * 1024**3); # 20GB
my $maximagesize = (6 * 1024**3); # 20GB
#
# Use defaults from sitevars (if they exist) for some of these.
#
my $tmp;
if (TBGetSiteVar("image/create/maxwait", \$tmp)) {
$maxwait = $tmp * 60;
}
if (TBGetSiteVar("image/create/idlewait", \$tmp)) {
$idlewait = $tmp * 60;
}
if (TBGetSiteVar("image/create/maxsize", \$tmp)) {
$maximagesize = $tmp * 1024**3;
}
$idlewait = $maxwait
if ($maxwait < $idlewait);
$reportwait = $idlewait
if ($idlewait < $reportwait);
$checkwait = $reportwait
if ($reportwait < $checkwait);
#
# Create a disk image.
......
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