- fabrics, VLANs, subnets, IP ranges (dynamic/reserved/static), IPAM with adoption of addresses machines already have; rollcall fabric|vlan|subnet|range|ip - interface layouts (physical/bond/vlan, NICs by selector: boot, name, mac, fastest:N, ib:N) per machine or per tag; deployment allocates addresses and writes cloud-init network-config plus udev name rules (RHEL cloud images boot with net.ifnames=0); release frees them; rollcall layout, rollcall net show|set - region/rack: rollcall rack long-polls its desired state (per-MAC PXE files kept in the database, dnsmasq configuration and host files) and a BMC command queue, caches boot and OS images (kernels/initrds prefetched for TFTP), proxies the node API and tags requests with its name; the region runs an embedded rack controller; install-rack.sh, rollcall-rack.service - dnsmasq configuration generated per rack from the VLANs it serves (split pool for two racks); reload script restarts only on change and restores the last working config if dnsmasq does not come back (drilled in the lab) - web: Network page, per-machine network tab, layout action, tag layout; console: Network page, network section in the machine view, layout action - tests for candidates, plans (default, bond+VLAN, pinned, DHCP fallback), network-config, udev rules and dnsmasq rendering - lab: pve-vbmc address script finds the interface per BMC address Verified in the lab: embedded rack (10.213.77.0/24) and a remote rack controller on a second SDN segment (10.213.78.0/24): enlistment, commissioning, BMC through the rack's queue, image cache, deployment and phone-home through the rack; Debian 13, Ubuntu 24.04 and Rocky 9 with a static boot NIC and with an active-backup bond carrying VLAN 200. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
54 lines
2.2 KiB
Bash
54 lines
2.2 KiB
Bash
#!/bin/sh
|
|
# Called by rollcall-dnsmasq.path when rollcall rewrites dnsmasq's files.
|
|
#
|
|
# Host files (leases, names) only need a HUP. When the generated configuration
|
|
# changed, dnsmasq is restarted. If it does not come back (a conflicting
|
|
# hand-written file in /etc/dnsmasq.d, for instance - `dnsmasq --test` misses
|
|
# some of those), the last configuration that worked is put back and dnsmasq
|
|
# is started with it, so DHCP stays up. The rejected content is kept next to it
|
|
# and not tried again until it changes.
|
|
set -u
|
|
D=/var/lib/rollcall/dnsmasq
|
|
CONF=$D/conf.d/rollcall.conf
|
|
GOOD=$D/rollcall.conf.accepted
|
|
BAD=$D/rollcall.conf.rejected
|
|
STAMP=/run/rollcall-dnsmasq.sum
|
|
|
|
sum() { cat "$1" 2>/dev/null | sha256sum | cut -d' ' -f1; }
|
|
restore() { # put the last working configuration back (or none)
|
|
if [ -s "$GOOD" ]; then cp "$GOOD" "$CONF.tmp" && mv -f "$CONF.tmp" "$CONF"; else rm -f "$CONF"; fi
|
|
sum "$CONF" > "$STAMP"
|
|
}
|
|
|
|
new=$(sum "$CONF")
|
|
if [ "$new" = "$(cat "$STAMP" 2>/dev/null)" ]; then
|
|
systemctl kill -s HUP dnsmasq.service
|
|
exit 0
|
|
fi
|
|
if [ -e "$CONF" ] && [ "$new" = "$(sum "$BAD")" ]; then
|
|
restore
|
|
echo "generated dnsmasq configuration was rejected before and has not changed; keeping the last working one" >&2
|
|
exit 1
|
|
fi
|
|
if out=$(dnsmasq --test 2>&1) && systemctl restart dnsmasq.service; then
|
|
echo "$new" > "$STAMP"
|
|
if [ -e "$CONF" ]; then cp "$CONF" "$GOOD"; else rm -f "$GOOD"; fi
|
|
rm -f "$BAD"
|
|
echo "dnsmasq restarted: generated configuration changed"
|
|
exit 0
|
|
fi
|
|
why=$(journalctl -u dnsmasq.service -n 5 --no-pager -o cat 2>/dev/null | grep -v '^$' | tail -3 | tr '\n' ' ')
|
|
[ -e "$CONF" ] && cp "$CONF" "$BAD"
|
|
restore
|
|
if systemctl restart dnsmasq.service; then
|
|
echo "generated dnsmasq configuration rejected ($out $why); dnsmasq runs with the last working one, the rejected file is $BAD" >&2
|
|
exit 1
|
|
fi
|
|
# not even that starts: something outside rollcall's file conflicts. Run dnsmasq
|
|
# without rollcall's file so whatever else is configured keeps working.
|
|
rm -f "$CONF"
|
|
sum "$CONF" > "$STAMP"
|
|
systemctl restart dnsmasq.service || true
|
|
echo "dnsmasq does not start with rollcall's configuration ($why); started without it - check /etc/dnsmasq.conf and /etc/dnsmasq.d for conflicting options" >&2
|
|
exit 1
|