Commit 4c093ea9 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Clear out various parts from the nodes table when a node is freed, and

reset its image_id back to the DB default for that node type.
parent 6f05512f
......@@ -51,7 +51,7 @@ if ($sth->numrows < 1) {
die("There is no experiment '$eid' in project '$pid'.\n");
}
$cmd = "lock tables nodes read, node_types read, reloads read, ".
$cmd = "lock tables nodes write, node_types read, reloads read, ".
"interfaces write, delays write, reserved write, last_reservation write";
$sth = $dbh->query($cmd)
|| die("Locking error:\n$cmd\nError string is:".$dbh->errstr."\n");
......@@ -147,7 +147,24 @@ foreach my $n (@node_names) {
"delete from delays where node_id='$n'";
$sth = $dbh->query($cmd)
|| (print "Failed Command:\n$cmd\nError string is:".$dbh->errstr."\n"
&& $error++);
&& $error++);
# Find out what the default OS should be.
$cmd = "select image_id from node_types left join nodes on ".
"node_types.type=nodes.type where nodes.node_id='$n'";
$sth = $dbh->query($cmd)
|| (print "Failed Command:\n$cmd\nError string is:".$dbh->errstr."\n"
&& $error++);
my @row= $sth->fetchrow_array();
my $defimageid = $row[0];
# And clean out various tidbits from the nodes table.
$cmd = "update nodes set def_boot_cmd_line='',def_boot_path='',".
"startupcmd='',rpms='',def_boot_image_id='$defimageid' ".
"where node_id='$n'";
$sth = $dbh->query($cmd)
|| (print "Failed Command:\n$cmd\nError string is:".$dbh->errstr."\n"
&& $error++);
}
$cmd = "unlock tables";
......
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