Replies: 4 comments 9 replies
-
Does the new snapshot gets activated by default? Or is there an option to enable it afterwards? |
Beta Was this translation helpful? Give feedback.
-
@agraul If I got you right your idea is to differentiate between os changing states stat needs a reboot and would be applied with Regarding the bootstrap, would be possible to handle the reboot issue on the preFlight script when we onboard from the UI, and on the bootstrap script we provide for on-boarding (maybe with a delayed reboot or send some special flag data in the return)? |
Beta Was this translation helpful? Give feedback.
-
We are facing even more basic problems of SALT states. We are seeing massive problems with e.g. file.managed and other options in file. Some more details.
we would expected that the file is created as salt-minion is reporting success. But if you then check the directory, it is empty: If you run the state again, it reports that the file is present and having the correct content. Actions performed to /etc are working. These files will be present. On SLE-Micro 5.2, salt-minion created a file called /etc/salt/minion.d/transactional_update.conf. Making this file empty solved the above error, but you will loose some functionality with updating. This is not file is not present anymore in SLE-Micro 5.5 with venv-salt-minion and salt-minion. |
Beta Was this translation helpful? Give feedback.
-
I wonder what will happen with custom state in a highstate and for states defined by the user in /etc/salt/top.sls and imported via gitfs? |
Beta Was this translation helpful? Give feedback.
-
Introduction
MicroOS, or the downstream SLE Micro, is a different operating system than openSUSE Leap / SLE. It is based on the same tools and packages, with few additions on top. These additions are few, but completely change the operating model.
The main idea is: All changes go into a new btrfs snapshot. This new snapshot is “pending” until a reboot activates it.
Until now, we tried to hide the differences in Uyuni and relied on Salt to do the right thing. This strategy was easy for us to use, but it did not work well. We need to change the approach we take with transactional systems.
Improvements
Differentiate between OS-unchanging and OS-altering operations
Instead of using the
transactional_update
executor, Uyuni should call eitherstate.apply
ortransactional_update.apply
. Uyuni is in full control of which states are applied in a new snapshot and which states are not. The SLS file is the smallest unit Salt can handle, there is no way to apply only parts of an SLS file inside a snapshot. Therefore, we might need to split SLS files that currently mix OS-unchanging and OS-altering operations.Uncategorized operations
vms.*
OS-unchanging operations
These operations do not alter the system, i.e. they don’t belong in a (new) snapshot. Uyuni applies them with
state.apply
for two reasons: structured output and no concurrency (queue=True
).ansible.runplaybook
cocoattest
TODO: extract installation to OS-altering statehardware.profileupdate
TODO: extractdmidecode
installation to OS-altering stateimages.*
packages.profileupdate
NOTE: we need to decide if we want to list packages on the active snapshot or the pending snapshotsrvmonitoring.status
util.systeminfo{,_full}
OS-altering operations
These operations alter the operating system itself, i.e. they belong in a (new) snapshot. Uyuni applies them with
transactional_update.apply
, unless otherwise noted.appstreams.configure
certs
channels
cleanup_minion
configuration.deploy_files
NOTE: reconfiguring a service through/etc
is special as there is an overlayfs./etc/
can also be targeted withstate.apply
distupgrade
packages{,.patch*,.pkg*}
services.docker
services.kiwi-image-server
services.reportdb-user
services.salt-minion
REVIEW: Is all of this still needed? NOTE:file.managed
in/etc
can be applied withstate.apply
srvmonitoring.{enable,disable}
switch_to_bundle
util.{mgr_disable_fqdns_grain,mgr_mine_config_clean_up}
: NOTE: configures in/etc
, restarts a service (broken)util.rotate_saltssh_key
util.mgr_start_event_grains
NOTE: configures in/etc
, can be applied withstate.apply
util.mgr_switch_to_venv_minion
util.sync*
NOTE: can be applied withstate.apply
, these sync Salt modules to/var/cache/
on the Minionuptodate
update-salt
Either OS-unchanging or OS-altering
These operations can be either OS-unchanging or OS-altering because they are to generic to know ahead of time. Users need to have control over the way these Salt states are applied.
custom
custom_groups
custom_org
recurring
remotecommands
scap
NOTE:remediate=True
is likely OS-alteringAutomatically reboot during bootstrapping
When bootstrapping a new system, we rely on information present on the client system know what kind of system it is. This includes finding out if the new system is a transactional system. Bootstrapping happens with Salt SSH and
state.apply
. The bootstrap SLS file contains logic to install our Salt Minion package correctly on both traditional and transactional systems.The bootstrap SLS file installs the Salt Minion package into the next snapshot. We need to reboot to activate it.
Ideas:
state.apply
. Uyuni would need to look at the returned state ids to differentiate between a bootstrap state than ran on a transactional system, e.g.copy_transactional_conf_file_to_etc
. This complects implementation details and makes the system hard to change.cmd.run bg=True
to trigger the reboot in the future. This leaves the door open for race conditions or long delays.certs
andbootstrap
tostate.apply
/transactional_update.apply activate_transaction=True
.Enable Salt SSH contact method
Currently we rely on calling
transactional-update run salt-call
, which needs a Salt codebase available in the new snapshot. With Salt SSH, there is no installed Salt codebase on the system, and therefore missing from the new snapshot. Originally, this was not the case and was introduced to fix another bug (PR). We should revisit this decision and find a way that does not depend on anything within a transaction.Review approach of rebooting systems
One-off reboots can be triggered by Uyuni with
state.single module.run transactional_update.reboot queue=True
.Current approaches
uptodate.sls
This state is not applied automatically. Users can set up “recurring” states with this SLS included, which will call
salt.apply
(with the transactional_update executor redirecting this totransactional_update.apply
).This state is a good candidate for
transaction_update.apply activate_transaction=true
Java Class
SaltSystemReboot
Results in a state like:
This chunk is not added to SLS files that computed for transactional systems. For transactional systems, the "Action Chains" approach, is used.
REVIEW: Used in code path when user clicks on “schedule reboot” in WebUI.
Action Chains
Uyuni’s Action Chains implementation uses a custom Salt execution module that checks metadata we pass from the Java code base. This execution module calls
transactional_update.reboot
to trigger a reboot.Custom SLS
Users might specify states that use e.g.
cmd.run
orsystem.reboot
in their custom Salt states. This only works correctly when it’s the last state, otherwise the rest of the SLS file is not applied.Requesting a reboot after applying an SLS file is a WebUI/API feature that’s orthogonal to the specific SLS file. Instead of keeping a "reboot at the end"-request within SLS files, Uyuni should expose a checkbox / API argument and set
activate_transaction
accordingly on thetransactional_update.apply
call for transactional systems. On traditional Linux operating systems, Uyuni can insert a reboot state withSaltSystemReboot
.Make state functions available for transactional systems
service.enabled
: currently needs dbus, we need a way that does not require dbus for enabling the serviceservice.disabled
currently needs dbus, we need a way that does not require dbus for enabling the serviceDifferentiate active and pending state in Uyuni
Both the WebUI and the API should provide information about the currently active state/snapshot of a transactional system, and of the pending state of the same system. This is important to show accurate information without requiring a reboot to ensure there is no pending state.
For example, we currently can’t answer this simple question accurately: Do I need to update package foo? If we look at the active state, the answer might be yes, install the update. At the same time, looking at the pending state, the answer might be no, just reboot. Both answers are right, and both are needed to obtain the full picture.
Beta Was this translation helpful? Give feedback.
All reactions