Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
80653ece
Commit
80653ece
authored
May 07, 2013
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GetNodeFeatures() method, returns a hash.
parent
c8294768
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
db/Node.pm.in
db/Node.pm.in
+36
-0
No files found.
db/Node.pm.in
View file @
80653ece
...
...
@@ -166,6 +166,7 @@ sub LookupRow($$)
$
self
->{
"RSRV"
}
=
undef
;
$
self
->{
"TYPEINFO"
}
=
undef
;
$
self
->{
"ATTRS"
}
=
undef
;
$
self
->{
"FEATURES"
}
=
undef
;
$
self
->{
"IFACES"
}
=
undef
;
$
self
->{
"WAROW"
}
=
undef
;
$
self
->{
"HASH"
}
=
{};
...
...
@@ -196,6 +197,7 @@ sub DESTROY {
$
self
->{
"RSRV"
}
=
undef
;
$
self
->{
"TYPEINFO"
}
=
undef
;
$
self
->{
"ATTRS"
}
=
undef
;
$
self
->{
"FEATURES"
}
=
undef
;
$
self
->{
"IFACES"
}
=
undef
;
$
self
->{
"HASH"
}
=
undef
;
$
self
->{
"WAROW"
}
=
undef
;
...
...
@@ -236,6 +238,7 @@ sub MakeFake($$$$)
$
self
->{
"RSRV"
}
=
$
rsrvrow
;
$
self
->{
"TYPEINFO"
}
=
undef
;
$
self
->{
"ATTRS"
}
=
undef
;
$
self
->{
"FEATURES"
}
=
undef
;
$
self
->{
"IFACES"
}
=
undef
;
$
self
->{
"WAROW"
}
=
undef
;
$
self
->{
"HASH"
}
=
{};
...
...
@@ -282,6 +285,7 @@ sub BulkLookup($$$)
$
node
->{
"RSRV"
}
=
undef
;
$
node
->{
"TYPEINFO"
}
=
undef
;
$
node
->{
"ATTRS"
}
=
undef
;
$
self
->{
"FEATURES"
}
=
undef
;
$
node
->{
"IFACES"
}
=
undef
;
$
node
->{
"WAROW"
}
=
undef
;
$
node
->{
"HASH"
}
=
{};
...
...
@@ -592,6 +596,7 @@ sub Refresh($)
$
self
->{
"RSRV"
}
=
undef
;
$
self
->{
"TYPEINFO"
}
=
undef
;
$
self
->{
"ATTRS"
}
=
undef
;
$
self
->{
"FEATURES"
}
=
undef
;
$
self
->{
"IFACES"
}
=
undef
;
$
self
->{
"WAROW"
}
=
undef
;
return
0
;
...
...
@@ -1372,6 +1377,37 @@ sub GetNodeAttributes($)
return $self->{"ATTRS"};
}
#
# Return a hash of the node features for this node.
#
sub GetNodeFeatures($)
{
my ($self) = @_;
return undef
if (!ref($self));
my $node_id = $self->node_id();
if (!defined($self->{"FEATURES"})) {
my $query_result =
DBQueryWarn("select * from node_features ".
"where node_id='
$
node_id
'");
return -1
if (!defined($query_result));
$self->{"FEATURES"} = {};
while (my $row = $query_result->fetchrow_hashref()) {
my $feature = $row->{'
feature
'};
my $weight = $row->{'
weight
'};
$self->{"FEATURES"}->{$feature} = $weight;
}
}
return $self->{"FEATURES"};
}
#
# Return type info. We cache this in the instance since node_type stuff
# does not change much.
...
...
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