Commit d480e1f5 authored by Mike Hibler's avatar Mike Hibler

Differentiate PXE and U-boot boots for sending events.

parent 4c76e8f0
......@@ -63,18 +63,24 @@ on commit {
if (substring (option vendor-class-identifier, 0, 9) = "PXEClient") {
set boot = "PXE";
} elsif (substring (option vendor-class-identifier, 0, 6) = "U-boot") {
set boot = "PXE";
set boot = "UBOOT";
} else {
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);
#execute("@prefix@/sbin/reportboot", "-bD", clip, clhw, boot);
## If you want to send both events on the PXE or U-boot contact, use this
#if (boot != "OS") {
# execute("@prefix@/sbin/reportboot", "-bDC", clip, clhw, boot);
#}
# If you want to send both events on the PXE contact, use this
if (boot = "PXE") {
execute("@prefix@/sbin/reportboot", "-bCD", clip, clhw, boot);
# If you want to send both events on just U-boot contact, use this
if (boot = "UBOOT") {
execute("@prefix@/sbin/reportboot", "-bDU", clip, clhw, boot);
}
}
@DHCPD_CONTROLNET_DECL@
......
#!/usr/bin/perl -w
#
# Copyright (c) 2014 University of Utah and the Flux Group.
# Copyright (c) 2014-2016 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -38,15 +38,20 @@ sub usage()
print("Options:\n");
print(" -b - Run in the background\n");
print(" -d - Turn on debugging\n");
print(" -C - Combine PXEBOOTING/BOOTING on the PXE event\n");
print(" -C - Combine PXEBOOTING/BOOTING on PXE or U-boot boots;\n");
print(" Send nothing on an OS boot.");
print(" -D - Record event times in a DB to moderate send rate\n");
print(" -U - Combine PXEBOOTING/BOOTING on U-boot boots only;\n");
print(" Send nothing on an PXE or OS boot.");
print("boot-type is one of OS, PXE, UBOOT.\n");
exit(1);
}
my $optlist = "bdCD";
my $optlist = "bdCDU";
my $background = 0;
my $debug = 0;
my $combined = 0;
my $ubootonly = 0;
my $usedb = 0;
#
......@@ -105,6 +110,11 @@ if (! getopts($optlist, \%options)) {
}
if (defined($options{"C"})) {
$combined = 1;
$ubootonly = 0;
}
if (defined($options{"U"})) {
$combined = 1;
$ubootonly = 1;
}
if (defined($options{"D"})) {
$usedb = 1;
......@@ -134,10 +144,10 @@ if ($MAC =~ /^([0-9a-f]+):([0-9a-f]+):([0-9a-f]+):([0-9a-f]+):([0-9a-f]+):([0-9a
print STDERR "'$ARGV[1]' is not a MAC address\n";
usage();
}
if ($ARGV[2] =~ /^(PXE|OS)$/) {
if ($ARGV[2] =~ /^(PXE|OS|UBOOT)$/) {
$boottype = $1;
} else {
print STDERR "'$ARGV[2]' must be one of PXE or OS\n";
print STDERR "Invalid boot-type '$ARGV[2]'\n";
usage();
}
......@@ -203,23 +213,23 @@ if ($usedb) {
# Note that this is essentially the same as what bootinfo does.
#
if ($combined) {
if ($boottype eq "PXE") {
if ($boottype eq "UBOOT" || ($boottype eq "PXE" && !$ubootonly)) {
if (sendevent($nodeid, "PXEBOOTING") ||
sendevent($nodeid, "BOOTING")) {
logit("$nodeid: could not send PXEBOOTING/BOOTING events");
exit(1);
}
logit("$nodeid: sent PXEBOOTING and BOOTING events");
logit("$nodeid: $boottype: sent PXEBOOTING and BOOTING events");
} else {
logit("$nodeid: NOT sending BOOTING event (combo mode)");
logit("$nodeid: $boottype: NOT sending BOOTING event (combo mode)");
}
} else {
my $event = ($boottype eq "OS") ? "BOOTING" : "PXEBOOTING";
if (sendevent($nodeid, $event)) {
logit("$nodeid: could not send $event event");
logit("$nodeid: $boottype: could not send $event event");
exit(1);
}
logit("$nodeid: sent $event event");
logit("$nodeid: $boottype: sent $event event");
}
exit(0);
......
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