Commit 6a822381 authored by Gary Wong's avatar Gary Wong

Make reservations work for classic experiments only, if !PROTOGENI_SUPPORT.

parent a7fded2a
...@@ -42,6 +42,7 @@ use overload ('""' => 'Stringify'); ...@@ -42,6 +42,7 @@ use overload ('""' => 'Stringify');
# Configure variables # Configure variables
my $TB = "@prefix@"; my $TB = "@prefix@";
my $PGENISUPPORT= @PROTOGENI_SUPPORT@;
my %cache = (); my %cache = ();
BEGIN { use emutil; emutil::AddCache(\%cache); } BEGIN { use emutil; emutil::AddCache(\%cache); }
...@@ -362,22 +363,37 @@ sub LookupAll($$) ...@@ -362,22 +363,37 @@ sub LookupAll($$)
my @reservations = (); my @reservations = ();
my $query_result = DBQueryWarn( "SELECT COUNT(*), e.pid, e.eid, " . my $query = $PGENISUPPORT ? "SELECT COUNT(*), e.pid, e.eid, " .
"e.expt_swap_uid, " . "e.expt_swap_uid, " .
"UNIX_TIMESTAMP( e.expt_swapped ) + " . "UNIX_TIMESTAMP( e.expt_swapped ) + " .
"e.autoswap_timeout * 60, e.autoswap, " . "e.autoswap_timeout * 60, e.autoswap, " .
"nr.pid, UNIX_TIMESTAMP( s.expires ), " . "nr.pid, UNIX_TIMESTAMP( s.expires ), " .
"s.lockdown FROM nodes AS n " . "s.lockdown FROM nodes AS n " .
"LEFT OUTER JOIN " . "LEFT OUTER JOIN " .
"reserved AS r ON n.node_id=r.node_id " . "reserved AS r ON n.node_id=r.node_id " .
"LEFT OUTER JOIN experiments AS e ON " . "LEFT OUTER JOIN experiments AS e ON " .
"r.pid=e.pid AND r.eid=e.eid LEFT " . "r.pid=e.pid AND r.eid=e.eid LEFT " .
"OUTER JOIN next_reserve AS nr ON " . "OUTER JOIN next_reserve AS nr ON " .
"n.node_id=nr.node_id LEFT OUTER JOIN " . "n.node_id=nr.node_id LEFT OUTER JOIN " .
"`geni-cm`.geni_slices AS s ON " . "`geni-cm`.geni_slices AS s ON " .
"e.eid_uuid=s.uuid " . "e.eid_uuid=s.uuid " .
"WHERE n.type='$type' GROUP BY " . "WHERE n.type='$type' GROUP BY " .
"e.pid, e.eid" ); "e.pid, e.eid" :
"SELECT COUNT(*), e.pid, e.eid, " .
"e.expt_swap_uid, " .
"UNIX_TIMESTAMP( e.expt_swapped ) + " .
"e.autoswap_timeout * 60, e.autoswap, " .
"nr.pid, NULL, " .
"NULL FROM nodes AS n " .
"LEFT OUTER JOIN " .
"reserved AS r ON n.node_id=r.node_id " .
"LEFT OUTER JOIN experiments AS e ON " .
"r.pid=e.pid AND r.eid=e.eid LEFT " .
"OUTER JOIN next_reserve AS nr ON " .
"n.node_id=nr.node_id WHERE n.type='$type' " .
"GROUP BY e.pid, e.eid";
my $query_result = DBQueryWarn( $query );
while( my($count, $pid, $eid, $uid, $end, $autoswap, $next_reserve, while( my($count, $pid, $eid, $uid, $end, $autoswap, $next_reserve,
$slice_expire, $slice_lockdown ) = $slice_expire, $slice_lockdown ) =
$query_result->fetchrow_array() ) { $query_result->fetchrow_array() ) {
......
...@@ -49,6 +49,7 @@ my $partial = 0; ...@@ -49,6 +49,7 @@ my $partial = 0;
my $TB = "@prefix@"; my $TB = "@prefix@";
my $consetup = "$TB/libexec/console_setup"; my $consetup = "$TB/libexec/console_setup";
my $makeconf = "$TB/sbin/dhcpd_makeconf"; my $makeconf = "$TB/sbin/dhcpd_makeconf";
my $PGENISUPPORT= @PROTOGENI_SUPPORT@;
# #
# Testbed Support libraries # Testbed Support libraries
...@@ -166,7 +167,11 @@ TBDebugTimeStamp("nalloc checked all node permissions"); ...@@ -166,7 +167,11 @@ TBDebugTimeStamp("nalloc checked all node permissions");
# Argh, MySQL locking rules are horrendous! These locks are required by # Argh, MySQL locking rules are horrendous! These locks are required by
# low-level library routines; this is a horrible violation of abstraction; # low-level library routines; this is a horrible violation of abstraction;
# and it's all MySQL's fault... # and it's all MySQL's fault...
DBQueryFatal("lock tables reserved write, users read, groups read, projects read, future_reservations read, nodes as n read, reserved as r read, experiments as e read, next_reserve as nr read, `geni-cm`.geni_slices as s read"); if( $PGENISUPPORT ) {
DBQueryFatal("lock tables reserved write, users read, groups read, projects read, future_reservations read, nodes as n read, reserved as r read, experiments as e read, next_reserve as nr read, `geni-cm`.geni_slices as s read");
} else {
DBQueryFatal("lock tables reserved write, users read, groups read, projects read, future_reservations read, nodes as n read, reserved as r read, experiments as e read, next_reserve as nr read");
}
TBDebugTimeStamp("nalloc locked tables"); TBDebugTimeStamp("nalloc locked tables");
# Make a list of nodes to reserve. # Make a list of nodes to reserve.
......
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