The various *_by_arch configurations were being applied inconsistently
across boot drivers. This unifies the logic across the drivers and
ensures consistent setting of kernel/ramdisk.
An inconsistent setting of kernel/ramdisk is any case where we can't get
*both* the kernel and ramdisk to use from the same configuration type.
For instance, a node-level override in driver_info that specifies a
deploy_kernel but no deploy_ramdisk. These represent a misconfiguration
at a base level, since kernels and ramdisks must be tightly coupled.
This adds validation at startup such that if any X_ramdisk_by_arch and
X_kernel_by_arch configurations exist that are not mirrored -- e.g. a
kernel exists for aarch64 but no ramdisk, Ironic will print a warning
log on start.
We've also unified behavior when inconsistencies occur at runtime:
- If CONF.conductor.error_on_ramdisk_config_inconsistency is True, an
inconsistency will cause an exception to be immediately raised,
failing whatever operation was needing to boot a ramdisk to
immediately fail.
- If CONF.conductor.error_on_ramdisk_config_inconsistency is False,
Ironic will fall back to a less specific configuration -- for
instance, if driver_info[deploy_ramdisk] is set but not
driver_info[deploy_kernel], Ironic would fall back to the
next-less-specific option, the deploy_*_by_arch config options. If
those are inconsistent, we'd fail back to deploy_kernel/deploy_ramdisk
-- the global default.
Previous behavior varied by driver, but in the worst cases would combine
a deploy_kernel from one level (e.g. driver_info) and deploy_ramdisk
from another (e.g. global default) or vice versa. This behavior is
considered a bug as kernels are matched up with ramdisks and generally
are not interchangable.
We expect at a future Ironic release to enable strict validation of
ramdisk/kernel consistency.
Closes-bug: 2097798
Change-Id: I429a651894be4b31a6faa5dfac0f58dd75ce8f79