Commit 088c8e74 authored by Mike Hibler's avatar Mike Hibler

Initial support for plab-in-elab:

* setup some fields that parallel the
  elab-in-elab ones, for modifying the dhcpd.conf file.

* tb-set-node-plab-role to set a node as either 'plc' or 'node'
  used to set the DB role field above
parent b2bca66e
......@@ -49,7 +49,7 @@ my $CRTLTAG = TBDB_IFACEROLE_CONTROL();
my $DHCPD_CONF = "/usr/local/etc/dhcpd.conf";
my $DHCPD_TEMPLATE = "/usr/local/etc/dhcpd.conf.template";
my $lockfile = "/var/tmp/testbed_dhcpd_lockfile";
my %bossnodes = ();
my %servernodes = ();
my $template = $DHCPD_TEMPLATE;
my $outfile = "/tmp/dhcpd_makeconf.$$";
my $OUT = *STDOUT;
......@@ -174,9 +174,9 @@ while (<IF>) {
my $query_result =
DBQueryWarn("select n.node_id,n.pxe_boot_path, ".
" t.pxe_boot_path as nt_pxe_boot_path, ".
" i.IP,i.MAC,r.pid,r.eid, ".
" r.vname,r.inner_elab_role, ".
" r.inner_elab_boot ".
" i.IP,i.MAC,r.pid,r.eid,r.vname, ".
" r.inner_elab_role,r.inner_elab_boot, ".
" r.plab_role,r.plab_boot ".
"from nodes as n ".
"left join interfaces as i on ".
" n.node_id=i.node_id ".
......@@ -192,17 +192,20 @@ while (<IF>) {
}
#
# First go through and find any boss nodes. We need these
# to create the next-server line for elabinelab.
# First go through and find any server (boss or plc) nodes.
# We need these to create the next-server line for elabinelab
# and plabinelab nodes.
#
while (my %row = $query_result->fetchhash()) {
if (defined($row{"pid"}) &&
defined($row{"inner_elab_role"}) &&
($row{"inner_elab_role"} eq "boss" ||
$row{"inner_elab_role"} eq "boss+router")) {
((defined($row{"inner_elab_role"}) &&
($row{"inner_elab_role"} eq "boss" ||
$row{"inner_elab_role"} eq "boss+router")) ||
(defined($row{"plab_role"}) &&
$row{"plab_role"} eq "plc"))) {
my $tag = $row{"pid"} . ":" . $row{"eid"};
$bossnodes{$tag} = $row{"IP"};
$servernodes{$tag} = $row{"IP"};
}
}
$query_result->dataseek(0);
......@@ -224,14 +227,20 @@ while (<IF>) {
}
if (defined($row{"pid"}) &&
$row{"inner_elab_boot"} == 1 &&
defined($row{"inner_elab_role"}) &&
$row{"inner_elab_role"} eq "node") {
(($row{"inner_elab_boot"} == 1 &&
defined($row{"inner_elab_role"}) &&
$row{"inner_elab_role"} eq "node") ||
($row{"plab_boot"} == 1 &&
defined($row{"plab_role"}) &&
$row{"plab_role"} eq "node"))) {
my $tag = $row{"pid"} . ":" . $row{"eid"};
$next_server = "${spaces}\tnext-server " .
$bossnodes{$tag} . ";\n";
$dns = "${spaces}\toption domain-name-servers 1.1.1.1;\n";
$servernodes{$tag} . ";\n";
if ($row{"inner_elab_boot"} == 1) {
$dns = "${spaces}\toption domain-name-servers ".
"1.1.1.1;\n";
}
}
else {
$hostname =
......
......@@ -2088,6 +2088,8 @@ CREATE TABLE reserved (
cnet_vlan int(11) default NULL,
inner_elab_role enum('boss','boss+router','router','ops','ops+fs','fs','node') default NULL,
inner_elab_boot tinyint(1) default '0',
plab_role enum('plc','node','none') NOT NULL default 'none',
plab_boot tinyint(1) default '0',
mustwipe tinyint(4) NOT NULL default '0',
PRIMARY KEY (node_id),
UNIQUE KEY vname (pid,eid,vname),
......@@ -2730,6 +2732,7 @@ CREATE TABLE virt_nodes (
routertype enum('none','ospf','static','manual','static-ddijk','static-old') NOT NULL default 'none',
fixed text NOT NULL,
inner_elab_role enum('boss','boss+router','router','ops','ops+fs','fs','node') default NULL,
plab_role enum('plc','node','none') NOT NULL default 'none',
numeric_id int(11) default NULL,
KEY pid (pid,eid,vname)
) TYPE=MyISAM;
......
......@@ -737,6 +737,7 @@ REPLACE INTO table_regex VALUES ('firewall_rules','fwname','text','redirect','vi
REPLACE INTO table_regex VALUES ('firewall_rules','ruleno','int','redirect','default:int',0,50000,NULL);
REPLACE INTO table_regex VALUES ('firewall_rules','rule','text','regex','^\\w[-\\w \\t,/\\{\\}\\(\\)!:\\.]*$',0,1024,NULL);
REPLACE INTO table_regex VALUES ('virt_nodes','inner_elab_role','text','regex','^(boss|boss\\+router|router|ops|ops\\+fs|fs|node)$',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_nodes','plab_role','text','regex','^(plc|node|none)$',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','elab_in_elab','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','elabinelab_cvstag','text','regex','^[-\\w\\@\\/\\.]+$',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','imageid','text','regex','^[a-zA-Z0-9][-\\w\\.+]+$',0,45,NULL);
......
......@@ -3342,3 +3342,15 @@ last_net_act,last_cpu_act,last_ext_act);
4.57: Changes to templates.sql. Skip this revision for now.
4.58: Fix to the schema in last revision; Skip to next extry.
4.59: Add reserved table plab_role field to distinguish nodes in an
"inner planetlab".
alter table reserved add plab_role enum('plc','node','none') \
NOT NULL default 'none' after inner_elab_boot;
alter table reserved add plab_boot tinyint(1) \
default '0' after plab_role;
alter table virt_nodes add plab_role enum('plc','node','none') \
NOT NULL default 'none' after inner_elab_role;
......@@ -258,6 +258,7 @@ sub virtnodeisvnode($) { return exists($virt_nodes{$_[0]}); }
sub virtnodetype($) { return $virt_nodes{$_[0]}->{"type"}; }
sub virtnodename($) { return $virt_nodes{$_[0]}->{"vname"}; }
sub virtnodeelabrole($) { return $virt_nodes{$_[0]}->{"inner_elab_role"}; }
sub virtnodeplabrole($) { return $virt_nodes{$_[0]}->{"plab_role"}; }
sub virtnodeosid($) { return $virt_nodes{$_[0]}->{"__osid"}; }
sub virtnodesetosid($$) { return $virt_nodes{$_[0]}->{"__osid"} = $_[1]; }
sub virtnodeparent($) { return $virt_nodes{$_[0]}->{"__parent"}; }
......@@ -2672,6 +2673,7 @@ sub InitPnode($$)
my $role;
my $simhost_violation;
my $inner_elab_role;
my $plab_role;
# XXX NSE hack:
if (virtnodeisvnode($vnode) && virtnodeissim($vnode)) {
......@@ -2790,6 +2792,7 @@ sub InitPnode($$)
$vname = $vnode;
$role = TBDB_RSRVROLE_NODE;
$inner_elab_role = virtnodeelabrole($vnode);
$plab_role = virtnodeplabrole($vnode);
if ((!defined($cmdline) || $cmdline eq "")) {
# If the user hasn't overridden the command line, try to find a
......@@ -2838,6 +2841,8 @@ sub InitPnode($$)
if (defined($simhost_violation));
push(@sets, "inner_elab_role='$inner_elab_role'")
if (defined($inner_elab_role));
push(@sets, "plab_role='$plab_role'")
if (defined($plab_role));
if (@sets) {
my $setstr = join(",", @sets);
......
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -76,6 +76,7 @@ Node instproc init {s} {
$self set tarfiles ""
$self set failureaction "fatal"
$self set inner_elab_role ""
$self set plab_role "none"
$self set fixed ""
$self set nseconfig ""
......@@ -143,6 +144,7 @@ Node instproc updatedb {DB} {
$self instvar tarfiles
$self instvar failureaction
$self instvar inner_elab_role
$self instvar plab_role
$self instvar routertype
$self instvar fixed
$self instvar agentlist
......@@ -263,6 +265,11 @@ Node instproc updatedb {DB} {
lappend values $inner_elab_role
}
if { $plab_role != "none" } {
lappend fields "plab_role"
lappend values $plab_role
}
if { $numeric_id != {} } {
lappend fields "numeric_id"
lappend values $numeric_id
......
......@@ -76,6 +76,7 @@ proc tb-set-node-id {vnode myid} {}
proc tb-set-link-est-bandwidth {srclink args} {}
proc tb-set-lan-est-bandwidth {lan bw} {}
proc tb-set-node-lan-est-bandwidth {node lan bw} {}
proc tb-set-node-plab-role {node role} {}
proc tb-set-security-level {level} {
......
......@@ -1491,6 +1491,21 @@ proc tb-set-node-inner-elab-role {node role} {
$node set inner_elab_role $role
}
#
# Set a plab role for a node.
#
proc tb-set-node-plab-role {node role} {
if {[$node info class] != "Node"} {
perror "\[tb-set-node-plab-role] $node is not a node."
return
}
if {[lsearch -exact {plc node none} $role] == -1} {
perror "\[tb-set-node-plab-role] type must be one of plc|node|none"
return
}
$node set plab_role $role
}
#
# Set security level.
#
......
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