Commit ed105035 authored by Ryan Jackson's avatar Ryan Jackson

Add node attribute for specifying bootinfo server

Add the bootinfo_server attribute for specifying the bootinfo server the
node should use during the boot process.  If not specified the node will
default to trying the tftp server and dhcp server, in that order.

PXE vendor option 128 is used to communicate this to the NBP. Options
128-254 are available for NBP-specific use according to the PXE spec, so
we're safe using it.
parent 3a530921
......@@ -190,6 +190,7 @@ while (<IF>) {
my $mac = $row{"MAC"};
my $node_id;
my $next_server = "";
my $bootinfo_server = "";
my $hostname = "";
my $dns = "";
my $booting = "";
......@@ -243,10 +244,13 @@ while (<IF>) {
"${spaces}\toption host-name \"$node_id\";\n";
my $query_result =
DBQueryWarn( "(select attrvalue from node_attributes where node_id = '$node_id' " .
" and attrkey = 'tftp_server' ) union " .
"(select attrvalue from node_type_attributes where type = '$nodetype' " .
" and attrkey = 'tftp_server') limit 1" );
DBQueryWarn( "(select attrvalue from " .
"node_attributes where node_id = '$node_id' " .
" and attrkey = 'tftp_server' ) union " .
"(select attrvalue from " .
"node_type_attributes where type = " .
"'$nodetype' " .
" and attrkey = 'tftp_server') limit 1" );
if (! $query_result) {
fatal("Could not get tftp_server data from DB!");
......@@ -257,6 +261,25 @@ while (<IF>) {
$next_server = "${spaces}\tnext-server " .
$tftp_server . ";\n";
}
$query_result =
DBQueryWarn( "(select attrvalue from " .
"node_attributes where node_id = '$node_id' " .
" and attrkey = 'bootinfo_server' ) union " .
"(select attrvalue from " .
"node_type_attributes where type = " .
"'$nodetype' " .
" and attrkey = 'bootinfo_server') limit 1" );
if (! $query_result) {
fatal("Could not get bootinfo_server data from DB!");
}
if (my %row = $query_result->fetchhash()) {
$bootinfo_server = "${spaces}\toption " .
"PXE.emulab-bootinfo " .
$row{'attrvalue'} . ";\n";
}
}
#
......@@ -299,6 +322,7 @@ while (<IF>) {
print $OUT "${spaces}host $ip {\n";
print $OUT $filename;
print $OUT $next_server;
print $OUT $bootinfo_server;
print $OUT $dns;
print $OUT $booting;
print $OUT "${spaces}\thardware ethernet $mac;\n";
......
......@@ -27,6 +27,7 @@ ddns-update-style none; # req'd vers 3 directive
# to start a new MTFTP transfer
# Code 5: Number of secondes a client must listen before trying to restart
# a MTFTP transfer
# Code 128: IP address of Emulab bootinfo server
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
......@@ -35,6 +36,7 @@ option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
option PXE.emulab-bootinfo code 128 = ip-address;
#
# For PXE booting nodes we set the magic bits to tell the client that we are
......
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