Commit 25880e2e authored by Robert Ricci's avatar Robert Ricci

At long last, support for assign's 'features'! Added a new table into

which features and their weights can be placed, per node type.
ptopgen now includes these features in the ptop files it generates.
parent 71253f39
......@@ -2,7 +2,7 @@
--
-- Host: localhost Database: tbdb
---------------------------------------------------------
-- Server version 3.23.54-log
-- Server version 3.23.52-log
--
-- Table structure for table 'cdroms'
......@@ -673,6 +673,17 @@ CREATE TABLE node_status (
PRIMARY KEY (node_id)
) TYPE=MyISAM;
--
-- Table structure for table 'node_type_features'
--
CREATE TABLE node_type_features (
type varchar(30) NOT NULL default '',
feature varchar(30) NOT NULL default '',
weight float NOT NULL default '0',
PRIMARY KEY (type,feature)
) TYPE=MyISAM;
--
-- Table structure for table 'node_types'
--
......
......@@ -757,3 +757,9 @@ last_net_act,last_cpu_act,last_ext_act);
drop table vis_experiments;
1.161: Add a node_type_features table that lists the assign 'features' for each
node type:
create table node_type_features (type varchar(30) not null,
feature varchar(30) not null, weight float not null default 0.0,
primary key (type,feature));
......@@ -183,6 +183,9 @@ foreach $node (keys(%nodes)) {
#################################################################
$text .= " sim:100000";
}
$features = get_features($node,$nodes{$node});
if ($virtstuff && $virtnode_capacity > 0) {
#
# Ditto for jailed nodes
......@@ -194,8 +197,16 @@ foreach $node (keys(%nodes)) {
$text .= " pcvm:$virtnode_capacity";
}
$text .= " *lan:*";
# Add features
if ($features) {
$text .= " - $features";
} else {
$text .= " -";
}
# Add trivial bw spec.
$text .= " - - trivial_bw:400000";
$text .= " - trivial_bw:400000";
} else {
$text .= " - $features";
}
print "$text\n";
}
......@@ -376,3 +387,21 @@ sub get_ifacecardport {
return ();
}
}
sub get_features {
my ($node, $type) = (@_);
#
# We don't actually have a per-node feature table yet, so the node is
# ignored.
#
my @features;
my $result = DBQueryFatal("select feature, weight from " .
"node_type_features where type='$type'");
while (my ($feature, $weight) = $result->fetchrow()) {
push @features, "$feature:$weight";
}
return join(" ",@features);
}
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