Commit d7fa55e9 authored by Gary Wong's avatar Gary Wong

Enforce future reservations, if sitevar general/admission_control is set.

parent 1dc98b39
......@@ -36,7 +36,7 @@ sub usage()
{
print("Usage: nalloc [-d] [-f] [-p] <pid> <eid> <node> <node> <...>\n".
" -p enables partial allocation mode\n".
" -f forces allocation, overriding admission control\n" .
" -f forces allocation, overriding admission control\n" .
" -d enables debugging output\n");
exit(-1);
}
......@@ -102,15 +102,16 @@ my @node_names = @ARGV;
#
# Locals
#
my $error = 0;
my $noalloc = 0;
my @oldnodes = ();
my @nodes = ();
my $need_consetup = 0;
my @need_history = ();
my @need_clearbl = ();
my @need_pxeconfig= ();
my $errormsg = "";
my $error = 0;
my $noalloc = 0;
my @oldnodes = ();
my @nodes = ();
my $need_consetup = 0;
my @need_history = ();
my @need_clearbl = ();
my @need_pxeconfig = ();
my $errormsg = "";
my $admission_ctrl = 0;
TBDebugTimeStamp("nalloc started");
......@@ -142,6 +143,9 @@ if (!$experiment->AccessCheck($this_user, TB_EXPT_MODIFY)) {
" You do not have permission to allocate nodes in $pid/$eid\n");
}
$admission_ctrl = TBGetSiteVar( "general/admission_control" );
$admission_ctrl = defined( $admission_ctrl ) && $admission_ctrl;
#
# Before locking any tables, do a quick check to make sure the project
# is allowed to allocate the nodes, by type/class, plus other checks.
......@@ -231,10 +235,15 @@ if ($debug) {
print "List Ready: @nodes\nError=$error\n";
}
# Admission control check -- advisory only, for now.
# Admission control check -- advisory only, unless sitevar
# general/admission_control is turned on.
if ($debug) {
print "Running advisory admission control verification...\n";
if( $admission_ctrl ) {
print "Running admission control verification...\n";
} else {
print "Running advisory admission control verification...\n";
}
}
my %types = ();
......@@ -245,6 +254,9 @@ foreach my $type ( keys( %types ) ) {
my $reservations = Reservation->LookupAll( $type );
if( !Reservation->IsFeasible( $reservations, \$errormsg ) ) {
print "Existing admission control violation for type $type: $errormsg\n";
if( $admission_ctrl ) {
$noalloc++;
}
print "Omitting admission control verification.\n";
goto admissionfailure;
}
......@@ -273,7 +285,9 @@ foreach my $type ( keys( %types ) ) {
print STDERR "WARNING: SCHEDULED RESERVATIONS ARE NOW INFEASIBLE!\n";
# FIXME notify admins about violation
} else {
# FIXME once we enforce admission control, we will abort here!
if( $admission_ctrl ) {
$noalloc++;
}
}
goto admissionfailure;
}
......
......@@ -173,6 +173,7 @@ INSERT INTO sitevariables VALUES ('reload/failtime',NULL,'0','If a node has been
INSERT INTO sitevariables VALUES ('reload/warnonretry',NULL,'1','If non-zero send e-mail to testbed-ops when a retry is attempted.',0);
INSERT INTO sitevariables VALUES ('reload/hwdownaction',NULL,'nothing','What to do when nodes are moved to hwdown. One of: poweroff, adminmode, or nothing.',0);
INSERT INTO sitevariables VALUES ('general/architecture_priority',NULL,'x86_64,aarch64','Default mapper ordering for multi architecture testbeds.',0);
INSERT INTO sitevariables VALUES ('general/admission_control','0','0','When set, refuse node allocation if reservation admission control fails.',0);
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
......
#
# Add sitevariable for reservation admission control.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
DBQueryFatal("INSERT INTO `sitevariables` VALUES ".
"('general/admission_control','0','0','When set, refuse node allocation if reservation admission control fails.',0)")
if (!TBSiteVarExists("general/admission_control"));
return 0;
}
1;
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