Add opkg/NILinuxRT 'reboot required' witnessing feature #46774
What does this PR do?
Add new reboot required witnessed logic to opkg operations on NILRT systems similar to how win_system.py does it, using the same system API as on windows.
What issues does this PR fix or reference?
Doesn't have an issue assigned.
A new Linux system API is added for getting/setting reboot witness events which is called by the opkg module. The witness events are stored in volatile memory such that they're cleared upon reboot.
Commits signed with GPG?
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.
The text was updated successfully, but these errors were encountered:
Older NILRT distro versions don't use package management when installing the kernel bzImage, nor symlinks to files containing the version, so it's impossible to determine the version without using ugly hacks like this "strings" one. The need to maintain backwards compatibility complicates the matter further because there's no easy way out: We need to wait until support for older NILRT's is discontinued to avoid having both this hack and the fixed older NILRT solution at the same time, besides the one already working on newer distros.. Signed-off-by: Ioan-Adrian Ratiu <firstname.lastname@example.org>
NI's modules are special in the sense that once they're inserted in a kernel they can't be removed so a reboot is required when upgrading or uninstalling them. Some even ask for reboots when installing for the first time. NI kernel modules being a given source of reboots, we have to make restartcheck aware of them by checking a md5sum of modules.dep and its timestamp (modules.dep is modified/touched by all modules). The timestamp is checked because on a module upgrade, the modules.dep contents will be the same (identical md5 hashes). Signed-off-by: Ioan-Adrian Ratiu <email@example.com>
This adds a UNIX 'reboot required' tracking mechanism similar to the one in win_system via two witness get/set functions (same API). Only NILinuxRT makes use of it for now via the opkg module. Signed-off-by: Ioan-Adrian Ratiu <firstname.lastname@example.org>
Some packages on NILRT systems, especially kernel modules which are a poignant exception in the Linux world for this use case, require rebooting the minion after an opkg install/remove/upgrade/etc. This adds support for tracking kernel module states to know when a system reboot is necessary (via restartcheck) and calls a 'witness' function to set a temporary 'reboot required' state which is cleared on boot. If restartcheck output indicates services require restart without rebooting the system, said services are restarted without calling the 'reboot witness'. Signed-off-by: Ioan-Adrian Ratiu <email@example.com>
The fallback if's are reversed :) __salt__['service.available'] currently returns only initscripts so don't report them as systemd services by default (check first to see if it's an initscript and if not add them to systemd because in the future __salt__['service.available'] may return systemd services). Signed-off-by: Ioan-Adrian Ratiu <firstname.lastname@example.org>