Commit c70afe5b authored by Kevin Atkinson's avatar Kevin Atkinson

Require "-a" option in nfree to make it difficult to accidently free all

from an experiment such as hwdown.
parent 5b8afc88
......@@ -17,16 +17,17 @@ use Getopt::Std;
#
sub usage ()
{
die("Usage: nfree [-x] [-o] <pid> <eid> [<node> <node> <...>]\n".
"Releases all nodes in the specified experiment.\n".
die("Usage: nfree [-x] [-o] <pid> <eid> (-a | <node> <node> <...>)\n".
"Releases all nodes in the specified experiment if -a is given.\n".
"If nodes are listed, nfree releases only those nodes.\n".
" '-x' frees all virtual nodes on any physical node that is freed.\n".
" '-o' Moves nodes into a oldreserved holding experiment.\n"
);
}
my $optlist = "xo";
my $optlist = "xoa";
my $freeDependantVirtuals = 0;
my $moveToOldReserved = 0;
my $freeAllNodes = 0;
# Configure variables
my $TB = "@prefix@";
......@@ -81,12 +82,23 @@ if (defined($options{"x"})) {
if (defined($options{"o"})) {
$moveToOldReserved = 1;
}
if (@ARGV < 2) {
if (defined($options{"a"})) {
$freeAllNodes = 1;
}
if (@ARGV < 2 || @ARGV == 2 && !$freeAllNodes) {
usage();
}
my $pid = shift;
my $eid = shift;
if (@ARGV > 0 && $ARGV[0] eq '-a') {
$freeAllNodes = 1;
shift;
}
if ($freeAllNodes && @ARGV > 0) {
usage();
}
# Make sure that the experiment actually exists
my $experiment = Experiment->Lookup($pid, $eid);
if (!defined($experiment)) {
......
......@@ -606,7 +606,7 @@ sub doSwapout($) {
#
print STDERR "Freeing nodes.\n";
TBDebugTimeStamp("nfree started");
if (system("nfree $pid $eid")) {
if (system("nfree -a $pid $eid")) {
tberror({type => 'secondary', severity => SEV_SECONDARY,
error => ['nfree_failed']},
"Could not free nodes.");
......
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