Commit e62a4b25 authored by Leigh Stoller's avatar Leigh Stoller

Add missing predicate routines on node types.

Add a lookup function to find type by name.
parent 85296f10
......@@ -99,6 +99,38 @@ sub LookupSync($$)
return Lookup($class, $type);
}
#
# Find me a type, or a class, or by auxtype. Just find me something!
#
sub LookupAny($$)
{
my ($class, $type) = @_;
my $obj = NodeType->Lookup($type);
return $obj
if (defined($obj));
my $query_result =
DBQueryWarn("select type from node_types where class='$type' limit 1");
return undef
if (!$query_result);
if ($query_result->numrows) {
my ($ntype) = $query_result->fetchrow_array();
return NodeType->Lookup($ntype);
}
$query_result =
DBQueryWarn("select type from node_types_auxtypes ".
"where auxtype='$type' limit 1");
return undef
if (!$query_result);
if ($query_result->numrows) {
my ($ntype) = $query_result->fetchrow_array();
return NodeType->Lookup($ntype);
}
return undef;
}
#
# Return a list of all types.
#
......@@ -264,6 +296,7 @@ sub control_iface($;$) {return GetAttribute($_[0], "control_interface",$_[1]);}
sub adminmfs_osid($;$) {return GetAttribute($_[0], "adminmfs_osid",$_[1]);}
sub rebootable($;$) {return GetAttribute($_[0], "rebootable",$_[1]);}
sub power_delay($;$) {return GetAttribute($_[0], "power_delay",$_[1]);}
sub shared($;$) {return GetAttribute($_[0], "shared",$_[1]);}
sub initial_experiment($;$) {
return GetAttribute($_[0], "initial_experiment",$_[1]);
......@@ -280,6 +313,9 @@ sub delay_capacity($;$) {
sub trivlink_maxspeed($;$) {
return GetAttribute($_[0], "trivlink_maxspeed", $_[1]);
}
sub isdedicatedremote($;$) {
return GetAttribute($_[0], "dedicated_widearea", $_[1]);
}
sub control_interface($;$) { return control_iface($_[0], $_[1]); }
# _Always_ make sure that this 1 is at the end of the file...
......
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