A node with an IPv6 reservation took a pool address with no bootfile-url and
stopped at PXE-E21. RFC 6355 carries the sixteen octets of the system UUID as
the firmware holds them, and SMBIOS 2.6 and later store time_low, time_mid and
time_hi_and_version little-endian, while vpd.uuid holds the canonical spelling
Linux reports in product_uuid. kea_duid_from_uuid copied that spelling verbatim,
so the DUID disagreed with the client in its first eight octets and Kea never
matched the reservation.
Measured on xcat76-cn, 2026-10-23, with vpd.uuid
c78c76bf-3286-46f3-b80d-8fe079dd6de7:
xCAT wrote 00:04:c7:8c:76:bf:32:86:46:f3:b8:0d:8f:e0:79:dd:6d:e7
the firmware sent 00:04:bf:76:8c:c7:86:32:f3:46:b8:0d:8f:e0:79:dd:6d:e7
The first three fields are now reversed. The ISC path had its own copy of the
same transformation and the same defect; it calls the sub instead, so the two
backends cannot disagree about what a client's DUID looks like. A uuid that is
not sixteen octets now has no DUID and the node is skipped with a warning,
rather than a malformed string reaching omshell.
Two assertions in dhcp_kea_plugin_intent.t held the canonical spelling and so
agreed with a DUID no firmware presents; they now hold the reversed form. Five
assertions fail without the reversal.
Also: makedhcp exited 1 on an IPv6-only node whose DHCPv6 reservation and
bootfile-url it had just written correctly. kea_node_client_classes_for_nodes
resolved next_server_for_node before the per-MAC loop that skips an IPv6-only
node, so the node still reached the IPv4 resolver, and with noderes.xcatmaster
naming a host that has only an AAAA record inet_aton fails and the sub reports
an unresolvable tftpserver with errorcode 1. 6f171a22b made the same call lazy
in kea_node_reservations and missed this second site. It is resolved on first
use now, and the new assertion is on the CALL rather than the exit code, because
the error is what the exit code is made of.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
addnode and delnode find an existing host entry through the host-entry index,
and that index indexed node names only for an IPv4 first field and keyed the
address on its literal spelling. So makehosts left two entries for one node:
changing node01 from 2001:db8::10 to 2001:db8::20 added the second address and
kept the first, and an expanded IPv6 entry stayed when the compressed spelling
of the same address was added or deleted. The node resolved to a stale address.
_host_entry_matches handled both cases and no code called it. It is removed,
because a second place that compares an address is how this file reached this
state.
xCAT::NetworkUtils gains canonical_ip_address, which answers the one spelling
every spelling of an address shares. It is built on _pack_ip_address, so it
prefers core Socket and falls back to the optional Socket6. The index keys on
that answer, and it indexes node names for any first field whose shape is an
address.
On a host with no parser for IPv6 the canonical form is undefined and the
index keys on the literal. An address change written the same way still leaves
one entry, through the node name. An equivalent spelling becomes a second
entry, which is the limit of what such a host can decide.
makehosts_ipv6.t now runs addnode and delnode and reads the host entries they
produced. Eight of its 21 assertions fail against the previous index,
including the address change and both spelling-equivalence cases.
makehosts_index.t stubbed xCAT::NetworkUtils as an empty package. It loads the
real module, because the index now reads the canonical address from it.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Two gaps from the same branch.
ddns.pm:453 assigned "my @myips = _local_addresses_for_network(...)" and never
read the value, and _local_addresses_for_network had no other caller. The
routine and its three assertions in ddns_ipv6.t are removed: a test on a
routine nothing calls measures nothing and keeps dead code alive.
The commit that moved the shell tests to bats deleted el10_ipv6_runtime.t and
wrote no bats file for pre.rhels10, so its new create_listen_socket, its peer
allow list, its screendump rewrite and extract_url_host had no assertions.
ipv6_pre_rhels10.bats renders the install monitor pre.rhels10 embeds, fills
the two substitution tokens the way xCAT fills them, runs it and speaks its
protocol over each family. It also drives extract_url_host and the expression
that finds the install URL in the kernel command line, read from the script
rather than retyped.
Six reversions of the script were each measured: an AF_INET-only listener, a
missing peer check, the os.popen screendump, the colon split of the URL, a
grep that drops the bracket alternative, and a missing strip on the received
command. Every one fails at least one assertion.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Sixteen assertions on this branch matched a regular expression against the
source of the code they test. Such an assertion passes when the code is moved
somewhere it never runs, and fails when the file is reformatted and nothing
has changed: a perltidy respace of updatenode.pm:1606 turned
updatenode_ipv6_endpoint.t red with the behaviour unchanged.
updatenode_ipv6_endpoint.t now runs updatenoderunps and updatenodesoftware
and reads the xdsh command each one dispatched. It also covers the service
node name that has no usable endpoint, which the regular expressions could
not reach.
anaconda.pm built the debug syslog kernel arguments inline inside two large
subs. Move each to its own sub, _netboot_syslog_kcmdline_args and
_install_syslog_kcmdline_args, and render them in the test. An unusable
server name now gives no syslog arguments, where it gave "syslog.server="
with nothing after it.
pping is a program with no sub API, so the nmap and fping command building
moves to xCAT::DSHCore as nmap_ping_command and fping_ping_command, and pping
stays the caller that forks and execs the list.
credentials_ipv6_callback.t read allowcred.awk as text, and ran gawk from a
.t. The awk program is covered by xCAT-test/bats/ipv6_allowcred_awk.bats,
which starts it and speaks the credential protocol to it over both families.
Stubbing Socket6 and IO::Socket::INET6 in %INC also unskips the four
_open_callback_socket assertions, which skipped where the suite runs.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
makehosts reads the address test in four places. The branch widened all four
from isIpv4addr to isValidIp so an IPv6 hosts.ip reaches /etc/hosts, and only
addotherinterfaces had a test. Narrowing add_hosts_content, delotherinterfaces
or the no-noderange path back to isIpv4addr left the whole unit suite passing,
so three of the four changes measured nothing.
The no-noderange path had no sub to call: its loop sat inside process_request,
which opens /etc/hosts and takes a lock. Move that loop to
add_all_hosts_content, which takes the hosts table rows and answers the node
names, and leave the table read, donics and writeout in process_request. The
domain carry-over between rows is kept as it was.
makehosts_ipv6.t now drives each of the three remaining places with an IPv6
address and reads the host entries it produced. Each one fails on its own
assertion when its address test is narrowed back to isIpv4addr.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
makedhcp answers "Error: Unable to resolve the tftpserver for node" for a node
whose tftpserver or xcatmaster is an IPv6 address, and exits non-zero. Measured
on an AlmaLinux 10.2 management node with tftpserver=2001:db8:7309::1: the
DHCPv6 reservation and its bootfile-url were written correctly and makedhcp
still reported the error.
next_server_for_node reads both attributes with inet_aton, which cannot parse
an IPv6 literal, and treats the failure as a misconfiguration. An IPv6 boot
server is named in the DHCPv6 reservation rather than in a DHCPv4
next-server, so there is no DHCPv4 answer due and nothing to report. Both
branches now return without a value when the attribute is an IPv6 address.
A name that does not resolve is still reported, which is the behaviour the new
assertions would otherwise be satisfied by removing. dhcp_kea_plugin_intent.t
covers all three: removing either guard fails the matching "reports no error"
assertion, and removing the error path fails the assertion that names the
attribute.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
makedhcp -n answers "IPv6 network 2001:db8:7309:: must include a prefix length
for Kea DHCPv6" and writes no DHCPv6 config for a network whose mask column
holds /64. Measured on an AlmaLinux 10.2 management node: the network was
defined with mask=/64 and makedhcp -n exited 1, leaving /etc/kea/kea-dhcp6.conf
as the example file the Kea package ships.
kea_subnet6_intent in dhcp.pm parsed the mask itself with /^(\d+)$/, so it took
64 and refused /64. NetworkUtils::getIPv6PrefixLength already reads both
spellings, from the net value or from the mask column, and is what the rest of
the IPv6 code uses. kea_subnet6_intent now calls it, which removes the second
parse of the same field.
dhcp_kea_plugin_intent.t drives kea_subnet6_intent with both spellings and
asserts each yields the /64 subnet. Against the unfixed tree the /64 case fails
two assertions. A third assertion holds the refusal for a network that names no
prefix at all, matched on the message rather than on the error being set.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The ported branch predates the Kea control-socket detection, the iPXE netboot
method and the isValidIp validator that master now carries, so seven unit
files failed: six on the isValidIPAddress name the branch added beside
master's isValidIp, and netboot_options_ipv6.t on the netboot method list.
Every caller now uses isValidIp. netboot_options_ipv6.t no longer names a
method list: it reads the netboot value each node template ships, and asserts
that lookupNetboot offers it for that architecture and that a plugin of that
name exists. The Kea renderer loses the control_socket_name assertions, which
expected a socket basename; control_socket_path reads the real runtime
directory out of the Kea build report instead. getipaddr keeps one address per
host, so the cache assertion now states the invariant master implements: an
IPv6 cache entry is never served to an OnlyV4 caller.
kea_node_reservations resolves the next server on first use, because
next_server_for_node reports an unresolvable tftpserver and an IPv6-only node
leaves the loop before it needs one. kea_sync_node_client_classes skips an
IPv6-only node before the mac column is read, so a *NOIP* alias on such a node
no longer produces a DHCPv4 DROP class, while the same alias on an IPv4 node
still does.
network_utils_ip_validation.t is renamed networkutils_ipv6_helpers.t, one
character away from master's networkutils_ip_validation.t being too close to
tell apart.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
An IPv6-only provisioning network cannot deploy a node. The discovery and
credential callbacks open IPv4 sockets, the kickstart and boot templates
render an IPv4 address into every endpoint, and makehosts drops an IPv6
value because hosts.pm gates on isIpv4addr.
NetworkUtils gains the address helpers the rest of the change uses:
format_host_port, parse_host_port and format_uri_host bracket an IPv6
literal, getNodeNetworkCfg6 reads the static IPv6 configuration of a node,
my_ip_facing_family selects the management-node address of one family,
getIPv6ReverseZone builds a nibble-aligned reverse zone, and
node_is_ipv6_only and ipv6_server_for_node answer the two questions the
plugins used to answer for themselves. credentials.pm opens the callback
socket through IO::Socket::INET6 when the modules are present and keeps the
IPv4 path when they are not. Template.pm and anaconda.pm render an IPv6
kickstart network line and bracketed endpoints. The postscripts and the
stateless xcatroot format every endpoint through the bracketing helpers.
xCAT-server requires perl-IO-Socket-INET6 and perl-Socket6 on EL, and
libio-socket-inet6-perl and libsocket6-perl on Debian.
(cherry picked from commits c0a69bb5a and caa8ca790)
Ported onto upstream master ee6b4f532. The two commits are folded because the
second refactors the first. Master is kept where it has a newer form of the
same thing: the getipaddr cache guard, the Kea control_socket_path helper, the
netboot method list, install_device_params, the modern_installer test and the
isValidIp validator, which replaces the isValidIPAddress this branch added.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
nodeset refuses a uftp image unless the marker that genimage wrote
matches its initial ramdisk. imgexport did not carry the marker, so an
imported image could not use UFTP until genimage ran again. imgexport
and imgimport now carry it like the root image check marker.
imgimport refuses a bundle that names the marker but lacks it, before
it replaces any boot file.
nodeset adds xcat.uftp= and xcat.uftpfp= to the kernel command line of
a stateless node whose image has rootimgtransport uftp, directly or
from site.rootimgtransport. The node then receives the root image over
UFTP and downloads it over HTTP when that fails.
nodeset refuses a node when its image cannot use UFTP. That is the case
when the root image check is off, the image URL uses https, or the
image has a BitTorrent .metainfo file. It is also the case when the
listener does not serve the image directory, or the initial ramdisk
that nodes will boot is not the one that genimage marked as having the
receiver. nodeset also refuses a node whose linuximage.addkcmdline or
bootparams.addkcmdline sets either argument. nodeset checks this before
it copies the boot files to TFTP, so a refused node keeps its current
boot entry and the kernel and initial ramdisk that the entry names.
Statelite images ignore the attribute, as it applies to stateless
images only.
Booting nodes need a server that sends a published root image once to
every node that asks for it in a short window.
xcat-uftp-listener accepts HTTP/1.0 GET requests that name an image
path and its digest. It serves only an archive that packimage published
under the configured image roots, for a digest that the checksum file
lists. It keeps the archive open from the first request, so a later
packimage does not change the bytes of a queued batch. It collects the
requests for the same inode, digest and port for batch_delay seconds,
then runs one closed-group uftp session for the batch. Connections,
queued jobs, senders and receivers per job are limited.
The sender gets an argument vector built only from the configuration,
and signs the encrypted session with a persistent server key. It drops a
receiver that misses nearly every block of a section, so one node
without multicast cannot hold the session open. A sender that is not the
UFTP 5 build of xcat-dep is refused.
block_size allows larger packets on jumbo frame networks, up to the
8800-byte limit of uftp.
xCAT::UFTP holds the decisions of the listener: request checks, batches,
limits, timeouts and the runtime check. The script holds the sockets,
the key commands and the sender processes.
The packages install the service but do not enable it. Package removal
stops and disables it.
Booting nodes, nodeset, genimage and the transfer listener need one
definition of the root image that a node may receive over UFTP and of
how a request names it. xCAT::UFTP resolves a request inside the
configured image roots to the archive that packimage published with its
checksum file, and the digest that the node names must be a line of that
file. The module also reads the listener configuration and the server
key fingerprint, builds the uftp command, checks the UFTP receiver of an
image, records the initial ramdisk that genimage built with it, and
builds the nodeset kernel arguments. It accepts a uftp sender or
receiver only when it is the UFTP 5 build of xcat-dep, which marks its
version string. That build carries fixes that stock UFTP 5.0.4 lacks.
The design follows the UFTP transport that Richard Ray proposed in
xcat2/xcat-core#3560.
Share line normalization and directive filtering across the legacy text
reader, its include reader and the record reader. Keep leading whitespace
in legacy includes and leave each parser expansion policy unchanged.
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
UFTP multicast distribution of the root image needs a switch for each
image and a default for the cluster, as the root image checksum has.
site.rootimgtransport sets the default, which is http when it is unset.
The rootimgtransport attribute of an osimage overrides it.
rootimg_transport returns http or uftp, and refuses any other value with
the name of the attribute that holds it.
imgimport publishes the root image, kernel and ramdisk before it writes
the image definition. When the database refused or failed a write, the
new boot files stayed with the previous definition.
The import now holds the publication lock of the image from before it
places the files until the outcome of the definition is known. When the
definition is not written and its rows went back, it puts back the
previous files, with the checksum and metainfo of the root image. It
removes the files that had no previous version. While a row did not go
back, the new files stay, as that row can refer to them.
The image lock is per host, so another host can publish a root image
between two steps of a caller. lock_rootimg_publication and
unlock_rootimg_publication let a caller hold the publication lock across
such steps. publish_rootimg takes the held lock, and the new
unpublish_rootimg removes an archive with its checksum and metainfo
under it.
set_config writes the osimage, linuximage and kit rows one by one. When
a later write failed, the rows written before it stayed. An image could
keep a new linuximage row, with a new rootimgdir, beside its previous
osimage row.
set_config now keeps the osimage and linuximage rows that it replaces,
disabled rows included. When a write or its commit fails, or bundle
data of an unexpected shape dies between the writes, it checks each row
that it tried to write. It writes changed rows back and removes the rows
that it added, with NULL values as NULL. It skips a row that another
writer changed or filled, so that change stays. set_config reports the
rows that did not go back, also to a caller that asks for their number.
Kit rows stay as written, because other images can use them.
imgimport ignored the result of each write of the image definition. A
write that the database refused left the previous rows, and the import
still reported success. The import now fails and names the table when a
write returns an error, returns no reply or dies, or its commit fails.
A row that holds the new values despite the failure counts as written,
with a warning.
After a failed write the import commits, as before. A rollback would
drop the pending writes of other requests, which share the transaction
of the table in the database worker.
imgimport took the image lock only when the bundle had a rootimg. A
statelite bundle has a rootimgtree instead, so its import extracted the
tree while genimage, packimage, liteimg or rmimage could change the same
image. imgimport now locks the directory of the first of the rootimg,
rootimgtree, kernel and ramdisk that the bundle has.
imgimport wrote the image definition before it published the root
image. When the publication failed, as when another host held the
publication lock, the import failed with the new definition and the
previous files.
imgimport now places the root image, kernel and ramdisk first, then
writes the image definition, then places the other files. A later
failure leaves the definition that matches the published boot files,
as before. Before it writes anything, imgimport also opens the tables
of the image definition without autocommit, as it writes them. A table
that it cannot open then leaves the files as they were.
imgimport moved the boot files and kits of a bundle without a check,
and copied the extra files after it had already written the image. A
bundle without its kernel or a kit then gave a broken image without
an error. A missing extra file failed the import after it published
the root image and wrote the image definition.
imgimport now checks the boot files, kits, extra files and raw image
files that the manifest names. It does this before it writes anything,
and reports each missing file.
imgimport -n checked its nodes when it set their postscripts. By then
it had published the root image, placed the other files and written the
image definition. An undefined node then left a half-imported image.
imgimport now checks the nodes before it writes anything, and fails
with the same error.
kvm.pm made $parser, $node, $confdata and $updatetable package
variables so that kvm_uefi_firmware.t could set them and call
build_xmldesc and reconfigvm. That exposes plugin state to make it
testable, which xCAT::KVMUtils replaced for the other guest decisions.
xCAT::KVMUtils now holds vm_othersettings, requested_firmware,
firmware_error, guest_os, clock_offset and reconfigure_domain. Each one
takes its inputs as arguments. guest_os replaces build_oshash and the
<os> edits in build_xmldesc. reconfigure_domain replaces the XML
rewrite in reconfigvm and loads XML::LibXML when it is called. kvm.pm
calls these subs, and the four variables are file lexicals again.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>