2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-22 10:22:18 +00:00
Commit Graph

5 Commits

Author SHA1 Message Date
Daniel Hilst 294f7c8f0e fix(test): five checks of the Secure Boot branch pass without the code they name
Each of these five checks held with the behaviour it describes removed.

kvm_secureboot_firmware.t asked firmware_machine_error for machine virt
on riscv64 to measure the x86_64 guard. virt matches neither pc nor the
i440fx pattern, so the answer was undef with the guard removed as well.
The file now asks for pc and for a versioned i440fx on another
architecture, and for pc with nodetype.arch unset.

media_perms_readable.t asked make_readable for a directory that does not
exist to measure the -d test. File::Find returns without changing a path
there in either case, so only the warning it prints differs. The check
now also reads the warnings, which is what copycds shows the admin.
MediaPerms.pm skipped a symbolic link and nothing measured it, so the
fixture now holds one that names a file outside the tree.

vm_machine_type.bats kept two cases that a machine:pc answer for every
x86_64 node left green. "x86_64 without a firmware" repeats the second
line of test 2 and is deleted. assert_round_trip never read the machine
type apply wrote, so it now takes the expected machine type and the
Secure Boot round trip states q35.

Four mutations turn the three files red: the x86_64 guard, the -d test,
the symbolic-link test, and machine:pc for every x86_64 node.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 10:12:52 -03:00
Daniel Hilst 94d2ce2cd5 fix(kvm): a Secure Boot domain can start on a firmware with no enrolled keys
guest_os stated <loader secure='yes'/> alone for a node with
vm.othersettings firmware:efi-secureboot. libvirt reads that element as
the secure-boot feature, and a firmware with secure-boot and an empty key
store boots an unsigned binary. The two x86_64 descriptors of an EL 10
host name the same OVMF_CODE.secboot.fd and differ in the nvram template,
OVMF_VARS.secboot.fd against OVMF_VARS.fd, so only descriptor priority
picked the one that holds keys. Commit 772b2c656 of this branch says that
element selects the descriptor with enrolled keys. It does not.

firmware_features names secure-boot and enrolled-keys for a Secure Boot
guest, and add_firmware_features writes them into the <os> of the domain.
guest_os cannot carry the element: the firmware attribute of <os> and the
<firmware> child of <os> are one key of one hash for XMLout, and the
attribute is the one that starts the selection. firmware:efi asks for no
feature and is unchanged.

Measured with libvirt 11.10.0 on an x86_64 host, with the enrolled
descriptor masked for one connection: the old XML starts on OVMF_VARS.fd
with enrolled-keys resolved to no, and the new XML is refused with
"Unable to find 'efi' firmware that is compatible with the current
configuration". virt-xml-validate accepts the new XML.

kvm_secureboot_firmware.t covers the features and the element. Two
mutations turn it red: dropping enrolled-keys from firmware_features, and
making add_firmware_features return its argument.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-22 10:11:49 -03:00
Daniel Hilst 1edcddab89 fix(kvm): the firmware guard refuses a machine type xCAT cannot judge
firmware_machine_error refused every machine type that did not contain
q35, so a node with firmware:efi and a machine type xCAT does not know
failed at mkvm. xCAT does not know which machine types a hypervisor
offers, and reg_linux_diskless_installation_flat relies on mkvm accepting
machine:invalid so that it can measure the provisioning failure that
follows. That case failed at the mkvm before it reached the measurement.

The guard now names the i440fx family alone: pc, pc-i440fx-* and
i440fx-*, whose descriptors carry no UEFI firmware. Any other value goes
to libvirt, which reports a machine type it cannot use.

kvm_secureboot_firmware.t covers both halves, and a mutation that
restores the q35 test turns the invalid-machine check red.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:36:46 -03:00
Daniel Hilst 242cff9c1c fix(kvm): a machine type of vm.othersettings takes a UEFI node to i440fx
guest_arch_profile moves an x86_64 node that asks for efi to q35, because
every x86_64 OVMF descriptor targets pc-q35-* only. guest_os then writes
a machine: setting of vm.othersettings over that machine type, so a node
with firmware:efi and machine:pc reaches libvirt asking for a UEFI
firmware on i440fx. libvirt answers "Unable to find 'efi' firmware that
is compatible with the current configuration" and names neither the node
nor either setting, and rpower boot fails with no way to see why.

firmware_machine_error refuses the pair, and build_xmldesc returns it
before the domain is built. The message names the node, both settings and
the machine type to use. A node that names no machine type, a q35 of any
version, and the machine types of another architecture are all unchanged.

kvm_secureboot_firmware.t covers the refusal and the five values that are
not refused.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:36:46 -03:00
Daniel Hilst e3956e7a95 test(kvm): a node cannot ask for UEFI that verifies what it boots
vm.othersettings firmware:efi asks libvirt for UEFI and states nothing
about Secure Boot. libvirt then takes the firmware descriptor of highest
priority that fits the guest, and that order belongs to the hypervisor.
The same node boots a firmware that verifies its kernel on one host and
one that does not on another, and the domain reports neither.

kvm_secureboot_firmware.t reads firmware:efi-secureboot through
requested_firmware, guest_arch_profile and guest_os. Six of its twelve
checks fail on this commit: the value is refused as unknown, so the node
keeps SeaBIOS and no <loader secure='yes'/> reaches the domain.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:36:45 -03:00