Commit dce80595 authored by Mike Hibler's avatar Mike Hibler

Ressurect the nodes table pxe_boot_path column to allow specifying

an alternate "filename" for the dhcpd.conf file.  "Inner plabs" are likely
to need this (to boot pxelinux for emulating the plab boot CD).

dhcpd_makeconf picks up the DB field and sets the filename field accordingly.

nfree will invoke dhcpd_makeconf if any node being freed has a non-NULL
pxe_boot_path value, in order to reset it.
parent 298de168
#!/usr/bin/perl -wT
#
# 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.
#
use English;
......@@ -172,7 +172,8 @@ while (<IF>) {
my $spaces = $1;
my $nodetype = $2;
my $query_result =
DBQueryWarn("select n.node_id,i.IP,i.MAC,r.pid,r.eid, ".
DBQueryWarn("select n.node_id,n.pxe_boot_path, ".
" i.IP,i.MAC,r.pid,r.eid, ".
" r.vname,r.inner_elab_role, ".
" r.inner_elab_boot ".
"from nodes as n ".
......@@ -212,6 +213,7 @@ while (<IF>) {
my $next_server = "";
my $hostname = "";
my $dns = "";
my $filename = "";
if ($vnames && defined($row{"vname"})) {
$node_id = $row{"vname"};
......@@ -235,10 +237,20 @@ while (<IF>) {
"${spaces}\toption host-name \"$node_id\";\n";
}
# Handle alternate boot program filename if it exists
if (defined($row{"pxe_boot_path"})) {
my $fn = $row{"pxe_boot_path"};
# make sure it is pretty constrained
if ($fn =~ /^\/tftpboot\// && $fn !~ /\.\./) {
$filename = "${spaces}\tfilename \"$fn\";\n";
}
}
# Need to make MAC look right..
$mac =~ s/(..)\B/$1:/g;
print $OUT "${spaces}host $ip {\n";
print $OUT $filename;
print $OUT $next_server;
print $OUT $dns;
print $OUT "${spaces}\thardware ethernet $mac;\n";
......
......@@ -2,7 +2,7 @@
#
# 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.
#
use English;
......@@ -38,6 +38,7 @@ use Node;
my $consetup = "$TB/libexec/console_setup";
my $osselect = "$TB/bin/os_select";
my $nodereboot = "$TB/bin/node_reboot";
my $makeconf = "$TB/sbin/dhcpd_makeconf";
my $reloadpid = "emulab-ops";
my $pendingeid = "reloadpending";
my $reloadeid = "reloading";
......@@ -214,6 +215,30 @@ if( $moveToOldReserved ) {
exit($error);
}
######################################################################
# Step 1b
#
# Ugh. If we are resetting the PXE boot program for any of the nodes
# we need to clear them and regenerate the dhcpd.conf file now, before
# we start freeing up nodes in Step 2. If we delayed HUP'ing til after
# Step 2, then nodes might have already been rebooted by the reload
# daemon.
#
######################################################################
if (@freed_nodes > 0) {
my $nodelist = "(" . join(",", map("'$_'", @freed_nodes)) . ")";
my $result =
DBQueryFatal("select node_id from nodes where ".
"pxe_boot_path is not NULL and node_id in $nodelist");
if ($result->num_rows()) {
DBQueryFatal("update nodes set pxe_boot_path=NULL where ".
"node_id in $nodelist");
system("$makeconf -i -r") == 0 ||
print STDERR "WARNING: $makeconf failed!\n";
}
}
######################################################################
# Step 2
#
......
......@@ -34,9 +34,9 @@ B. If the node is of a new type
Example:
insert into node_types
(class,type,proc,speed,RAM,HD,max_interfaces,osid,control_net,imageid,imageable,delay_capacity,virtnode_capacity,control_iface,disktype,delay_osid,jail_osid,pxe_boot_path)
(class,type,proc,speed,RAM,HD,max_interfaces,osid,control_net,imageid,imageable,delay_capacity,virtnode_capacity,control_iface,disktype,delay_osid,jail_osid)
values
("pc","pc2000","P4",2000,512,20.0,5,"RHL-STD",0,"emulab-ops-FBSD47+RHL73-STD",1,2,10,"eth0","ad","FBSD-STD","FBSD-STD","boss.emulab.net:/tftpboot/pxeboot");
("pc","pc2000","P4",2000,512,20.0,5,"RHL-STD",0,"emulab-ops-FBSD47+RHL73-STD",1,2,10,"eth0","ad","FBSD-STD","FBSD-STD");
2. There are several scripts that limit searches to certain classes.
If the new type you have added does not have class "pc", you may need
......@@ -82,15 +82,9 @@ C. What to do on boss:
4. Add entries to the nodes table for each node. Try:
insert into nodes (node_id,type,phys_nodeid,role,def_boot_osid,priority,op_mode)
values
("pcN","pc1u","pcN","testnode","FBSD45-STD",N,'NORMAL')
("pcN","pc1u","pcN","testnode","FBSD45-STD",P,'NORMAL')
If the node is a pxebooting node, then you need to set the
pxe_boot_path in the nodes table. Try:
update nodes set pxe_boot_path='boss.emulab.net:/tftpboot/pxeboot'
where node_id='pcN';
N (priority) is the where it gets printed out. These need to be
P (priority) is the where it gets printed out. These need to be
ascending numbers, and in the right region. See the table.
4a. Add entries into the tiplines table. The "server" field is where
......
......@@ -1563,7 +1563,6 @@ CREATE TABLE node_types (
jail_osid varchar(35) default NULL,
modelnetcore_osid varchar(35) default NULL,
modelnetedge_osid varchar(35) default NULL,
pxe_boot_path text,
isvirtnode tinyint(4) NOT NULL default '0',
ismodelnet tinyint(1) NOT NULL default '0',
isjailed tinyint(1) NOT NULL default '0',
......@@ -1645,7 +1644,6 @@ CREATE TABLE nodes (
status_timestamp datetime default NULL,
failureaction enum('fatal','nonfatal','ignore') NOT NULL default 'fatal',
routertype enum('none','ospf','static','manual','static-ddijk','static-old') NOT NULL default 'none',
next_pxe_boot_path text,
eventstate varchar(20) default NULL,
state_timestamp int(10) unsigned default NULL,
op_mode varchar(20) default NULL,
......
......@@ -3256,3 +3256,12 @@ last_net_act,last_cpu_act,last_ext_act);
PRIMARY KEY (pid,eid,vname)
) TYPE=MyISAM;
4.43: Un-deprecate the node pxe_boot_path field (did you even know it was
gone?) It is now used to specify alternate PXE boot programs (which
show up as the "filename" command in dhcpd.conf). While we are at
it, get rid of the still deprecated fields: pxe_boot_path field in
node_types and next_pxe_boot_path in nodes;
update nodes set pxe_boot_path=NULL where pxe_boot_path is not NULL;
alter table node_types drop column pxe_boot_path;
alter table nodes drop column next_pxe_boot_path;
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