From 089ec3e3954d0c13d13f9d4f6507e3f96503b0b3 Mon Sep 17 00:00:00 2001 From: Leigh B Stoller <stoller@flux.utah.edu> Date: Tue, 11 Jul 2023 10:44:25 -0600 Subject: [PATCH] Add "option configfile" so subboss dhcpd setup. Needed to do this cause the ualloc dells at the Moonshot cluster are failing to dhcp boss, for reasons unknown (Mike and I looked, no idea). But they work fine if they dhcp from subboss, so thats what they do now. --- db/subboss_dhcpd_makeconf.in | 9 ++++++++- dhcpd/dhcpd.conf.subboss.template.in | 3 +++ tmcd/tmcd.c | 21 ++++++++++++++++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/db/subboss_dhcpd_makeconf.in b/db/subboss_dhcpd_makeconf.in index 43fc96d2bb..2fa94bc915 100755 --- a/db/subboss_dhcpd_makeconf.in +++ b/db/subboss_dhcpd_makeconf.in @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# Copyright (c) 2000-2021 University of Utah and the Flux Group. +# Copyright (c) 2000-2023 University of Utah and the Flux Group. # # {{{EMULAB-LICENSE # @@ -238,6 +238,7 @@ sub gendhcpdconf($$) my $bootinfo_server = $$row{"BOOTINFO"}; my $hostname = $$row{"HOSTNAME"}; my $filename = $$row{"FILENAME"}; + my $configfile = $$row{"CONFIGFILE"}; my $singlenet = $$row{"SINGLENET"}; my $inner_elab_boot = $$row{"INNER_ELAB_BOOT"}; my $inner_elab_role = $$row{"INNER_ELAB_ROLE"}; @@ -264,6 +265,11 @@ sub gendhcpdconf($$) $filename = "${spaces}\tfilename \"$filename\";\n"; } + } + elsif (defined $configfile) { + $configfile =~ s/^"(.*)"$/$1/; + $configfile = + "${spaces}\toption configfile \"$configfile\";\n"; } else { ClearPXEBoot($node_id, $mac); } @@ -298,6 +304,7 @@ sub gendhcpdconf($$) print OF "${spaces}host $ip {\n"; print OF $filename if $filename; + print OF $configfile if $configfile; print OF $next_server if $next_server; print OF $bootinfo_server if $bootinfo_server; print OF $dns if $dns; diff --git a/dhcpd/dhcpd.conf.subboss.template.in b/dhcpd/dhcpd.conf.subboss.template.in index 806c8883c3..90d1e2df37 100644 --- a/dhcpd/dhcpd.conf.subboss.template.in +++ b/dhcpd/dhcpd.conf.subboss.template.in @@ -38,6 +38,9 @@ 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; +# XXX for Dell S4048-ON switch bootstrap +option configfile code 209 = text; + # # For PXE booting nodes we set the magic bits to tell the client that we are # PXE-saavy so they don't wait around for 12 seconds or so waiting for a diff --git a/tmcd/tmcd.c b/tmcd/tmcd.c index 34d138afe3..9c243fb61c 100644 --- a/tmcd/tmcd.c +++ b/tmcd/tmcd.c @@ -12315,14 +12315,18 @@ COMMAND_PROTOTYPE(dodhcpdconf) res = mydb_query("select n.node_id,n.pxe_boot_path,i.IP,i.mac,n.type," "r.eid,r.pid,r.inner_elab_role,r.inner_elab_boot," - "r.plab_role,r.plab_boot,n.next_pxe_boot_path " + "r.plab_role,r.plab_boot,n.next_pxe_boot_path, " + "nat.attrvalue " "from nodes as n " "left join subbosses as s on n.node_id=s.node_id " "left join interfaces as i on n.node_id=i.node_id " "left join reserved as r on n.node_id=r.node_id " + "left join node_attributes as nat on " + " nat.node_id=n.node_id and " + " nat.attrkey='dhcpd_configfile' " "where s.subboss_id='%s' and " "s.service='dhcp' and s.disabled=0 and i.role='ctrl' " - "order by n.priority", 12, reqp->nodeid); + "order by n.priority", 13, reqp->nodeid); if (!res) { error("dodhcpconf: %s: DB Error getting dhcpd configuration\n", reqp->nodeid); @@ -12490,7 +12494,18 @@ COMMAND_PROTOTYPE(dodhcpdconf) remain -= rc; } - if (row[11] && row[11][0]) { + if (row[12] && row[12][0]) { + rc = snprintf(b, remain, " CONFIGFILE=\"%s\"", row[12]); + + if (rc < 0) { + error("dodhcpdconf: error creating output\n"); + mysql_free_result(res); + return 1; + } + + b += rc; + remain -= rc; + } else if (row[11] && row[11][0]) { rc = snprintf(b, remain, " FILENAME=\"%s\"", row[11]); if (rc < 0) { -- GitLab