Commit 9e7294d9 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add set/get allocstate.

parent f7c59397
......@@ -410,6 +410,47 @@ sub AllocCheck($$)
return $self->NodeAllocCheck($pid);
}
#
# Set alloc state for a node.
#
sub SetAllocState($$)
{
my ($self, $state) = @_;
return -1
if (! (ref($self)));
my $now = time();
my $node_id = $self->node_id();
DBQueryWarn("update nodes set allocstate='$state', " .
" allocstate_timestamp=$now where node_id='$node_id'")
or return -1;
return Refresh($self);
}
#
# Get alloc state for a node.
#
sub GetAllocState($$)
{
my ($self, $pref) = @_;
return -1
if (! (ref($self) && ref($pref)));
my $allocstate = $self->allocstate();
if (defined($allocstate)) {
$$pref = $allocstate;
}
else {
$$pref = TBDB_ALLOCSTATE_UNKNOWN;
}
return 0;
}
#
# Equality test for two experiments.
# Not strictly necessary in perl, but good form.
......
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