mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-12-03 23:57:06 +00:00
fix(xcat-core): two makedhcp cases measure the wrong unit and the wrong file on Ubuntu
makedhcp_n and makedhcp_a_ubuntu fail on every Ubuntu cell. Neither failure is a defect in makedhcp. makedhcp_n asks "systemctl is-active kea-dhcp4". The Debian and Ubuntu packages name the unit kea-dhcp4-server, so the probe answers inactive, the elif reports isc-dhcp-server, and the case prints a failed unit that xCAT does not use. Measured on an Ubuntu management node: kea-dhcp4 inactive, kea-dhcp4-server active, and only kea-dhcp4-server.service present. Probe both names. The case's earlier check, that a dhcpd or kea-dhcp4 process exists, already passed, so the daemon was never in doubt. makedhcp_a_ubuntu looks for the node's new MAC address in the Kea lease file. makedhcp -a writes a host reservation into kea-dhcp4.conf; a lease file holds only addresses the server has granted, so the MAC can never appear there. On the same management node the compute node's MAC is absent from kea-leases4.csv and present in kea-dhcp4.conf. Read the configuration instead, keeping both checks. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> (cherry picked from commit 81b6ffe09dd719493d009696db92dc58c9c814c4)
This commit is contained in:
@@ -10,7 +10,9 @@ check:rc==0
|
||||
cmd:sleep 20
|
||||
cmd:ps -e | grep -E "dhcpd|kea-dhcp4" | grep -v grep
|
||||
check:rc==0
|
||||
cmd:if systemctl is-active kea-dhcp4 >/dev/null 2>&1; then systemctl status kea-dhcp4; elif cat /etc/*release | grep Ubuntu >/dev/null; then service isc-dhcp-server status; else service dhcpd status; fi
|
||||
#The Kea DHCPv4 unit is kea-dhcp4 on EL and kea-dhcp4-server on Debian and Ubuntu. Probe both
|
||||
#names: a probe of kea-dhcp4 alone falls through to isc-dhcp-server, which xCAT does not use.
|
||||
cmd:for u in kea-dhcp4 kea-dhcp4-server; do if systemctl is-active $u >/dev/null 2>&1; then systemctl status $u; exit 0; fi; done; if cat /etc/*release | grep Ubuntu >/dev/null; then service isc-dhcp-server status; else service dhcpd status; fi
|
||||
check:output=~running
|
||||
cmd:if [ -f "/etc/dhcp/dhcpd.conf.bak" ]; then mv -f /etc/dhcp/dhcpd.conf.bak /etc/dhcp/dhcpd.conf; elif [ -f "/etc/dhcpd.conf.bak" ]; then mv -f /etc/dhcpd.conf.bak /etc/dhcpd.conf; fi; if [ -f "/etc/kea/kea-dhcp4.conf.bak" ]; then mv -f /etc/kea/kea-dhcp4.conf.bak /etc/kea/kea-dhcp4.conf; fi
|
||||
end
|
||||
@@ -149,7 +151,9 @@ cmd:lsdef -l $$CN -z > /tmp/$$CN.stanza
|
||||
cmd:chdef -t node -o $$CN mac=11:22:33:44:55:66
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if [ -f /var/lib/kea/kea-leases4.csv ]; then cat /var/lib/kea/kea-leases4.csv; elif [ -f /var/lib/dhcp/dhcpd.leases ]; then cat /var/lib/dhcp/dhcpd.leases; fi
|
||||
#makedhcp -a writes a host reservation into the DHCP server configuration. A lease file holds
|
||||
#only the addresses the server has granted, so a reservation never appears in one.
|
||||
cmd:if [ -f /etc/kea/kea-dhcp4.conf ]; then cat /etc/kea/kea-dhcp4.conf; elif [ -f /etc/dhcp/dhcpd.conf ]; then cat /etc/dhcp/dhcpd.conf; fi
|
||||
check:output=~$$CN
|
||||
check:output=~11:22:33:44:55:66
|
||||
cmd:chdef -t node -o $$CN mac=
|
||||
|
||||
Reference in New Issue
Block a user