Commit 25f775fe authored by Mike Hibler's avatar Mike Hibler

Report both PXEBOOTING/BOOTING events on PXE-originated DHCP request.

A concession to performance. Previously, PXEBOOTING was reported on
the PXE DHCP request and BOOTING on the following OS-originated request.
This is conceptually ideal, as that is what those states were intended
to mean, but it causes two synchronous "reportboot" command executions
from dhcpd for every node boot. Worse, the time gap between the second,
OS-originated DHCP call and the first explicit state reported by the
node itself (e.g., TBSETUP or RELOADSETUP) is generally small enough
that the node reported state often arrived at stated before the BOOTING
state from dhcpd. This can cause excess node reboots or other undesirable
behaviors from stated.

So now we only invoke "reportboot" on the first PXE-originated call and
tell reportboot to send both PXEBOOTING and BOOTING events at that time.
This does not eliminate the race condition above, but makes it unlikely
as there is the whole kernel boot process (10s of seconds) between the
dhcpd state reports and the first node state report.
parent 31b04b4d
......@@ -61,14 +61,20 @@ on commit {
set clip = binary-to-ascii(10, 8, ".", leased-address);
set clhw = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
if (substring (option vendor-class-identifier, 0, 9) = "PXEClient") {
set boot = "PXE";
set boot = "PXE";
} elsif (substring (option vendor-class-identifier, 0, 6) = "U-boot") {
set boot = "PXE";
set boot = "PXE";
} else {
set boot = "OS";
set boot = "OS";
## If you want to send an event on both PXE and OS contacts, use this
#execute("@prefix@/sbin/reportboot", clip, clhw, boot);
# If you want to send both events on the PXE contact, use this
if (boot = "PXE") {
execute("@prefix@/sbin/reportboot", "-C", clip, clhw, boot);
set ispxe = option vendor-class-identifier;
execute("@prefix@/sbin/reportboot", clip, clhw, boot);
......@@ -94,6 +94,9 @@ my %options = ();
if (! getopts($optlist, \%options)) {
if (defined($options{"C"})) {
$combined = 1;
if (defined($options{"b"})) {
$background = 1;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment