stage_genesis_payload() runs restorecon and discards its exit status, so a
relabel that fails returns 0 and the kernel keeps the context of the install
tree. mknb_genesis_selinux_context.t asserted that rc, so the test held the
defect in place. It now requires the failure to reach the caller, with the
kernel path and a message that names the relabel.
selinux_context.sh reads only the output of restorecon -F -n -v, so a non-zero
exit with no output reports GENESIS_SELINUX_OK.
The helper also builds genesis.kernel.<arch> from the architecture it was
given. With legacy Genesis, mknb ppc64le resolves share/xcat/netboot/genesis/
ppc64 and writes genesis.kernel.ppc64, so the helper fails on a kernel mknb
never staged. Three ppc64le cells run this case.
genesis_kernel_selinux_context.bats drives the helper with lsdef, mknb,
selinuxenabled and restorecon shadowed and XCATROOT in a scratch tree. Three of
its four checks fail without the fix that follows, and the fourth fails when the
OpenEmbedded branch is removed.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
vm_machine_type.sh invalid saves an empty vmothersetting when lsdef
fails, so the next restore deletes the configuration of the node. A
second invalid replaces the saved value with one that holds
machine:invalid. The script writes the state file at a predictable path
and follows a symbolic link there.
Add tests for a failed lsdef, a repeated invalid, a snapshot left by an
earlier run, a symbolic link as the state file or the state directory,
and a state directory that other users can write. Add tests for an
empty value that lsdef read and for a restore that fails. The first
group fails on the current script.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Exercise the complete ospkgs and otherpkgs scripts with recorded package
commands. Check unattended options, pkglist environment, failure status,
and CUDA architecture handling without extracting source fragments.
Use the production repository probes and package names. Check that
missing repositories and failed queries stop both installers before any
package transaction, and that similar package names do not satisfy EPEL.
Run OS detection in a private filesystem with the real release parser.
Remove the rewritten-source Perl harness and require GNU awk for the
legacy Red Hat fallback.
reg_linux_diskless_installation_flat adds a machine type to
vmothersetting and removes it again with a substring sed. When the node
already names a versioned machine type, the sed removes the first match
from the user's own value: cpumode:host-passthrough;machine:pc-q35-9.2
comes back as cpumode:host-passthrough-q35-9.2;machine:pc. The same
happens on riscv64 with machine:virt-9.2.
vm_machine_type.sh now saves the exact vmothersetting before it adds
machine:invalid, and restore writes that value back and deletes the
saved copy. An empty value clears the attribute. apply keeps a machine
type that the node already names and adds the architecture default only
when there is none. restore fails when no value was saved, and apply
fails for an architecture without a default.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
vm_machine_type.sh removes the machine type it added with a substring
sed. When vmothersetting already names a versioned machine type, the sed
cuts the first match out of the user's own value:
cpumode:host-passthrough;machine:pc-q35-9.2 comes back as
cpumode:host-passthrough-q35-9.2;machine:pc.
Run the three steps of the case and require the exact original value at
the end, for an empty value, machine:invalid, versioned x86_64 and
riscv64 machine types, and several settings. Also require that apply
keeps a machine type the node already names. Three round trips and the
apply test fail on the current helper.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
reg_linux_diskless_installation_flat sets machine:invalid, a valid
machine type and then no machine type in vmothersetting with three long
inline commands. The bats test for them cut the commands out of the case
file with a regex.
Move the three commands unchanged into commoncmd/vm_machine_type.sh and
call it from the case. The bats test now sources the helper and runs the
case's three steps against a stubbed lsdef and chdef.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
On a RHEL node, Red Hat Subscription Management owns the CodeReady
Builder repository as codeready-builder-for-rhel-<major>-<arch>-rpms.
enable_crb.sh only asks dnf for the crb and powertools ids, so it cannot
enable the repository on RHEL and go-xcat then fails to resolve its
dependencies.
The new bats cases stub subscription-manager, dnf, rpm and uname. The
two RHSM cases fail on the current script. The EL9 crb, EL8 powertools
and dnf failure cases pass on it and keep that behaviour fixed.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
nic_cfg.sh backup ends its SUSE branch with "|| :" and sends stderr to
/dev/null. A cp that fails on a real ifcfg file therefore returns 0 and
prints nothing, and the restore later puts back an incomplete backup.
The new cases check that a directory with no ifcfg file still backs up,
that an ifcfg file is copied, and that a failed copy returns non-zero
with the cp error on stderr. The last case fails on the current script.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The comments added with these fixes carried the bug history, the failing case
names and the reproduction detail. A reader of the code cannot act on any of
it, and the commit message already holds it.
Each comment is reduced to the one fact the code does not show: the platform
difference, the invariant, or the reason the simpler form is wrong.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
confignetwork_static_installnic fails on its third command, on every Ubuntu cell, because
"nic_cfg.sh backup" returns 1. nic_cfg_backup_absent_dir.bats drives the backup subcommand
for each backend with no configuration directory present, and four of its six tests fail
without the fix that follows.
The two that pass in both states are the ones that hold the behaviour down: a backend whose
directory does exist still has its files copied, and a backup that cannot create its own
directory still reports failure.
nic_cfg.sh takes the backend and every directory from the environment so the test drives it
against a scratch tree. Nothing else reads those names, and the defaults are unchanged.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit d3589094c9056ade0006e82741916ae9d82ac9a2)
A network object that declares mtu=1496 leaves the NIC on its old MTU. After
"updatenode <node> -P confignetwork" the connection profile says 1496 and "ip link" says
1500. The new profile is not the active one either, so a query of the NIC reports the MTU of
the connection it replaced.
configeth chooses between writing the configuration files and also restarting the NIC. It
compares the addresses the node has against the addresses the networks table declares, and
it sets the flag for nicextraparams. An MTU change is in neither test, so bool_restart_flag
stays 0 whenever the NIC is up and xcat_history_important already names it. The files are
written, nmcli adds the connection, and the "nmcli con reload; nmcli con up" that activates
it never runs.
Compare the MTU as well, in xcat_nic_mtu_changed in xcatlib.sh, and set bool_restart_flag
when it differs. A network that declares no MTU is unchanged, as is a NIC whose MTU cannot be
read.
The case that covers this is confignetwork_secondarynic_updatenode. It fails on EL8 and EL9
and passes on EL10, where /etc/sysconfig/network-scripts does not exist, so
xcat_history_important is never written and every run takes the restart path.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit bde80e46ce15f6831fe49dda644f193f5d2e5b97)
Two non-gating cases fail on the EL x86_64 CI cells. These tests capture both defects before
the fixes land.
makedhcp_remote_network fails on EL10 and passes on EL8 and EL9, where the DHCP backend is
ISC. The new case in dhcp_kea_plugin_intent.t asks kea_build_dhcp4_intent for one relayed
network and one local network, and holds down both subnets and their interface binding.
confignetwork_secondarynic_nicextraparams_updatenode fails on EL8 only.
nic_cfg_show_backend_file.bats drives "nic_cfg.sh show" with nmcli stubbed, for an
ifcfg-backed connection and for a keyfile-backed one.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 11d6a20d3d56d12d7c3c0e9eda3645c86a1264b6)
Replace the extracted-function Perl runner with BATS tests that invoke
routeop in isolated Linux namespaces. Check route commands, persistent
entries, matching routes, and replacement failures.
The persist test sourced only xcatlib.sh and never reached the gate in configeth that skipped an
ifcfg profile, so putting that gate back left every test green. Its refusal test also passed on a
127 from a missing function.
The test now calls the repair through xcat_nm_persist_nic_extra_params with nmcli stubbed to
report an ifcfg file and a keyfile. It also captures three faults of xcat_persist_nic_extra_param:
it keeps an old value, it joins the key to a last line with no newline, and it appends a keyfile
key after a section that follows [user].
nic_cfg.bats captures that nm_show prints no profile when NM reports an ifcfg file, so the xcattest
case cannot match CONNECTED_MODE=yes there. nic_cfg.sh returns before its dispatch when sourced.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
bash ignores errexit for a command inverted with "!", so a "! grep" that is not the last line of
a bats test never fails it. The ifcfg test wrote two of them, and the first could not report a
[user] section appearing in an ifcfg profile.
Both now call refute_grep, the helper that exists for this. Restoring the keyfile-only write
fails that test on both assertions.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
confignetwork_secondarynic_nicextraparams_updatenode fails on openEuler 20.03sp4, 22.03sp4 and
24.03sp4 and on el8, while its sibling confignetwork_secondarynic_updatenode passes everywhere.
The only failing check is CONNECTED_MODE=yes, twice. The run log shows configeth receives the
value -- "array_nic_params 0=CONNECTED_MODE=yes" -- and the profile NetworkManager reports,
/etc/sysconfig/network-scripts/ifcfg-xcat-ens4-1, does not contain it afterwards.
configeth writes nicextraparams in configipv4 and then activates the connection. The comment on
the late persistence block states why that write does not survive: the nmcli con reload/up in the
restart phase re-serializes the connection from NetworkManager's in-memory model and drops
anything NetworkManager does not model. The block repairs it after activation, but its gate
requires xcat_uses_nm_keyfile, so it runs for a keyfile store only. el8 never reaches that test,
and openEuler reaches it and fails it because NetworkManager there reports an ifcfg file. Those
are the two families on the ifcfg path and the two that fail.
The block now runs for both stores. xcat_nm_conn_file asks NetworkManager which file holds the
connection rather than composing the name, because NetworkManager suffixes it when a file of the
plain name exists. xcat_persist_nic_extra_param writes the key as the profile spells it -- under
[user] with an xcat. prefix in a keyfile, plain in an ifcfg file -- and appends only when the key
is absent.
xcatlib_nic_extra_param_persist.bats covers both stores with nmcli stubbed. Two behavioural
mutants were run against it: restoring the keyfile-only behaviour fails the three ifcfg
assertions and leaves the keyfile ones passing, and composing the filename fails only the
resolution assertion.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The specs are resolved with rpmspec and the Debian control files with
Dpkg::Deps for each architecture. xCAT and xCATsn require ipxe-xcat
and xnba-undi where they required xnba-undi, and ipxe-xcat alone on the
other architectures. The debs depend on ipxe-xcat and recommend
xnba-undi on every architecture.
The go-xcat install lists name both packages.
The riscv64 test copied riscv64_install_list out of go-xcat with awk and
ran it on its own copy of the install list. A change to the real lists
did not reach it.
The BATS test sources go-xcat and reads the install, riscv64 and
uninstall lists for the rpm and deb names. It checks that riscv64 drops
only the legacy Genesis, adds the OpenEmbedded Genesis and keeps the
x86 boot loaders, and that the uninstall list covers every package
go-xcat installs.
fix/service-node-el fixed the management-node guard as commit 0f708b96a, with the same
correction this branch made: the log must hold lines, not gain them. The two differ
only in the comment and in the error message, so the file no longer merges as one
change.
The wording here now matches fix/service-node-el. The remaining difference in this file
is the doubled-slash path filter, which that branch does not carry.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
check_provisioning_source.sh --baseline wrote one message for two conditions:
"no access log to baseline on ${MN_BASE:+$SN}${MN_BASE:-$MN}". When the management
node has a log and the service node does not, the second expansion returns the
management node's baseline spec, not a host name. On xcat42 the message read "no
access log to baseline on nosuchnode-xyz/var/log/httpd/access_log:881". That is the
message an operator reads when xdsh cannot reach the service node, so it has to name
the host that has no log.
Each condition now has its own test and its own message.
check_provisioning_source.bats covers the service-node condition. The case also
asserts the management node's log path is absent from the message, because the node
name alone matches the old text as a substring.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 89ac4558a0)
check_provisioning_source.bats held a case that required the check to FAIL when the
management node logs nothing after the baseline. That is the hierarchical result, not
a broken log: the management node provisions the service node before the baseline and
then serves the compute node nothing. The suite passed 14 of 14 while the check could
not pass on a real cluster.
Two more cases cover the path filter. The compute node fetches the root image with
wget from a URL that carries a double slash, so the path reaches the log as
//install/netboot/..., and the filter matched neither direction: the request counted
as no boot payload on the service node, and a flat provision that served it went
unreported.
All four cases fail against the current script.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
check_provisioning_source.sh counted every request the compute node had ever
made, for any path. Both directions were wrong. A flat run left
management-node requests for the same address, so a later hierarchical run
read them as its own and failed. A service-node entry from an earlier run, or
a 404 for /favicon.ico, satisfied the positive check without any boot payload
being served.
The script now takes a baseline. --baseline records how many lines each access
log holds on the management node and on the service node, before provisioning,
and the check counts only lines after that point. It counts only requests
under /install or /tftpboot, which are the trees httpd serves a boot payload
from. A log shorter than its baseline was rotated, so it is read from its
first line. Without a baseline the check refuses to answer instead of reading
the whole log. The three hierarchy cases call --baseline before nodeset.
check_provisioning_source.bats covers both regressions: a management-node
request before the baseline no longer fails the run, a service-node request
before the baseline no longer satisfies it, and a request that carries no boot
payload does neither. Removing the baseline comparison fails the first two.
Removing the path filter fails the other two.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>