Commit dfe84b99 authored by Leigh B Stoller's avatar Leigh B Stoller

A few utility functions.

parent ce3d8572
......@@ -1259,5 +1259,21 @@ sub ClearLogFile($)
return $self->Refresh();
}
#
# Mark an image as running on a type. I am assuming EZ images these days.
#
sub SetRunsOnNodeType($$)
{
my ($self, $type) = @_;
my $imageid = $self->imageid();
DBQueryWarn("replace into osidtoimageid (osid, type, imageid) ".
"values ('$imageid', '$type', '$imageid')")
or return -1;
return 0;
}
# _Always_ make sure that this 1 is at the end of the file...
1;
#!/usr/bin/perl -wT
#
# Copyright (c) 2007-2012 University of Utah and the Flux Group.
# Copyright (c) 2007-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -625,6 +625,26 @@ sub FeatureSupported($$)
return grep {$_ eq $feature} split(',', $osfeatures);
}
#
# Add a feature.
#
sub AddFeature($$)
{
my ($self, $feature) = @_;
return 0
if ($self->FeatureSupported($feature));
my $osfeatures = $self->osfeatures();
if (!defined($osfeatures) || $osfeatures eq "") {
$osfeatures = $feature;
}
else {
$osfeatures .= ",$feature";
}
return $self->Update({"osfeatures" => $osfeatures});
}
#
# Return 1 if OS is a sub OS (i.e., has a def_parentosid).
#
......
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