Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
e62a4b25
Commit
e62a4b25
authored
Apr 17, 2009
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing predicate routines on node types.
Add a lookup function to find type by name.
parent
85296f10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
db/NodeType.pm.in
db/NodeType.pm.in
+36
-0
No files found.
db/NodeType.pm.in
View file @
e62a4b25
...
...
@@ -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
...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment