Commit c20619e2 authored by Leigh Stoller's avatar Leigh Stoller

Fix to tmcd for when a node reports a reboot. Need to check the

pid/eid before releasing from the reloads/reserve table, since an
admin initiated reload might be pending when a user does his own
load. Don't want to clear the reload state, or even worse, the
reserved state. There is a cross dependency created bewteen tmcd.c
and sched_reload on the pid/eid testbed/reloading. No biggie. I put in
a warning in both places.
parent 23b8bdb1
......@@ -184,6 +184,10 @@ foreach my $node (@nodes) {
if ( ($sth->num_rows()) < 1) {
print STDERR "Available.\nReserving and adding to list.\n";
#
# XXX If you change testbed/reloading, be sure to update the
# test in doreboot() in tmcd/tmcd.c.
#
my $cmd = "$TB/nalloc testbed reloading $pc";
if ( system($cmd) != 0 ) {
print STDERR "WARNING: Could not reserve $pc!\n";
......
......@@ -171,8 +171,9 @@ static int
doreboot(int sock, struct in_addr ipaddr, char *request)
{
MYSQL_RES *res;
MYSQL_ROW row;
char nodeid[32];
char pid[64];
char eid[64];
int n;
if (iptonodeid(ipaddr, nodeid)) {
......@@ -182,6 +183,29 @@ doreboot(int sock, struct in_addr ipaddr, char *request)
syslog(LOG_INFO, "REBOOT: %s is reporting a reboot", nodeid);
/*
* Need to check the pid/eid to distinguish between a user
* initiated reload, and a admin scheduled reload. We don't want
* to deschedule an admin reload, which is supposed to happen when
* the node is released.
*/
if (nodeidtoexp(nodeid, pid, eid)) {
syslog(LOG_INFO, "REBOOT: %s: Node is free", nodeid);
return 0;
}
syslog(LOG_INFO, "REBOOT: %s: Node is in experiment %s/%s",
nodeid, pid, eid);
/*
* XXX This must match the reservation made in sched_reload
* in the tbsetup directory.
*/
if (strcmp(pid, "testbed") ||
strcmp(eid, "reloading")) {
return 0;
}
/*
* See if the node was in the reload state. If so we need to clear it
* and its reserved status.
......
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